Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2017 06:38:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 218057] bash fails to redirect
Message-ID:  <bug-218057-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218057

            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@FreeBSD.org
          Reporter: klm.quasi@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@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.htm=
l>

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)                     =3D 12 (0xc)
fcntl(3,F_GETFD,)                                =3D 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)                     =3D 12 (0xc)
fcntl(3,F_GETFD,)                                ERR#9 'Bad file descriptor'
dup2(0x2,0x3)                                    =3D 3 (0x3)
fcntl(2,F_GETFD,)                                =3D 0 (0x0)
a
write(1,"a\n",2)                                 =3D 2 (0x2)
close(3)                                         =3D 0 (0x0)
...

I removed r305093 and it worked.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-218057-8>