add a couple of bugs about posix compliance and the use of getopts
authorJameson Graef Rollins <jrollins@finestructure.net>
Mon, 1 Dec 2008 04:27:36 +0000 (23:27 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Mon, 1 Dec 2008 04:39:34 +0000 (23:39 -0500)
instead of getopt.

src/common
src/monkeysphere
src/monkeysphere-server
website/bugs/posix_compliance.mdwn [new file with mode: 0644]
website/bugs/use_getopts_instead_of_getopt.mdwn [new file with mode: 0644]

index 51b04708e1e34ca13dbc4d9d4d0a591211200c4d..f6000d31d223d9245c967d6bc0324575cc84a1ca 100644 (file)
@@ -147,7 +147,7 @@ advance_date() {
     local shortunits
 
     # try things the GNU way first 
-    if date -d "$number $longunits" "$format" >&/dev/null ; then
+    if date -d "$number $longunits" "$format" >/dev/null 2>&1; then
        date -d "$number $longunits" "$format"
     else
        # otherwise, convert to (a limited version of) BSD date syntax:
index 7e800cc4d61942f53deff20817f08633da6a8a74..523ddfe2d9518c507af34f7e2f8283b1dff29fac 100755 (executable)
@@ -158,7 +158,7 @@ EOF
     log verbose "done."
 }
 
-function subkey_to_ssh_agent() {
+subkey_to_ssh_agent() {
     # try to add all authentication subkeys to the agent:
 
     local sshaddresponse
index a73b2537b928ee4ac8c307af40758cc36cc6d0ea..c4f69850c7650ca9928ad69e701aee45039c9ad0 100755 (executable)
@@ -866,9 +866,9 @@ add_certifier() {
     # export the key to the host keyring
     gpg_authentication "--export 0x${fingerprint}!" | gpg_host --import
 
-    if [ "$trust" == marginal ]; then
+    if [ "$trust" = marginal ]; then
        trustval=1
-    elif [ "$trust" == full ]; then
+    elif [ "$trust" = full ]; then
        trustval=2
     else
        failure "Trust value requested ('$trust') was unclear (only 'marginal' or 'full' are supported)."
diff --git a/website/bugs/posix_compliance.mdwn b/website/bugs/posix_compliance.mdwn
new file mode 100644 (file)
index 0000000..c2908ad
--- /dev/null
@@ -0,0 +1,9 @@
+It would be nice to make all of the Monkeysphere scripts POSIX
+compliant, for portability and light-weightedness.  Better POSIX
+compliance would probably at least be better for compatibility with
+o{ther,lder} versions of bash.  Unfortunately there are quite a few
+bashism at the moment, so this may not be trivial.  For instance:
+
+      servo:~/cmrg/monkeysphere/git 0$ checkbashisms -f src/monkeysphere-server 2>&1 | wc -l
+      50
+      servo:~/cmrg/monkeysphere/git 0$ 
diff --git a/website/bugs/use_getopts_instead_of_getopt.mdwn b/website/bugs/use_getopts_instead_of_getopt.mdwn
new file mode 100644 (file)
index 0000000..db087b4
--- /dev/null
@@ -0,0 +1,4 @@
+Since Monkeysphere is using bash, it would be nice to use the shell
+build in getopts function, instead of the external getopt program.
+This would reduce an external dependency, which would definitely be
+better for portability.