Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Feb 2010 16:57:00 -0800
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        FreeBSD-Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: read(1) garbage when input redirected from make incorrectly
Message-ID:  <7d6fde3d1002151657q560b701bre44419d56e61f7ac@mail.gmail.com>
In-Reply-To: <7d6fde3d1002151655q184c8a21k8a0c6c07b9b0ae79@mail.gmail.com>
References:  <364299f41002151649y2e4d4120p918759afb1fd8f6c@mail.gmail.com> <7d6fde3d1002151655q184c8a21k8a0c6c07b9b0ae79@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 15, 2010 at 4:55 PM, Garrett Cooper <yanefbsd@gmail.com> wrote:
> Hi Hackers,
> =A0 =A0I accidentally reproduced the following after executing read
> properly in a pipeline with make:

s/properly/improperly/

> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$ read DESTDIR SRCCONF <
> /usr/bin/make -V DESTDIR -V SRCCONF
> bash: read: `-V': not a valid identifier
> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$ echo $DESTDIR
> =A0ELF
> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$ hexdump -C foo
> 00000000 =A07f 45 4c 46 01 01 01 0a =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 |.ELF....|
> 00000008
> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$

And just for completeness because I executed the above directly in bash...

[root@garrcoop-fbsd /usr/home/garrcoop]# sh -c 'read DESTDIR SRCCONF <
/usr/bin/make -V DESTDIR -V SRCCONF; echo $DESTDIR > foo; hexdump -C
foo'
read: -V: bad variable name
00000000  7f 45 4c 46 01 01 01 0a                           |.ELF....|
00000008

> =A0 =A0Is this an issue to be concerned about apart from cosmetic noise,
> i.e. potential buffer access problem? I see the same garbage from
> bash/coreutils on RHEL 4.6 as well as read(1) and /bin/sh on FreeBSD
> with RELENG_8, so the issue appears to be consistent on multiple
> OSes...

Thanks,
-Garrett



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