Hello, On Wed, 12 Nov 2014, Johannes Meixner wrote:
are bashisms in RPM scriptlets allowed?
Avoid them whenever easily doable. Use POSIX shell only (use dash/ash/busybox to check, calling bash as /bin/sh does _NOT_ suffice[1]!) http://www.in-ulm.de/~mascheck/various/portability/ (and all the stuff around that page ;) Sven is the guru on shell-oddities and portability issues. -dnh [1] easy example: $ cat foo.sh foo () { x=( "foo" "bar" "fu bar" "baz" ); for i in "${x[@]}"; do printf " »%s«" "$i"; done; echo } foo $ ls -l /bin/sh /bin/ksh /etc/alternatives/ksh lrwxrwxrwx 1 root root 4 Nov 4 22:53 /bin/sh -> bash lrwxrwxrwx 1 root root 21 May 19 2011 /bin/ksh -> /etc/alternatives/ksh* lrwxrwxrwx 1 root root 10 May 19 2011 /etc/alternatives/ksh -> /bin/pdksh* $ /bin/bash foo.sh »foo« »bar« »fu bar« »baz« $ /bin/sh foo.sh »foo« »bar« »fu bar« »baz« $ /bin/zsh foo.sh »foo« »bar« »fu bar« »baz« $ /bin/pdksh foo.sh foo.sh[3]: syntax error: `(' unexpected $ /bin/ksh foo.sh foo.sh[3]: syntax error: `(' unexpected $ /bin/ash foo.sh foo.sh: 3: Syntax error: word unexpected (expecting ")") $ /bin/dash foo.sh foo.sh: 3: foo.sh: Syntax error: "(" unexpected (expecting "}") $ /usr/bin/busybox sh foo.sh foo.sh: line 3: syntax error: unexpected "(" (expecting "}") $ /bin/sash -c 'x=("foo" "bar" "fu bar" "baz"); for i in "${x[@]}"; > do > printf " »%s«" "$i"; > done; > echo;' »foo« »bar« »fu bar« »baz« (but sash won't handle the foo.sh script) -- "I have a very firm grasp on reality! I can reach out and strangle it any time!" -- from the BSD fortune file -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org