Re: jpegs throwing up 'ambiguous filetype' dialog

  • From: Adam Krolnik <adam.krolnik@xxxxxxxxxxxxxxx>
  • To: emelfm2@xxxxxxxxxxxxx
  • Date: Mon, 19 Jan 2009 09:46:53 -0600


How about posting the alg for determining the type of the file, in pseudo code.
That way we could see how it works (or is supposed to.)

I would expect that a combination of the execute bit + filetype (`file $f`) would be good enough. If there are files not identified, and the user wants them to be, they could augment the file command
at $HOME/.magic (or $HOME/.magic.mgc).



tpgww@xxxxxxxxxxx wrote:
On Mon, 19 Jan 2009 00:26:59 +0000 (GMT)
Phil Grundig <wdef200@xxxxxxxxxxx> wrote:

I know it gets ELF binaries and shell scripts.  What
does it miss?

Other scripts (perl, python ...), libraries.
Dunno, might be worth checking if this is system or version dependent. Maybe 
different systems have different magic lists  
/etc/magic:/usr/share/misc/file/magic

file-4.02 (quite old probably) certainly catches perl scripts regardless of x 
permissions:
Not every perl script begins with #!/usr/bin/perl etc, and without such a line, 
the file is reported as ascii text. Ditto for .py, and I guess for .rb etc. 
Granted, we can't directly activate such a file, but it's still feasible for 
user to setup to run it as an argument in a command line.

With libs, maybe you grep for "ELF" as well, that would also work for 
executable binaries.   (But the only action I can think of offhand that someone might 
want to set for shared libs is ldd and it couldn't be that in demand).

AFAIK ELF is common, but not necessarily universal, format for all *NIX's that 
can run gtk. See the various default actions in emelFM2 for libs, shared and 
otherwise. Maybe they could benefit from some attention ?

Regards
Tom



--
   Soli Deo Gloria
   Adam Krolnik
   Director of Design Verification
   VeriSilicon Inc.
   Plano TX. 75074
   Co-author "Assertion-Based Design", "Creating Assertion-Based IP"

Other related posts: