#548687 dash: Stop on error when reading directory as script

Package:
dash
Source:
dash
Description:
POSIX-compliant shell
Submitter:
Jari Aalto
Date:
2011-09-27 01:18:19 UTC
Severity:
wishlist
#548687#5
Date:
2009-09-28 06:48:52 UTC
From:
To:
    mkdir tmp
    dash tmp/

    => No error messages, not status code $? to signify error.

Please signal an error and terminate on non-zero exit code (like Bash).

#548687#10
Date:
2009-10-04 11:31:05 UTC
From:
To:
To sunstantiate this error, here are the relevant POSXI/Susv excerpts.


The shell scripts are executed in context of <file>. The POSIX standard
reads that the context is to be readabale in order to run the
instructions.

(1)

http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

    2. Shell Command Language
    This chapter contains the definition of the Shell Command Language.
    option or from the system() and popen() functions defined in the
    System Interfaces volume of IEEE Std 1003.1-2001. If the first line
    results are unspecified.

(2)

http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html

    NAME

    sh - shell, the standard command language interpreter

    SYNOPSIS

    sh [-abCefhimnuvx][-o option][+abCefhimnuvx][+o option]

    DESCRIPTION

    The sh utility is a command language interpreter that shall execute
    commands read from a command line string, the standard input, or a
    executed are expressed in the language described in Shell Command
    Language.

(3)

Based on these points it can be concluded that it's an error by
definition to not be able to "read a file" given as an ARG for a shell
to execute. Compare to situation

    type sh
    /bin/dash

    touch file
    chmod 000 file
    sh file
    echo $?
    127

So this context, should behave similarly:

    rm file
    mkdir file
    sh file
    => should print an error

#548687#15
Date:
2009-10-05 08:32:48 UTC
From:
To:
tags 548687 + patch
forwarded 548687 upstream
quit

FYI,
http://article.gmane.org/gmane.comp.shells.dash/199

Regards, Gerrit.

#548687#26
Date:
2010-05-11 10:17:07 UTC
From:
To:
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:

ash_0.5.5.1-4_all.deb
  to main/d/dash/ash_0.5.5.1-4_all.deb
dash_0.5.5.1-4.diff.gz
  to main/d/dash/dash_0.5.5.1-4.diff.gz
dash_0.5.5.1-4.dsc
  to main/d/dash/dash_0.5.5.1-4.dsc



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 548687@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Gerrit Pape <pape@smarden.org> (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 ftpmaster@debian.org)
Format: 1.8
Date: Mon, 10 May 2010 23:12:45 +0000
Source: dash
Binary: dash ash
Architecture: all source
Version: 0.5.5.1-4
Distribution: unstable
Urgency: low
Maintainer: Gerrit Pape <pape@smarden.org>
Changed-By: Gerrit Pape <pape@smarden.org>
Description:
 ash        - compatibility package for dash
 dash       - POSIX-compliant shell
Closes: 429251 514863 540685 548493 548687 548743 557755 562836 564483 577156 577506 578104 579543
Changes:
 dash (0.5.5.1-4) unstable; urgency=low
 .
   * debian/diff/0002--SHELL-print-n-upon-EOF-CTRL-D-when-run-...diff:
     rename to 0023-*.diff.
   * debian/diff/0001--MAN-rename-sh-to-dash-update-DESCRIPTION-...diff:
     remove; applied upstream.
   * debian/diff/0001-*...0022-*.diff: new from upstream git.
     * debian/diff/0010-*.diff: Add preliminary LINENO support (closes:
       #540685).
     * debian/diff/0017-*.diff: Fix syntax array size (closes: #548493).
     * debian/diff/0009-*.diff: Honor tab as IFS whitespace when
       splitting fields in readcmd (closes: #429251).
   * debian/diff/0024-INPUT-exit-127-if-command_file-is-given-...diff:
     new; exit 127 if command_file is given but does not exist (closes:
     #548743).
   * debian/diff/0025-INPUT-exit-127-if-command_file-is-given-...diff:
     new; exit 127 if command_file is given but is a directory (closes:
     #548687).
   * debian/diff/0026-EVAL-with-set-e-exit-the-shell-if-a-...diff: new;
     with set -e exit the shell if a subshell exits non-zero (closes:
     #514863).
   * debian/diff/0027-EVAL-don-t-clear-eflag-when-forking-subshell.diff:
     new; don't clear eflag when forking subshell (closes: #514863).
   * debian/po/ja.po: [INTL:ja] Update po-debconf template translation
     (thx Hideki Yamane; closes: #564483).
   * debian/po/bg.po: [I18N:bg] Updated Bulgarian debconf translation
     (thx Damyan Ivanov; closes: #562836).
   * debian/dash.preinst: remove superfluous code (closes: #557755).
   * debian/control: Standards-Version: 3.8.4.0.
   * debian/po/vi.po: [INTL:vi] Vietnamese debconf templates translation
     update (thx Clytie Siddall; closes: #577156).
   * debian/po/eu.po: [l10n:eu] dash 0.5.5.1-3.1: updated Basque
     translation (thx dooteo; closes: #577506).
   * debian/po/pt.po: [INTL:pt] Updated Portuguese translation for
     debconf messages (thx Traduz - Portuguese Translation Team; closes:
     #578104).
   * debian/diff/0028-EVAL-Fix-command-crash.diff: new; Fix command --
     crash (closes: #579543).
 .
   [ Raphael Geissert ]
   * Document "/bin/sh -> dash" NMU changes
   * Pass package name to dpkg-divert when removing diversion
   * Simplify prerm by making dpkg-divert do most of the work
   * Pass --package name to dpkg-divert call to replace ash's diversion
   * Quoting style changes
   * Let the postinst script abort if there was already a diversion in
     place
   * Pass --package name to dpkg-divert call to remove ash's diversion
   * Add watch file
Checksums-Sha1:
 73536f032073d4e5ed70a8b2929ea14dc2be224d 1027 dash_0.5.5.1-4.dsc
 b659a223f62b47e570af31c619e5fb1d314b3156 53246 dash_0.5.5.1-4.diff.gz
 bcce90d6e317cfff8be44aed6d92cbf648a25fd6 24658 ash_0.5.5.1-4_all.deb
Checksums-Sha256:
 67bb153760f41609fdceb49669344de14e9d3139d693fa82233019d68a2f1711 1027 dash_0.5.5.1-4.dsc
 9bd9741b3bb5a9d1ca8ded2c55302b6a0b59f8c5a5de244be1222abe25b5cac7 53246 dash_0.5.5.1-4.diff.gz
 78e52d21d3dfce2819734019a4c181e578b95da86ecee1d1b7a1602e3c120166 24658 ash_0.5.5.1-4_all.deb
Files:
 3336479b3e18a7e907054eb7380f8598 1027 shells optional dash_0.5.5.1-4.dsc
 af2d759797a4c0ade6dedefd0b8d21df 53246 shells optional dash_0.5.5.1-4.diff.gz
 74b6098dfac5d6335a578b4c68241581 24658 shells optional ash_0.5.5.1-4_all.deb
iEYEARECAAYFAkvomUQACgkQGJoyQbxwpv+JKgCfRVeEXJ+5Vedd++1k8mDFDMHw
AokAn2D81+hKTtiH0Qiu6ul60Hbk+HNU
=v3ez
-----END PGP SIGNATURE-----