file(1) doesn't recognize scripts correctly
Jens Rehsack
rehsack at liwing.de
Thu Jun 5 02:52:36 PDT 2003
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
-------------- next part --------------
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 at 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
+
+
More information about the freebsd-current
mailing list