zfsonlinux / pkg-zfs

Native ZFS packaging for Debian and Ubuntu
https://launchpad.net/~zfs-native/+archive/daily
308 stars 55 forks source link

Ubuntu Trusty: /etc/init.d/zfs-share has wrong case pattern #159

Closed komeda-shinji closed 9 years ago

komeda-shinji commented 9 years ago

It should be like this.

--- debian/zfsutils.zfs-share.init.orig 2015-07-01 20:53:22.000000000 +0900
+++ debian/zfsutils.zfs-share.init  2015-07-01 20:53:49.000000000 +0900
@@ -52,27 +52,27 @@
 }

 case "$1" in
-   (start)
+   start)
        case "$ZFS_SHARE" in
-           ([Oo][Ff][Ff]|[Nn][Oo]|'')
+           [Oo][Ff][Ff]|[Nn][Oo]|'')
                exit 0
                ;;
        esac
        do_start
        ;;
-   (stop)
+   stop)
        case "$ZFS_UNSHARE" in
-           ([Oo][Ff][Ff]|[Nn][Oo]|'')
+           [Oo][Ff][Ff]|[Nn][Oo]|'')
                exit 0
                ;;
        esac
        do_stop
        ;;
-   (force-reload|reload|restart|status)
+   force-reload|reload|restart|status)
        # no-op
        ;;

-   (*)
+   *)
        [ -n "$1" ] && echo "Error: Unknown command $1."
        echo "Usage: $0 {start|stop}"
        exit 3
komeda-shinji commented 9 years ago

Oh! Sorry, this style works.

$ sh -c 'set start; case "$1" in (*) echo $@;; esac' 
start
dajhorn commented 9 years ago

@komeda-shinji, I'm pretty sure that the () selector is posixly correct, which satisfies the coding standard, and is compatible with dash, which satisfies system policy.

Past that, I prefer this form because the vi family of editors is better behaved with matching parenthesis. (eg: Syntax highlighting is more likely to work properly.)