Debian Bug report logs - #261948
bash: "trap 0" reports usage error

version graph

Package: bash; Maintainer for bash is Matthias Klose <doko@debian.org>; Source for bash is src:bash.

Reported by: Blars Blarson <blarson@blars.org>

Date: Thu, 29 Jul 2004 03:48:01 UTC

Severity: important

Tags: sid

Found in versions 3.0-1, 3.0-7

Fixed in version bash/3.0-7

Done: Matthias Klose <doko@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Blars Blarson <blarson@blars.org>:
New Bug report received and forwarded. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Blars Blarson <blarson@blars.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash: "trap 0" reports usage error
Date: Wed, 28 Jul 2004 20:39:38 -0700
Package: bash
Version: 3.0-1
Severity: grave
Tags: sid

The new bash breaks shell scripts that have worked for over a decade on
a large variety of unix systems.  It reports a usage error on a trap
command that fits the usage shown.

quaff$ trap 0
trap: usage: trap [-lp] [[arg] signal_spec ...]

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.26+q16
Locale: LANG=C, LC_CTYPE=en_US.UTF-8

Versions of packages bash depends on:
ii  base-files                  3.1          Debian base system miscellaneous f
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand
ii  passwd                      1:4.0.3-30   Change and administer password and

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to chet@po.CWRU.Edu:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #10 received at 261948@bugs.debian.org (full text, mbox):

From: Chet Ramey <chet@caleb.ins.cwru.edu>
To: blarson@blars.org
Cc: chet@po.cwru.edu, 261948@bugs.debian.org, doko@debian.org
Subject: Re: Bug#261948: bash: "trap 0" reports usage error (forwarded from Blars Blarson)
Date: Thu, 29 Jul 2004 09:26:43 -0400
> Package: bash
> Version: 3.0-1
> Severity: grave
> Tags: sid
> 
> The new bash breaks shell scripts that have worked for over a decade on
> a large variety of unix systems.  It reports a usage error on a trap
> command that fits the usage shown.
> 
> quaff$ trap 0
> trap: usage: trap [-lp] [[arg] signal_spec ...]

This was a change made for POSIX compliance.  It works the same as previously
when not in posix mode:

caleb.INS.CWRU.Edu(2)$ ./bash
caleb.INS.CWRU.Edu(3)$ echo $BASH_VERSION
3.00.0(2)-release
caleb.INS.CWRU.Edu(3)$ trap 0
caleb.INS.CWRU.Edu(3)$ echo $?
0

POSIX says that the `action' and `condition' are both required.  The official
way to accomplish what you want is to run `trap - 0'.

(http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html)

That said, backwards compatibility is an important issue.  I will take a
look and see what I can do without causing bash to fail the POSIX test
suites.

Chet



-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
						Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Blars Blarson <blarson@blars.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #15 received at 261948@bugs.debian.org (full text, mbox):

From: Blars Blarson <blarson@blars.org>
To: Chet Ramey <chet@caleb.ins.cwru.edu>
Cc: chet@po.cwru.edu, 261948@bugs.debian.org, doko@debian.org
Subject: Re: Bug#261948: bash: "trap 0" reports usage error (forwarded from Blars Blarson)
Date: Thu, 29 Jul 2004 11:10:50 -0700
On Thu, Jul 29, 2004 at 09:26:43AM -0400, Chet Ramey wrote:
> > quaff$ trap 0
> > trap: usage: trap [-lp] [[arg] signal_spec ...]
> 
> This was a change made for POSIX compliance.  It works the same as previously
> when not in posix mode:

> POSIX says that the `action' and `condition' are both required.  The official
> way to accomplish what you want is to run `trap - 0'.
> 
> (http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html)

I can't see anything there specifying what should happen when trap is
given a single arguement.  As an unspecified condition, being
compatable with the bourne shell should be allowed.

Bash has never pretended to be a minimal posix shell, and I don't
think to should become one.  Alternate shells are available for those
who want this.

The shell script in question is part of cnews, and may predate both
posix and bash.  When we are trying to get sarge released is a poor
time to introduce such gratuitis incompatabilites.

-- 
Blars Blarson			blarson@blars.org
				http://www.blars.org/blars.html
With Microsoft, failure is not an option.  It is a standard feature.



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to chet@po.CWRU.Edu:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #20 received at 261948@bugs.debian.org (full text, mbox):

From: Chet Ramey <chet@caleb.ins.cwru.edu>
To: blarson@blars.org
Cc: chet@po.cwru.edu, 261948@bugs.debian.org, doko@debian.org
Subject: Re: Bug#261948: bash: "trap 0" reports usage error (forwarded from Blars Blarson)
Date: Thu, 29 Jul 2004 14:25:00 -0400
> On Thu, Jul 29, 2004 at 09:26:43AM -0400, Chet Ramey wrote:
> > > quaff$ trap 0
> > > trap: usage: trap [-lp] [[arg] signal_spec ...]
> > 
> > This was a change made for POSIX compliance.  It works the same as previously
> > when not in posix mode:
> 
> > POSIX says that the `action' and `condition' are both required.  The official
> > way to accomplish what you want is to run `trap - 0'.
> > 
> > (http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html)
> 
> I can't see anything there specifying what should happen when trap is
> given a single arguement.  As an unspecified condition, being
> compatable with the bourne shell should be allowed.

The arguments must be given together, or not at all.  That's what the
meta-notation

	trap [action condition ...]

means.

> The shell script in question is part of cnews, and may predate both
> posix and bash.  When we are trying to get sarge released is a poor
> time to introduce such gratuitis incompatabilites.

C news certainly predates large-scale deployment of posix-compliant shells.

Backwards compatibility issues are certainly important, and I will look
at how backwards compatibility can be preserved without causing bash to
fail posix test suites.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
						Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@cs.tu-berlin.de>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #25 received at 261948@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@cs.tu-berlin.de>
To: Blars Blarson <blarson@blars.org>, 261948@bugs.debian.org, Chet Ramey <chet@caleb.ins.cwru.edu>
Cc: control@bugs.debian.org
Subject: Re: Bug#261948: bash: "trap 0" reports usage error (forwarded from Blars Blarson)
Date: Fri, 30 Jul 2004 00:46:53 +0200
clone 261948 -1
reassign -1 cnews
severity 261948 important
thanks

just keeping the report open for others not to submit new bug reports.

Blars Blarson writes:
> On Thu, Jul 29, 2004 at 09:26:43AM -0400, Chet Ramey wrote:
> > > quaff$ trap 0
> > > trap: usage: trap [-lp] [[arg] signal_spec ...]
> > 
> > This was a change made for POSIX compliance.  It works the same as previously
> > when not in posix mode:
> 
> > POSIX says that the `action' and `condition' are both required.  The official
> > way to accomplish what you want is to run `trap - 0'.
> > 
> > (http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html)
> 
> I can't see anything there specifying what should happen when trap is
> given a single arguement.  As an unspecified condition, being
> compatable with the bourne shell should be allowed.
> 
> Bash has never pretended to be a minimal posix shell, and I don't
> think to should become one.  Alternate shells are available for those
> who want this.
> 
> The shell script in question is part of cnews, and may predate both
> posix and bash.  When we are trying to get sarge released is a poor
> time to introduce such gratuitis incompatabilites.

then please call you shell scripts using /bin/bash, not /bin/sh, as
Chet pointed out.



Bug 261948 cloned as bug 262159. Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. Full text and rfc822 format available.

Severity set to `important'. Request was from Matthias Klose <doko@cs.tu-berlin.de> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Blars Blarson <blarson@blars.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #34 received at 261948@bugs.debian.org (full text, mbox):

From: Blars Blarson <blarson@blars.org>
To: 261948@bugs.debian.org, control@bugs.debian.org
Subject: broken trap breaks other packages too
Date: Thu, 29 Jul 2004 23:56:23 -0700
clone 261948 -1
reassign -1 sendmail
retitle -1 gratuitis bash change breaks sendmailconfig
thanks

If this isn't going to be fixed in bash, it needs to be fixed in all the
packages that do "trap SIGNAL".

I can't find any other shell that claims any significant bourne shell 
compatability that is broken like this.  Even posh that claims to be
a minimal debian shell doesn't.

-- 
Blars Blarson			blarson@blars.org
				http://www.blars.org/blars.html
With Microsoft, failure is not an option.  It is a standard feature.



Bug 261948 cloned as bug 262211. Request was from Blars Blarson <blarson@blars.org> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent@vinc17.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #41 received at 261948@bugs.debian.org (full text, mbox):

From: Vincent Lefevre <vincent@vinc17.org>
To: chet@po.CWRU.Edu
Cc: blarson@blars.org, 261948@bugs.debian.org, doko@debian.org
Subject: Re: Bug#261948: bash: "trap 0" reports usage error (forwarded from Blars Blarson)
Date: Fri, 30 Jul 2004 09:51:54 +0200
On 2004-07-29 14:25:00 -0400, Chet Ramey wrote:
> > I can't see anything there specifying what should happen when trap
> > is given a single arguement. As an unspecified condition, being
> > compatable with the bourne shell should be allowed.
> 
> The arguments must be given together, or not at all.  That's what the
> meta-notation
> 
> 	trap [action condition ...]
> 
> means.

But does POSIX say that the shell *must* return an error when there's
only one argument?

The form "trap - signal" does not work under Solaris (which is still
an OS used very much, unfortunately). This means that one can no
longer write portable scripts (without having to test the OS).

Of course, starting the script with #!/bin/bash is not a solution as
this doesn't work on OS's that don't have bash.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #46 received at 261948@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: debian-devel@lists.debian.org
Cc: Blars Blarson <blarson@blars.org>, 261948@bugs.debian.org
Subject: Re: bash 3.0 breaks other packages
Date: Fri, 30 Jul 2004 01:34:52 -0700
[Message part 1 (text/plain, inline)]
On Fri, Jul 30, 2004 at 09:29:25AM +0200, Eduard Bloch wrote:
> #include <hallo.h>
> * Blars Blarson [Fri, Jul 30 2004, 12:09:42AM]:

> > The new bash in sid, when used as /bin/sh, breaks compatability with
> > every other bourne-compatable shell (including posh and dash) on the
> > syntax of the trap builtin.  This breaks at least two other packages,
> > (cnews and sendmail) and I feel should be release-critical.  Matthias
> > Klose <doko@debian.org> has downgraded the bug to important.  This is
> > bug 261948.

> Sorry, it does break compatibility with BROKEN stuff. Symptoms very
> similar to the errno.h problem and should IMO be fixed the same way:
> allow the broken syntax but spew dangerous looking error messages.

It doesn't really matter whose side of the argument the standard is on;
these are not the kinds of changes we want to be introducing in the
default shell the week before a freeze.

As it happens, the bash upload comes too late to meet the freeze
deadline for base, so there's no real reason to consider this an RC bug
in bash -- it's not a change that's getting into sarge, regardless of
the bug severity.

And if all the other shells in sarge that provide /bin/sh also support
this syntax, it also doesn't matter for sarge whether those scripts are
depending on non-POSIX features.  It appears that any packages that
break because of bash 3.0's "trap" handling should have serious bugs
filed against them; but it would be appropriate to tag these bugs
sarge-ignore as well.

> > Such changes should not be made immediatly before the freeze, it will
> > probably take us months to track down all the places the old bourne
> > syntax (rather than the modified posix one) of trap is used.

> In the current form, it is a time bomb. However, it should not be a
> problem to scan all packages and file bugs against those with broken
> syntax (so it has been done with libdb2 poisoned files, IIRC).

Bear in mind that it's possible to call trap with two arguments and have
both of them be sigspecs.  This makes it easy to miss problem scripts
when scanning the archive.

-- 
Steve Langasek
postmodern programmer
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Clint Adams <schizo@debian.org>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #51 received at 261948@bugs.debian.org (full text, mbox):

From: Clint Adams <schizo@debian.org>
To: Blars Blarson <blarson@blars.org>, 261948@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Re: Bug#261948: broken trap breaks other packages too
Date: Wed, 11 Aug 2004 14:20:03 -0400
clone 261948 -1
reassign -1 posh
retitle -1 posh trap builtin is broken
quit

> If this isn't going to be fixed in bash, it needs to be fixed in all the
> packages that do "trap SIGNAL".
> 
> I can't find any other shell that claims any significant bourne shell 
> compatability that is broken like this.  Even posh that claims to be
> a minimal debian shell doesn't.

posh is definitely broken; thanks for noticing.



Bug 261948 cloned as bug 265103. Request was from Clint Adams <schizo@debian.org> to control@bugs.debian.org. Full text and rfc822 format available.

Reply sent to Matthias Klose <doko@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Blars Blarson <blarson@blars.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #58 received at 261948-close@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: 261948-close@bugs.debian.org
Subject: Bug#261948: fixed in bash 3.0-7
Date: Mon, 20 Sep 2004 16:32:06 -0400
Source: bash
Source-Version: 3.0-7

We believe that the bug you reported is fixed in the latest version of
bash, which is due to be installed in the Debian FTP archive:

bash-builtins_3.0-7_i386.deb
  to pool/main/b/bash/bash-builtins_3.0-7_i386.deb
bash-doc_3.0-7_all.deb
  to pool/main/b/bash/bash-doc_3.0-7_all.deb
bash-minimal_3.0-7_i386.deb
  to pool/main/b/bash/bash-minimal_3.0-7_i386.deb
bash-static_3.0-7_i386.deb
  to pool/main/b/bash/bash-static_3.0-7_i386.deb
bash_3.0-7.diff.gz
  to pool/main/b/bash/bash_3.0-7.diff.gz
bash_3.0-7.dsc
  to pool/main/b/bash/bash_3.0-7.dsc
bash_3.0-7_i386.deb
  to pool/main/b/bash/bash_3.0-7_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 261948@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated bash package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 19 Sep 2004 09:06:36 +0200
Source: bash
Binary: bashdb bash-builtins bash bash-minimal bash-static bash-doc
Architecture: source i386 all
Version: 3.0-7
Distribution: unstable
Urgency: low
Maintainer: Matthias Klose <doko@debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Description: 
 bash       - The GNU Bourne Again SHell
 bash-builtins - Bash loadable builtins - headers & examples
 bash-doc   - Documentation and examples for the The GNU Bourne Again SHell
 bash-minimal - The GNU Bourne Again SHell (minimal version)
 bash-static - The GNU Bourne Again SHell (static version)
Closes: 261948
Changes: 
 bash (3.0-7) unstable; urgency=low
 .
   * Apply upstream patches 001-013, remove patches collected from the net.
   * Patch bash30-003 restores a measure of backwards compatibility for the
     `trap signum' syntax (closes: #261948).
   * Trim skeleton files.
Files: 
 bf9793b637514658920044760c988e7b 723 base required bash_3.0-7.dsc
 c0fb767ca6384df3aecfd82a3b858c01 169538 base required bash_3.0-7.diff.gz
 55d065058c88a683de87eec8917401d0 714420 doc optional bash-doc_3.0-7_all.deb
 72f7d5764dc0659ffa2314c573d3d3df 782302 base required bash_3.0-7_i386.deb
 53bfb12dd00489cf67e96f7b541bcab2 97922 utils optional bash-builtins_3.0-7_i386.deb
 416b430ed14b648829b679b73674374e 625942 shells optional bash-static_3.0-7_i386.deb
 7f03515fc5a84491a684a65a5b9caddc 181222 shells optional bash-minimal_3.0-7_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBTzutStlRaw+TLJwRAvl1AJ9TIUKLh2d6y2W2NaiQpm6ThrQS8ACdGG0e
Z3gYhjG4v9m5XsGNrt3x2To=
=FSM7
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Matthias Klose <doko@debian.org>:
Bug#261948; Package bash. Full text and rfc822 format available.

Acknowledgement sent to Wolfgang Rohdewald <wolfgang@rohdewald.de>:
Extra info received and forwarded to list. Copy sent to Matthias Klose <doko@debian.org>. Full text and rfc822 format available.

Message #63 received at 261948@bugs.debian.org (full text, mbox):

From: Wolfgang Rohdewald <wolfgang@rohdewald.de>
To: Debian Bug Tracking System <261948@bugs.debian.org>
Subject: trap: usage differs from man bash
Date: Mon, 11 Oct 2004 05:53:27 +0200
Package: bash
Version: 3.0-7
Followup-For: Bug #261948

while executing bash: trap: usage: trap [-lp] [arg signal_spec ...]
but man bash says:                 trap [-lp] [[arg] sigspec ...]

arg is once optional and once not.


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.27
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (ignored: LC_ALL set to C)

Versions of packages bash depends on:
ii  base-files                  3.1          Debian base system miscellaneous f
ii  libc6                       2.3.2.ds1-17 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand
ii  passwd                      1:4.0.3-30.1 Change and administer password and

-- no debconf information



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 21:43:35 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.