Austin Group Defect Tracker

Aardvark Mark IV

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000760 [1003.1(2013)/Issue7+TC1] Shell and Utilities Objection Error 2013-10-07 09:56 2019-06-10 08:55
Reporter geoffclare View Status public  
Assigned To
Priority normal Resolution Accepted  
Status Closed  
Name Geoff Clare
Organization The Open Group
User Reference
Page Number 2342
Line Number 74502
Interp Status Approved
Final Accepted Text See Note: 0001929
Summary 0000760: asynchronous list assignment of stdin should depend on job control
Description XCU Asynchronous Lists states:

    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.

What matters here is not whether the shell is interactive or not, but
whether job control is enabled or not.

Also, I'm not sure why this behaviour is allowed when job control
is enabled. It means that users cannot rely on being able to start
an interactive program in the background and then use "fg" to bring
it to the foreground when they need to provide it with some input
(having been notified that it was stopped with SIGTTIN). The desired
action disallows the behaviour when job control is enabled, as I
believe this change would be non-controversial. However, if this
change is not felt to be appropriate for TC2, it could be deferred
until Issue 8 (in which case the change in TC2 should say "may"
instead of "shall not").
Desired Action Change:

    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.


    If job control is disabled (see set -m), 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. This shall not happen if job control is
Tags tc2-2008
Attached Files

- Relationships
related to 0001254New 1003.1(2016/18)/Issue7+TC2 "asynchronous list" description uses "command" instead of "AND-OR list" 

-  Notes
nick (manager)
2013-10-17 15:50

Interpretation response
The standard states that interactive shells need not reassign standard input, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

This does not match existing practice.

Notes to the Editor (not part of this interpretation):
Make the changes suggested in the Desired Action.
ajosey (manager)
2014-02-21 15:39

Interpretation Proposed 21 Feb 2014
ajosey (manager)
2014-03-25 13:41

Interpretation Approved: 25 March 2014
stephane (reporter)
2019-06-08 06:11

Even for non-interactive shells, redirecting stdin to /dev/null when asynchronous is not particularly useful, and has to be worked around probably at least as often as it is useful.

Some shells don't do it. zsh never does it, bash does not do it when that asynchronous list is one single pipeline.

It may be more useful to leave it unspecified then (that might have been the original intention behind the original text: don't do it when interactive, unspecified when not).

It may help to add an informative section that shows how to work around it:

"{ cmd <&3 3<&- & } 3<&0" instead of "cmd &"

BTW, that whole section is incorrect as it refers to "commands" instead of "AND-OR lists". The whole part about the PID doesn't make sense in the context of an "AND-OR list" with more than one part. I'll raise a separate issue about that.
stephane (reporter)
2019-06-08 06:24
edited on: 2019-06-08 06:28

According to's "In all cases, explicit redirection of standard input shall override this activity"

cmd <&0 &

should be another work around. While that works in bash, yash (and of course zsh), it doesn't in bosh, dash, ksh93, pdksh, ksh88 (even /usr/xpg4/bin/sh on Solaris).

The wording should be updated to say something like: wherever that happens, it shall happen before the explicit redirection of the command are processed. An implementation may choose not to do it at all if the stdin of the command is redirected.

geoffclare (manager)
2019-06-10 08:46

The changes arising from this bug were applied in POSIX.1-2008 TC2, so this is not the right place to request further changes. (All of the bugs tagged tc2-2008 should have been closed some time ago to prevent this situation arising.)

Re: Note: 0004411 <&0 is a no-op, so it's unclear whether it counts as "explicit redirection of standard input".

- Issue History
Date Modified Username Field Change
2013-10-07 09:56 geoffclare New Issue
2013-10-07 09:56 geoffclare Name => Geoff Clare
2013-10-07 09:56 geoffclare Organization => The Open Group
2013-10-07 09:56 geoffclare Section =>
2013-10-07 09:56 geoffclare Page Number => 2342
2013-10-07 09:56 geoffclare Line Number => 74502
2013-10-07 09:56 geoffclare Interp Status => ---
2013-10-17 15:50 nick Interp Status --- => Pending
2013-10-17 15:50 nick Note Added: 0001929
2013-10-17 15:50 nick Status New => Interpretation Required
2013-10-17 15:50 nick Resolution Open => Accepted
2013-10-17 15:50 nick Final Accepted Text => See Note: 0001929
2013-10-17 15:59 nick Tag Attached: tc2-2008
2014-02-21 15:39 ajosey Interp Status Pending => Proposed
2014-02-21 15:39 ajosey Note Added: 0002154
2014-03-25 13:41 ajosey Interp Status Proposed => Approved
2014-03-25 13:41 ajosey Note Added: 0002197
2019-06-08 06:11 stephane Note Added: 0004410
2019-06-08 06:24 stephane Note Added: 0004411
2019-06-08 06:28 stephane Note Edited: 0004411
2019-06-10 08:46 geoffclare Note Added: 0004413
2019-06-10 08:55 agadmin Status Interpretation Required => Closed
2019-07-15 15:38 Don Cragun Relationship added related to 0001254

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker