Bug 34101 - univention-certificate does not print usage info by default
univention-certificate does not print usage info by default
Status: RESOLVED DUPLICATE of bug 38859
Product: UCS
Classification: Unclassified
Component: SSL
UCS 3.2
All Linux
: P5 minor (vote)
: UCS 3.x
Assigned To: Philipp Hahn
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-11 14:10 CET by Philipp Hahn
Modified: 2016-06-22 13:32 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-02-11 14:10:54 CET
Calling univention-certificate without an arguments only returns 1:
  1 #!/bin/bash
 32 set -o errexit
 61 command="$1"
 62 shift
 65 »···if [ -n "$command" ]; then
 66 »···»···usage "unknown command: $command" >&2

The script already aborts in line 62 and doesn't reach line 65.

diff --git a/branches/ucs-3.2/ucs-3.2-0/base/univention-ssl/univention-certificate b/branches/ucs-3.2/ucs-3.2-0/base/univention-ssl/univention-certificate
index 6c64211..d1a0cf0 100755
--- a/branches/ucs-3.2/ucs-3.2-0/base/univention-ssl/univention-certificate
+++ b/branches/ucs-3.2/ucs-3.2-0/base/univention-ssl/univention-certificate
@@ -40,7 +40,7 @@ usage ()
        fi
 
        echo ""
-       echo "Usage: univention-certificate command [options] "
+       echo "Usage: ${0##*/} command [options] "
        echo ""
        echo "Commands:"
        echo "        new"
@@ -59,14 +59,11 @@ usage ()
 }
 
 command="$1"
-shift
+shift ||
+       usage >&2
 
 if [ "$command" != "new" -a "$command" != "revoke" -a "$command" != "renew" -a "$command" != "check" -a "$command" != "list" -a "$command" != "dump" ]; then
-       if [ -n "$command" ]; then
                usage "unknown command: $command" >&2
-       else
-               usage >&2
-       fi
 fi
 
 while [ $# -gt 0 ]; do
Comment 1 Philipp Hahn univentionstaff 2016-06-22 13:32:24 CEST
Works since r64182

*** This bug has been marked as a duplicate of bug 38859 ***