dash does not support multi-digit file descriptors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dash (Debian) |
Confirmed
|
Unknown
|
|||
dash (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: dash
Found in dash version 0.5.4-8ubuntu1.
The POSIX specification for "Shell Command Language" at http://
The relevant part of the specification is
"The redirection operator:
[n]>&word
shall duplicate one output file descriptor from another, or shall close one. If word evaluates to one or more digits, the file descriptor denoted by n, or standard output if n is not specified, shall be made to be a copy of the file descriptor denoted by word ..."
Dash seems to only support single digit fds:
kstemen@
$ ls /proc/$$/fd
0 1 10 11 12 2 3 9
$ echo test >&3
$ echo test >&9
$ echo test >&10
sh: Syntax error: Bad fd number
$ echo test >&11
sh: Syntax error: Bad fd number
$
This seems to be caused by fixredir in parser.c:
void fixredir(union node *n, const char *text, int err)
{
TRACE(("Fix redir %s %d\n", text, err));
if (!err)
if (is_digit(text[0]) && text[1] == '\0')
else if (text[0] == '-' && text[1] == '\0')
else {
if (err)
else
}
}
tags: | added: udd-find |
Changed in dash (Debian): | |
status: | Unknown → New |
Changed in dash (Debian): | |
status: | New → Confirmed |
Confirmed.
This doesn't work either:
exec 200>file
Neither does the sample code given in the "flock" man page:
( lock/mylockfile
flock -s 200
# ... commands executed under lock ...
) 200>/var/