[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: install-sh and $RANDOM
From: |
Eric Blake |
Subject: |
Re: install-sh and $RANDOM |
Date: |
Tue, 18 Oct 2016 06:24:03 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/17/2016 11:46 PM, address@hidden wrote:
> On Mon, Oct 17, 2016 at 04:56:05PM -0500, Eric Blake wrote:
>> Second, your claim that things are "spuriously bad if $RANDOM does not
>> exist" is false. Look at the full context:
>>
>> tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
>> trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit
>> $ret' 0
>
> I don't mean that it's dangerous to use (endangers the user), but deleting
> those directories when $tmpdir is just /tmp/ins- will make this script race
> other instances of itself, and delete their work.
Except that it won't be just /tmp/ins-, but /tmp/ins-$$ (that is, the
pid is encoded into each directory); parallel runs of this script have
different pids and thus different directories.
>
> (I didn't find the script in automake's git repository, so assumed this
> is the place)
automake.git/lib/install-sh
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature