bin/173642: ``here-document'' does not works in FreeBSD 9 /bin/sh

Aleksandr A Babaylov . at babolo.ru
Thu Nov 15 06:20:00 UTC 2012


>Number:         173642
>Category:       bin
>Synopsis:       ``here-document'' does not works in FreeBSD 9 /bin/sh
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 15 06:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Aleksandr A Babaylov
>Release:        FreeBSD 9.1-PRERELEASE amd64
>Organization:
private
>Environment:
FreeBSD aahz.babolo.ru 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Wed Oct 31 18:43:14 MSK 2012     babolo at aahz.babolo.ru:/tmp/babolo/usr/src/sys/blut  amd64


>Description:
	``here-document'' does not works in sh
>How-To-Repeat:
====================
aahz>cat $TMPDIR/t
#!/bin/sh

5<< EOF
sduyhvb
EOF
/bin/ls -l /dev/fd/5
/bin/cat /dev/fd/5

aahz>uname -a
FreeBSD aahz.babolo.ru 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Wed Oct 31 18:43:14 MSK 2012     babolo at aahz.babolo.ru:/tmp/babolo/usr/src/sys/blut  amd64
aahz>env LC_ALL=C sh $TMPDIR/t
ls: /dev/fd/5: Bad file descriptor
cat: /dev/fd/5: Bad file descriptor
aahz>df | grep fdescfs
fdescfs                           1        1         0   100%    /dev/fd
====================

On older releases it works:

====================
skeeve>cat $TMPDIR/t
#!/bin/sh
5<< EOF
sduyhvb
EOF
/bin/ls -l /dev/fd/5
/bin/cat /dev/fd/5

skeeve>uname -a
FreeBSD skeeve.babolo.ru 8.3-STABLE FreeBSD 8.3-STABLE #0: Mon Oct 22 14:20:22 MSK 2012     babolo at skeeve.babolo.ru:/tmp/babolo/usr/src/sys/blut  amd64
skeeve>env LC_ALL=C sh $TMPDIR/t
cr-xr-xr-x  1 root  wheel    0,   8 Nov 15 08:10 /dev/fd/5
sduyhvb
skeeve>df | grep fdescfs
fdescfs                          1        1        0   100%    /dev/fd
====================

====================
cicuta>cat $TMPDIR/t
#!/bin/sh

5<< EOF
sduyhvb
EOF
/bin/ls -l /dev/fd/5
/bin/cat /dev/fd/5

cicuta>uname -a
FreeBSD cicuta.babolo.ru 7.2-STABLE FreeBSD 7.2-STABLE #0: Wed May 27 02:13:01 MSD 2009     babolo at cicuta.babolo.ru:/tmp/babolo/usr/src/sys/cicuta  i386
cicuta>env LC_ALL=C sh $TMPDIR/t
p---------  1 babolo  wheel  8 Nov 15 09:48 /dev/fd/5
sduyhvb
cicuta>df | grep fdescfs
fdescfs                            1          1         0   100%    /dev/fd
====================

It seen by kdump, that 5 descriptor in FreeBSD 9 closed before using.

>Fix:

	Use /bin/sh from older version?


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list