Bashisms and Dashisms...
Hi, A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. So if /bin/sh pointed to dash, my script would still run. Is there any way to make this more liberal? A rule like if it can be executed by any of the bourne-shell clones A, B, C in Debian, it can be used? In other words: What is the purpose of the requirement that /bin/sh-scripts may only use POSIXly correct syntax? Is the purpose to allow custom distributions or local administrators to easily replace /bin/sh with some smaller shell provided by Debian, and to easily identify maintainer scripts that won't work then? Or is it rather that also people outside Debian can make use of the code? In the former case a check like I proposed above would make sense, in the latter it wouldn't. TIA, Frank -- Frank Küster, Biozentrum der Univ. Basel Abt. Biophysikalische Chemie
Re: Bashisms and Dashisms...
On Mon, 2004-09-06 at 16:18, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. test's -L option is allowed in Debian. Its -o and -a options are not, in theory. Is there any way to make this more liberal? A rule like if it can be executed by any of the bourne-shell clones A, B, C in Debian, it can be used? This is currently under discussion on the debian-policy list. E.g., http://lists.debian.org/debian-policy/2004/08/msg00053.html -- Thomas Hood
Re: Bashisms and Dashisms...
On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. So if /bin/sh pointed to dash, my script would still run. [...] This issue has not yet been decided upon, but curently we do not take it very strict, the current rule of the thumb is: /bin/sh Script runs with | bashdashposh | bug-severity -+ yes yes yes | none yes yes no | minor yes no no | serious I guess we'll end up requiring posix + selected features for /bin/sh (echo -n, command -v, ...) cu andreas -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Bashisms and Dashisms...
Andreas Metzler [EMAIL PROTECTED] schrieb: On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. Hm, so how can *I* tell? I use to look at SUSV2 at http://www.opengroup.org/onlinepubs/007908799/ Regards, Frank -- Frank Küster, Biozentrum der Univ. Basel Abt. Biophysikalische Chemie
Re: Bashisms and Dashisms...
On Mon, Sep 06, 2004 at 05:51:47PM +0200, Frank Küster wrote: Andreas Metzler [EMAIL PROTECTED] schrieb: On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. Hm, so how can *I* tell? I use to look at SUSV2 at http://www.opengroup.org/onlinepubs/007908799/ Susv2 is not POSIX afaik, I use http://www.opengroup.org/onlinepubs/009695399/mindex.html http://www.opengroup.org/onlinepubs/009695399/utilities/test.html cu andreas -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bashisms and Dashisms...
Hi, A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. So if /bin/sh pointed to dash, my script would still run. Is there any way to make this more liberal? A rule like if it can be executed by any of the bourne-shell clones A, B, C in Debian, it can be used? In other words: What is the purpose of the requirement that /bin/sh-scripts may only use POSIXly correct syntax? Is the purpose to allow custom distributions or local administrators to easily replace /bin/sh with some smaller shell provided by Debian, and to easily identify maintainer scripts that won't work then? Or is it rather that also people outside Debian can make use of the code? In the former case a check like I proposed above would make sense, in the latter it wouldn't. TIA, Frank -- Frank Küster, Biozentrum der Univ. Basel Abt. Biophysikalische Chemie
Re: Bashisms and Dashisms...
On Mon, 2004-09-06 at 16:18, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. test's -L option is allowed in Debian. Its -o and -a options are not, in theory. Is there any way to make this more liberal? A rule like if it can be executed by any of the bourne-shell clones A, B, C in Debian, it can be used? This is currently under discussion on the debian-policy list. E.g., http://lists.debian.org/debian-policy/2004/08/msg00053.html -- Thomas Hood
Re: Bashisms and Dashisms...
On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. However, this seems unnecessarily restricted to me. dash also knows the non-POSIX extensions to the test builtin. So if /bin/sh pointed to dash, my script would still run. [...] This issue has not yet been decided upon, but curently we do not take it very strict, the current rule of the thumb is: /bin/sh Script runs with | bashdashposh | bug-severity -+ yes yes yes | none yes yes no | minor yes no no | serious I guess we'll end up requiring posix + selected features for /bin/sh (echo -n, command -v, ...) cu andreas
Re: Bashisms and Dashisms...
Andreas Metzler [EMAIL PROTECTED] schrieb: On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. Hm, so how can *I* tell? I use to look at SUSV2 at http://www.opengroup.org/onlinepubs/007908799/ Regards, Frank -- Frank Küster, Biozentrum der Univ. Basel Abt. Biophysikalische Chemie
Re: Bashisms and Dashisms...
On Mon, Sep 06, 2004 at 05:51:47PM +0200, Frank Küster wrote: Andreas Metzler [EMAIL PROTECTED] schrieb: On Mon, Sep 06, 2004 at 04:18:21PM +0200, Frank Küster wrote: A maintainer script with a #!/bin/sh line should only use posix syntax. If one needs more features (e.g. test -L), one can instead use #!/bin/bash. test -L is POSIX afaict. Hm, so how can *I* tell? I use to look at SUSV2 at http://www.opengroup.org/onlinepubs/007908799/ Susv2 is not POSIX afaik, I use http://www.opengroup.org/onlinepubs/009695399/mindex.html http://www.opengroup.org/onlinepubs/009695399/utilities/test.html cu andreas