Package: dash
Version: 0.5.7-2ubuntu2
Severity: normal

(Note: I have tested this with dash built from the up-to-date sources
from the Git repository on git://git.kernel.org/pub/scm/utils/dash/dash.git
on 2013-10-18.)

Dash redirects stdin from /dev/null when a command is started
asynchronously, as specified by POSIX.
However, POSIX also specifies that this can be overridden by explicitely
redirecting.
This fails when redirecting stdin from stdin.

The relevant text from POSIX ( 
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_03_02
 ):
] The standard input for an asynchronous list, before any explicit
] redirections are performed, shall be considered to be assigned to a file
] that has the same properties as /dev/null. If it is an interactive
] shell, this need not happen. In all cases, explicit redirection of
] standard input shall override this activity.

To test: create the following script:
    #!/bin/dash
    sleep 100 <&0 &

Run this, and then look at the open file descriptors of the sleep
process:
    ls -l /proc/`pgrep sleep`/fd
The output is as follows:
    lr-x------ 1 svdb svdb 64 Oct 18 15:58 0 -> /dev/null
    lrwx------ 1 svdb svdb 64 Oct 18 15:58 1 -> /dev/pts/2
    lrwx------ 1 svdb svdb 64 Oct 18 15:58 2 -> /dev/pts/2
fd 0 is assigned to /dev/null instead of /dev/pts/2



-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: i386 (i686)

Kernel: Linux 3.5.0-41-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dash depends on:
ii  debianutils  4.2.1ubuntu2
ii  dpkg         1.16.1.2ubuntu7.1
ii  libc6        2.15-0ubuntu10.4

dash recommends no packages.

dash suggests no packages.

-- debconf information excluded


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to