Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] [RFC] Compressed filetype detection (Bug #16011)

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Remko van der Vossen <wich AT yuugen.jp>
  • To: Ismael Luceno <ismael.luceno AT gmail.com>
  • Cc: Vlad Glagolev <stealth AT tiberian.ru>, sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] [RFC] Compressed filetype detection (Bug #16011)
  • Date: Sun, 15 May 2016 15:00:07 +0200

On Sun, May 15, 2016 at 12:00:14AM -0300, Ismael Luceno wrote:
> On 14/May/2016 21:36, Vlad Glagolev wrote:
> > How about rewriting it in something else than awk?
> >
> > Let's say what Sorcery uses, i.e. bash?
>
> I would love to see an implementation in pure BASH, I'm inclined
> towards AWK just because it was designed for pattern matching, and
> I couldn't think of any elegant way to solve the problem in pure BASH.

Pure bash is never going to work as bash cannot have nul bytes contained
in variables.

I made a version [0] that uses od(1) to get the file header in hex.
I think it's a reasonable solution that;
1) is fast
2) only depends on coreutils
3) is not sensitive to awk syntax idiosyncrasies

Regards, Remko

[0] https://bugs.sourcemage.org/attachment.cgi?id=7585




Archive powered by MHonArc 2.6.24.

Top of Page