Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 2010 12:45:50 +1100
From:      Jan Mikkelsen <janm@transactionware.com>
To:        Garrett Cooper <yanefbsd@gmail.com>
Cc:        FreeBSD-Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: read(1) garbage when input redirected from make incorrectly
Message-ID:  <BC288C06-614D-4097-901E-5CBECCCC215F@transactionware.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 16/02/2010, at 11:55 AM, Garrett Cooper wrote:

> Hi Hackers,
>    I accidentally reproduced the following after executing read
> properly in a pipeline with make:
>=20
> [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
>  ELF
> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$ hexdump -C foo
> 00000000  7f 45 4c 46 01 01 01 0a                           |.ELF....|
> 00000008
> [garrcoop@garrcoop-fbsd /usr/home/garrcoop]$
>=20
>    Is 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

I think you meant to type:

    make -V DESTDIR -V SRCCONF | read DESTDIR SRCCONF

What you are actually doing is feeding the contents of the make binary =
into:

    read DESTDIR SRCCONF -V DESTDIR -V SRCCONF

and the shell is correctly complaining about '-V' not being a valid =
identifier, and populating DESTDIR with data it got from the binary.

Jan




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BC288C06-614D-4097-901E-5CBECCCC215F>