closing file desriptors via ">&-" in /bin/sh does not work. it seems the commits to redir.c going to 4.6 caused this. http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/sh/redir.c.diff?r1=1.12.2.1&r2=1.12.2.2 Fix: I did reinsert the close(fd); in line 148 in redir.c which fixed the problem, but I do not understand the code in redir.c really, so I have no idea about any side effects this could have. if (!try) { sv->renamed[fd] = i; + close(fd); } thanks - Moritz How-To-Repeat: the below command should produce *no* output: # uname -r 4.6-RELEASE-p1 # /bin/sh -c 'echo "ha" >&-' ha # from the manpage: [n]>&- close stdout (or file descriptor n)
Responsible Changed From-To: freebsd-bugs->tjr I am working on a patch for this.
State Changed From-To: open->patched Fix committed to -CURRENT, I will MFC it after a week.
State Changed From-To: patched->closed Change has been MFC'd.