Your message dated Thu, 05 Jan 2023 13:19:14 +0000
with message-id <[email protected]>
and subject line Bug#1017531: fixed in dash 0.5.12-1
has caused the Debian Bug report #1017531,
regarding dash: for/while/if suppress errors from redirections with -e, POSIX 
violation
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1017531: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1017531
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dash
Version: 0.5.11+git20200708+dd9ef66-5
Version: 0.5.11+git20200708+dd9ef66-8
Severity: important
Tags: upstream

Dear Maintainer,

On current git (057cd650a4edd5856213d431a974ff35c6594489), bullseye,
and sid the following holds:
-- >8 --
$ ./src/dash -ec 'while :; do :; done < /ENOENT; echo uhoh'
./src/dash: 1: cannot open /ENOENT: No such file
uhoh
$ ./src/dash -ec 'for _ in :; do :; done < /ENOENT; echo uhoh'
./src/dash: 1: cannot open /ENOENT: No such file
uhoh
$ ./src/dash -ec 'if :; then :; fi < /ENOENT; echo uhoh'
./src/dash: 1: cannot open /ENOENT: No such file
uhoh
-- >8 --

The correct output, as demonstrated by bash, is:
-- >8 --
$ bash -ec 'while :; do :; done < /ENOENT; echo uhoh'
bash: line 1: /ENOENT: No such file or directory
$ bash -ec 'for _ in :; do :; done < /ENOENT; echo uhoh'
bash: line 1: /ENOENT: No such file or directory
$ bash -ec 'if :; then :; fi < /ENOENT; echo uhoh'
bash: line 1: /ENOENT: No such file or directory
-- >8 --

This is a POSIX violation, and quite a grave one at that:
set -e is oft[1] used to guard against precisely this type of error!

The same happens if set -e is executed.

All quotes POSIX.1, Issue 7, TC2:
sh, OPTIONS:
  > The -a, -b, -C, -e, -f, -m, -n, -o option, -u, -v, and -x options
  > are described as part of the set utility in Special Built-In
  > Utilities. 

set, DESCRIPTION, -e:
  > When this option is on, when any command fails (for any of the
  > reasons listed in Consequences of Shell Errors or by returning an
  > exit status greater than zero), the shell immediately shall exit, as
  > if by executing the exit special built-in utility with no arguments,
  > with the following exceptions:
  >
  > 1. The failure of any individual command in a multi-command pipeline
  >    shall not cause the shell to exit. Only the failure of the
  >    pipeline itself shall be considered.
  > 2. The -e setting shall be ignored when executing the compound list
  >    following the while, until, if, or elif reserved word, a pipeline
  >    beginning with the ! reserved word, or any command of an AND-OR
  >    list other than the last.
  > 3. If the exit status of a compound command other than a subshell
  >    command was the result of a failure while -e was being ignored,
  >    then -e shall not apply to this command.

XCU, 2.9.4: Shell Command Language, Shell Commands, Compound Commands:
The while Loop:
  > The format of the while loop is as follows:
  > 
  > while compound-list-1
  > do
  >   compound-list-2
  > done
(until is equivalent).
The if Conditional Construct: 
  > The format for the if construct is as follows:
  >
  > if compound-list
  > then
  >   compound-list
  > [elif compound-list
  > then
  >   compound-list] ...
  > [else
  >   compound-list]
  > fi

It follows, therefore, that
  * Exception 1. does not apply as there is no pipeline
  * Exception 2. does not apply, as the redirection does /not/ follow
    "while" or "if" directly and is /not/ part of the conditional
        compound-list
  * in the "for" case, there is no such provision, so this is likely not
    a confusion w.r.t. the conditional compound-lists
  * Exception 3. does not apply as -e was not being ignored while the
    compound commands were being executed (indeed, the compound commands
    do not run at all, as evidenced by the program terminating)

Best,
наб

[1]: https://salsa.debian.org/glibc-team/glibc/-/merge_requests/6#note_329899

-- System Information:
Debian Release: 11.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-16-amd64 (SMP w/24 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, 
TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dash depends on:
ii  debconf [debconf-2.0]  1.5.77
ii  debianutils            4.11.2
ii  dpkg                   1.20.11
ii  libc6                  2.31-13+deb11u3

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: dash
Source-Version: 0.5.12-1
Done: Andrej Shadura <[email protected]>

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

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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andrej Shadura <[email protected]> (supplier of updated dash 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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 05 Jan 2023 14:06:02 +0100
Source: dash
Architecture: source
Version: 0.5.12-1
Distribution: unstable
Urgency: medium
Maintainer: Andrej Shadura <[email protected]>
Changed-By: Andrej Shadura <[email protected]>
Closes: 558607 819829 850202 975326 1017531 1024635
Changes:
 dash (0.5.12-1) unstable; urgency=medium
 .
   * New upstream release (Closes: #1017531, #1024635).
   * Refresh patches.
   * Apply upstream patches for hash, ulimit and manpages
     (Closes: #558607, #819829, #850202, #975326).
Checksums-Sha1:
 97cd1d5275fe8d1f81c036d7c998133674c07f25 1520 dash_0.5.12-1.dsc
 e15444a93853f693774df003f87d9040ab600a5e 246054 dash_0.5.12.orig.tar.gz
 1dd0eee42af5fd7ead7de85a79a9a8699bc5bc13 38520 dash_0.5.12-1.debian.tar.xz
Checksums-Sha256:
 0861850b279fdcd8ff6740e4813896f2ad20365b5995ef175e7d18f6122633c1 1520 
dash_0.5.12-1.dsc
 6a474ac46e8b0b32916c4c60df694c82058d3297d8b385b74508030ca4a8f28a 246054 
dash_0.5.12.orig.tar.gz
 b022cf6c89c9312fe57e9a767390f022b4dbedb5f6541c06f6a8b20187a3da61 38520 
dash_0.5.12-1.debian.tar.xz
Files:
 0f4256c25db24c637966edb041f35fac 1520 shells optional dash_0.5.12-1.dsc
 57222b768b84003ea4b801e5d5e0e52b 246054 shells optional dash_0.5.12.orig.tar.gz
 4b932e195cf79623b4895b3f9a3ae0ff 38520 shells optional 
dash_0.5.12-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQSD3NF/RLIsyDZW7aHoRGtKyMdyYQUCY7bLcgAKCRDoRGtKyMdy
Ybj4AQDGyhSiHNJ+NT4Tq3TN1OImwvvVhfbyPaaUpOiSq19v3AD/YdpLQHB6Ju7W
/UrNXSUeUsP4ijKpbWe4JYF37hn18Aw=
=uLUG
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to