[pacman-dev] [PATCH] [Idea] makepkg: Extract from any file bsdtar can recognize

Dan McGee dpmcgee at gmail.com
Sat May 29 17:17:16 EDT 2010


On Sat, May 29, 2010 at 4:08 PM, Andres P <aepd87 at gmail.com> wrote:
> On Sat, May 29, 2010 at 03:44:07PM -0400, Nezmer wrote:
>> If "file -bizL" does not return a supported type. Check if the dist file
>> is recognized by bsdtar and if yes extract from it.
>>
> This is great, but I think this check:
>>   if bsdtar -tf "$file" &>/dev/null; then
> Should come before:
>>   local file_type=$(file -bizL "$file")
>
> If bsdtar -tf is deemed as reliable, then it should make the file(1)
> check redundant, seeing that makepkg uses bsdtar to extract.

Except you've now introduced the overhead of reading every archive
twice which is really stupid, since 95% of files will pass the "file"
check.

It would be much more beneficial if someone could see if upstream
bsdtar could add some command line flag to basically check if a file
is a valid archive that bsdtar can process and gives a return code
based off of that (without having to read through the entire archive).

-Dan


More information about the pacman-dev mailing list