Bug#691422: init-functions: order of arguments is not context-free
Hi Arno, Le dimanche, 11 novembre 2012 13.01:41, Arno Töll a écrit : Relying on that broken behavior essentially means to trigger a bug, e.g. see #691365. If there are more such false uses of pidofproc, they should really be fixed - even in Wheezy. That said, the Release Team recently made higher barriers for unblocks as we're coming closer to a release. You got me convinced. I have uploaded lsb 4.1+Debian9 with only that change to DELAYED/4 (to let 4.1+Debian8 migrate inbetween). Then I'll file an unblock and we'll see what they think of it. (Too bad there's no DELAYED queue for bugreports :) ) Cheers, OdyX signature.asc Description: This is a digitally signed message part.
Bug#691422: init-functions: order of arguments is not context-free
Hi, On 11/10/2012 05:16 PM, Didier 'OdyX' Raboud wrote: I'll leave it up to Didier as to whether to apply it or just leave the bug wontfix. Yay, thanks! I have committed it to the packaging repository. Indeed, thanks! Now I am slightly relunctant to add it to wheezy, not sure it would warrant an unblock (although [0] shows no forecoming problem). This fix could potentially break existing initscripts (admittedly relying on that broken behaviour), so I have uploaded to experimental for now. Relying on that broken behavior essentially means to trigger a bug, e.g. see #691365. If there are more such false uses of pidofproc, they should really be fixed - even in Wheezy. That said, the Release Team recently made higher barriers for unblocks as we're coming closer to a release. -- with kind regards, Arno Töll IRC: daemonkeeper on Freenode/OFTC GnuPG Key-ID: 0x9D80F36D signature.asc Description: OpenPGP digital signature
Bug#691422: init-functions: order of arguments is not context-free
On 11/04/2012 12:02 PM, Arno Töll wrote: That said, I can live with you not wanting to fix it, but please give an error message at least, if you got an unexpected keyword argument after a positional if you do not intend to support it: I've attached a patch which will add some sanity checking to pidofproc's command-line argument parsing. With this patch, pidofproc will fail if it finds more than one non-dashed argument under any circumstances. I've also created a simple test. I'll leave it up to Didier as to whether to apply it or just leave the bug wontfix. From 5772eb3bfb45ea3de2f0e06bb4f3dd3eeafccdf6 Mon Sep 17 00:00:00 2001 From: Jeff Licquia licq...@debian.org Date: Sat, 10 Nov 2012 10:26:30 -0500 Subject: [PATCH] Sanity-check pidofproc parameters per Debian bug 691422. --- init-functions |4 test/lsb-test.sh | 28 2 files changed, 32 insertions(+) diff --git a/init-functions b/init-functions index 5cb28dc..046dfb9 100644 --- a/init-functions +++ b/init-functions @@ -75,6 +75,10 @@ pidofproc () { esac done shift $(($OPTIND - 1)) +if [ $# -ne 1 ]; then +echo $0: invalid arguments 2 +return 4 +fi base=${1##*/} if [ ! $specified ]; then diff --git a/test/lsb-test.sh b/test/lsb-test.sh index 1168a62..2db3457 100644 --- a/test/lsb-test.sh +++ b/test/lsb-test.sh @@ -8,3 +8,31 @@ log_success_msg This should succeed log_failure_msg This fails miserably echo OK! + +# Test pidofproc sanity checking. + +echo Testing pidofproc command line checks + +echo Simple check, no options: +pidofproc nonexistent +RETVAL=$? +if [ $RETVAL -ne 3 ]; then +echo Unexpected return value $RETVAL +fi + +echo With -p option: +pidofproc -p /var/run/nonexist.pid nonexistent +RETVAL=$? +if [ $RETVAL -ne 3 ]; then +echo Unexpected return value $RETVAL +fi + +echo With -p option, but in wrong place: +pidofproc nonexistent -p /var/run/nonexist.pid +RETVAL=$? +if [ $RETVAL -ne 4 ]; then +echo Unexpected return value $RETVAL +fi + +echo OK! + -- 1.7.10.4
Bug#691422: init-functions: order of arguments is not context-free
Control: tags -1 -wontfix +pending Le samedi, 10 novembre 2012 16.36:35, Jeff Licquia a écrit : I've attached a patch which will add some sanity checking to pidofproc's command-line argument parsing. With this patch, pidofproc will fail if it finds more than one non-dashed argument under any circumstances. I've also created a simple test. I'll leave it up to Didier as to whether to apply it or just leave the bug wontfix. Yay, thanks! I have committed it to the packaging repository. Now I am slightly relunctant to add it to wheezy, not sure it would warrant an unblock (although [0] shows no forecoming problem). This fix could potentially break existing initscripts (admittedly relying on that broken behaviour), so I have uploaded to experimental for now. Opinions ? OdyX [0] http://codesearch.debian.net/search?q=pidofproc+*+-p signature.asc Description: This is a digitally signed message part.
Bug#691422: init-functions: order of arguments is not context-free
On 11/10/2012 11:16 AM, Didier 'OdyX' Raboud wrote: Now I am slightly relunctant to add it to wheezy, not sure it would warrant an unblock (although [0] shows no forecoming problem). This fix could potentially break existing initscripts (admittedly relying on that broken behaviour), so I have uploaded to experimental for now. Opinions ? I think that's prudent. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#691422: init-functions: order of arguments is not context-free
Control: tags -1 +wontfix Le dimanche, 4 novembre 2012 01.36:53, Jeff Licquia a écrit : The LSB spec for pidofproc is here: https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-ge neric/iniscrptfunc.html It defines the command line arguments for pidofproc as your second form, with the -p parameter first. This is in line with a number of other commands which require that dashed parameters come before bare arguments, and is also consistent with the implementation of getopt(1), getopt(3), and the getopts shell function in POSIX (the latter of which our script relies on for argument parsing). Given this, I'm inclined to mark this bug wontfix. But I'm willing to be convinced otherwise. Same here; that makes two maintainers' opinions. :) Hereby tagging. Cheers, OdyX -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#691422: init-functions: order of arguments is not context-free
On 04.11.2012 13:21, Didier 'OdyX' Raboud wrote: Same here; that makes two maintainers' opinions. :) Hereby tagging. Given GNU style option parsers allow this, and pretty much everyone emulates GNU behavior in our Linux centric world, this breaks user's expectations (well, it did for me :). [arno@snowball]$ ls -l /lib/lsb/init-functions -rw-r--r-- 1 root root 11433 Mai 30 16:01 /lib/lsb/init-functions [arno@snowball]$ ls /lib/lsb/init-functions -l -rw-r--r-- 1 root root 11433 Mai 30 16:01 /lib/lsb/init-functions That said, I can live with you not wanting to fix it, but please give an error message at least, if you got an unexpected keyword argument after a positional if you do not intend to support it: [arno@snowball]$ dpkg lsb-base -l dpkg: error: need an action option ... [arno@snowball]$ dpkg -l lsb-base ii lsb-base 4.1+Debian7 all Linux Standard Base 4.1 init script functionality -- with kind regards, Arno Töll IRC: daemonkeeper on Freenode/OFTC GnuPG Key-ID: 0x9D80F36D signature.asc Description: OpenPGP digital signature
Bug#691422: init-functions: order of arguments is not context-free
On 10/25/2012 09:53 AM, Arno Töll wrote: As spotted in #691365, it turns out that the pidofproc function provided in /lib/lsb/init-functions is not context free. Calling pidofproc $DAEMON -p $PIDFILE in contrast to pidofproc -p $PIDFILE $DAEMON yields different results if the file in $PIDFILE does not exist. This yields to a non-context-freeness which is probably not what the user calling this function expects. The LSB spec for pidofproc is here: https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html It defines the command line arguments for pidofproc as your second form, with the -p parameter first. This is in line with a number of other commands which require that dashed parameters come before bare arguments, and is also consistent with the implementation of getopt(1), getopt(3), and the getopts shell function in POSIX (the latter of which our script relies on for argument parsing). Given this, I'm inclined to mark this bug wontfix. But I'm willing to be convinced otherwise. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#691422: init-functions: order of arguments is not context-free
Package: lsb-base Version: 4.1+Debian7 Severity: normal As spotted in #691365, it turns out that the pidofproc function provided in /lib/lsb/init-functions is not context free. Calling pidofproc $DAEMON -p $PIDFILE in contrast to pidofproc -p $PIDFILE $DAEMON yields different results if the file in $PIDFILE does not exist. This yields to a non-context-freeness which is probably not what the user calling this function expects. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org