The following reply was made to PR bin/173642; it has been noted by GNATS. From: Jilles Tjoelker <jil...@stack.nl> To: bug-follo...@freebsd.org, Aleksandr A Babaylov <"."@babolo.ru> Cc: Subject: bin/173642: ``here-document'' does not works in FreeBSD 9 /bin/sh Date: Sat, 17 Nov 2012 23:51:54 +0100
In PR bin/173642: > As of FreeBSD 9.0, the below script fails (with fdescfs mounted): > 5<<EOF > foo > EOF > cat /dev/fd/5 This script took advantage of a bug in sh that has been fixed. A redirection should only apply for the duration of the command it is attached to, except if that command is the builtin "exec". This includes commands consisting solely of redirections (here-documents or other kinds). Before 9.0, sh did not handle this properly if the fd was not open before a redirection attached to some kinds of commands. Note that the script will not work even with the older sh if fd 5 is already open, for example sh your-script 5</dev/null The fix is to replace the line 5<<EOF with exec 5<<EOF This will also work with the older sh, fixing the problems if fd 5 is already open. I do not plan to merge the bugfix in sh to stable/8. -- Jilles Tjoelker _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"