Hi,
An upstream of one of the ports I work on (radare2) has imported our file(1)
implementation and claims to have found bugs. This is the first:
'ms->file' will only be assigned to 'fn' after a call to apprentice_load() and
ultimately load_1(), so the file_magwarn() at line 274 would report the default
filename "unknown".
We can trigger this behaviour by executing `file -c`:
unknown, 0: Warning: using regular magic file `/etc/magic'
Is it a bug?
Index: apprentice.c
===================================================================
RCS file: /cvs/src/usr.bin/file/apprentice.c,v
retrieving revision 1.29
diff -u -r1.29 apprentice.c
--- apprentice.c 11 Nov 2009 16:21:51 -0000 1.29
+++ apprentice.c 22 Sep 2011 14:27:17 -0000
@@ -258,6 +258,7 @@
return -1;
}
+ ms->file = fn;
if (action == FILE_COMPILE) {
rv = apprentice_load(ms, &magic, &nmagic, fn, action);
if (rv != 0)
--
Best Regards
Edd Barrett
http://www.theunixzoo.co.uk