Article View: net.bugs
Article #446bugs in file(1) on BTL SYS V (maybe others)
From: R.MAUS
Date: Mon, 19 Aug 1985 23:18
Date: Mon, 19 Aug 1985 23:18
64 lines
2369 bytes
2369 bytes
This line intentionally left non-blank for outdated news facilities.
(Copy of bug report reported to UNIX Support Group via "trouble" system)
BUG #1
Index:
.../src/cmd/file/file.c (BTL SYS V)
Description:
"file(1)" fails to match binary data when the most significant bit
is set for "short" types on Vaxen machines. This is due to sign
extension when the data is internally converted to a "long".
Repeat-By:
Create a test data file that has a "short" value of "0177545" as
the contents. Use the following entry in the "/etc/magic" file (or
alternate).
0 short 0177545 I bet you don't see this!
Run "file" over the test data file.
Fix:
You can probably modify the following code:
case SHORT:
val = (long)(*(short *) p);
break;
to read (something to the effect of):
case SHORT:
val = (long)(*(unsigned short *) p);
break;
This is a quick hack at best.
BUG #2
Index:
.../src/cmd/file/file.c (BTL SYS V)
Description:
"file(1)" does not check the "type" field of the "magic" file for a
complete pattern match, but rather it keys off the first few
letters. Therefore, the following "type" patterns are legal:
PATTERN TYPE COMMENT
sh* short
s* string After "sh*" pattern has been eliminated.
l* long
Fix:
Use full string comparision on the type field.
BUG #3
Index:
.../src/cmd/file/file.c (BTL SYS V)
Description:
No provision for "byte" (or "char") specifier type. It would also
be nice to have an "unsigned" type.
Fix:
Some of the scaffolding for the code exists, but no check is made
for the type against the "magic" file. The rest is left as an
exercise for the reader.
--
Richard L. Maus, Jr. (Rick)
AT&T-ISL HO 1K313 201-834-4532
...!ho???!ariel!rick
Technical Details
Message-ID:
<1005@ariel.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!ariel!rickShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site ariel.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!ariel!rick From: rick@ariel.UUCP (R.MAUS) Newsgroups: net.bugs Subject: bugs in file(1) on BTL SYS V (maybe others) Message-ID: <1005@ariel.UUCP> Date: Mon, 19-Aug-85 19:18:29 EDT Article-I.D.: ariel.1005 Posted: Mon Aug 19 19:18:29 1985 Date-Received: Tue, 20-Aug-85 22:39:12 EDT Distribution: net Organization: AT&T-ISL, Holmdel, NJ Lines: 64