[Bug 218057] bash fails to redirect

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Mar 24 06:38:53 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218057

            Bug ID: 218057
           Summary: bash fails to redirect
           Product: Base System
           Version: 11.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: klm.quasi at gmail.com

Bash fails to redirect on recent 11.0-STABLE.
It seems to be caused by r315312 (MFC r305093).

$ uname -a
FreeBSD krsna 11.0-STABLE FreeBSD 11.0-STABLE #10 r315854: Thu Mar 23 19:43:16
JST 2017     root at krsna:/usr/obj/usr/src/sys/GENERIC  amd64
$ bash --version
GNU bash, version 4.4.12(1)-release (amd64-portbld-freebsd11.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat test.sh
echo a 3<&2
$ bash test.sh
test.sh: redirection error: cannot duplicate fd: Bad file descriptor
test.sh: line 1: 2: Bad file descriptor


r315854:
$ truss /usr/local/bin/bash test.sh
...
read(255,"echo a 3<&2\n",12)                     = 12 (0xc)
fcntl(3,F_GETFD,)                                = 0 (0x0)
fcntl(3,F_DUPFD,0xa)                             ERR#9 'Bad file descriptor'
fcntl(3,F_DUPFD,0xa)                             ERR#9 'Bad file descriptor'
fcntl(3,F_DUPFD,0x0)                             ERR#9 'Bad file descriptor'
...

r306420:
$ truss /usr/local/bin/bash test.sh
...
read(255,"echo a 3<&2\n",12)                     = 12 (0xc)
fcntl(3,F_GETFD,)                                ERR#9 'Bad file descriptor'
dup2(0x2,0x3)                                    = 3 (0x3)
fcntl(2,F_GETFD,)                                = 0 (0x0)
a
write(1,"a\n",2)                                 = 2 (0x2)
close(3)                                         = 0 (0x0)
...

I removed r305093 and it worked.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list