Re: [PATCH 1/3] ewah_read_mmap: bounds-check mmap reads
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 15, 2018, 16:20 UTC
- Message-ID
- <xmqq602k2f9o.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180615091432.7155-1-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 5 quoted lines
>> + bitmap=$(ls .git/objects/pack/*.bitmap) && > > I think the 'ls' is unnecessary and this would do: > > bitmap=.git/objects/pack/*.bitmap
Yuck.
>> + test_when_finished "rm -f $bitmap" &&
OK, this will become "rm -f .git/objects/pack/*.bitmap" and then eval that implements when-finished would make it work OK.
>> + head -c 512 <$bitmap >$bitmap.tmp &&
The reading side would be OK but would the writing side also be alright?
makefile=Mak?file
head -n 4 <$makefile >$makefile.tmp
/bin/ls -t -1 | head -n 1
Mak?file.tmpHmm...
>> + mv $bitmap.tmp $bitmap &&
Likewise...
I said "yuck" because the original does not work if there happen to be more than (or for that matter, less than) one '.bitmap' file there. But at least as long as there is one, it should work ;-)