[prev in list] [next in list] [prev in thread] [next in thread] 

List:       macports-dev
Subject:    Re: multiple distfiles from multiple sources and with multiple compression types
From:       Rainer_Müller <raimue () macports ! org>
Date:       2016-03-31 16:35:46
Message-ID: 56FD51E2.3080408 () macports ! org
[Download RAW message or body]

On 2016-03-31 03:16, Ryan Schmidt wrote:
> libmagic should be used to determine the compression format; filename extension should not be used.

Was there ever a case with a .tar.gz that was actually compressed with
bzip2 or something like this? The current approach of 'use_* yes' also
assumes ${extract.suffix} and ${extract.cmd} to match...

Even then, ports could still overwrite the extract phase. We could also
still allow to set an explicit extract.cmd to overwrite the guessed
extract command.

I do not want to complicate this more than needed.

Using magic bytes would even result in wrong results in some cases. For
example for scapy, the distfile is intentionally a polyglot. It is both
a valid shell script and a zip file:

$ file -b /opt/local/var/macports/distfiles/scapy/scapy-2.3.1.zip
POSIX shell script executable (binary data)

Rainer


PS: For the curious, I found the scapy example with the following shell
snippet:

find /opt/local/var/macports/distfiles -type f -exec file -i {} \; \
|perl -nle 'if (/^[a-zA-Z0-9.\/-]+\.(.*): .*\/x-(.*);/) {
  ($m = $2) =~ s/^gzip$/gz/; $m =~ s/^bzip2$/bz2/;
  if ($1 ne $2) { print $_; }
}'
_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic