Date: Thu, 05 Jun 2003 11:52:32 +0200 From: Jens Rehsack <rehsack@liwing.de> To: David O'Brien <obrien@FreeBSD.ORG> Cc: freebsd-audit <freebsd-audit@freebsd.org> Subject: file(1) doesn't recognize scripts correctly Message-ID: <3EDF12E0.4020009@liwing.de>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------090807070903090406050009 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi David, hi list, you got this mail, because you maintain src/contrib/file/. If you're not responsible, please let me know and I will find someone else to bother with this :-) I was playing around with file(1) to find a solution for detecting file content correctly. I've detected, that the pattern in src/contrib/file/Magfiles/commands which are useful detecting unknow scripts correctly (lines 44-52), prevents file from detecting eg. perl or scripts correctly. Sample: $ file -b /var/www/data/trevor/flexpage/tools/fpcombinelib a /usr/local/bin/php -Cqe script text executable $ file -b /var/www/data/trevor/flexpage/tools/getPage.pl a /usr/bin/perl script text executable I created a patch which may only a workaround until a script language is added which first letters are bigger than 'various'. Maybe a better solution would be renaming all scripts to 'script.shell', 'script.php', 'script.perl', ... 'script.various' or concatanation order is created. Last one may be the best solution. Please let me know what you think. Sample after patch: $ file -b /var/www/data/trevor/flexpage/tools/getPage.pl perl script text executable $ file -b /var/www/data/trevor/flexpage/tools/fpcombinelib PHP script text executable Regards, Jens --------------090807070903090406050009 Content-Type: text/plain; name="patch-contrib-file-Magdir" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch-contrib-file-Magdir" diff -uNr Magdir.old/commands Magdir/commands --- Magdir.old/commands Thu Jun 5 09:43:50 2003 +++ Magdir/commands Thu Jun 5 09:46:15 2003 @@ -40,17 +40,6 @@ 0 string #!\ /usr/bin/env a >16 string >\0 %s script text executable - -# generic shell magic -0 string #!\ / a ->3 string >\0 %s script text executable -0 string #!\ / a ->3 string >\0 %s script text executable -0 string #!/ a ->2 string >\0 %s script text executable -0 string #!\ script text executable ->3 string >\0 for %s - # PHP scripts # Ulf Harnhammar <ulfh@update.uu.se> 0 string/c =<?php PHP script text diff -uNr Magdir.old/varied.script Magdir/varied.script --- Magdir.old/varied.script Thu Jan 1 00:00:00 1970 +++ Magdir/varied.script Thu Jun 5 09:46:15 2003 @@ -0,0 +1,11 @@ +# generic shell magic +0 string #!\ / a +>3 string >\0 %s script text executable +0 string #!\ / a +>3 string >\0 %s script text executable +0 string #!/ a +>2 string >\0 %s script text executable +0 string #!\ script text executable +>3 string >\0 for %s + + --------------090807070903090406050009--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EDF12E0.4020009>