View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000618 | file | General | public | 2025-01-28 12:57 | 2025-01-30 18:43 |
Reporter | vinc17 | Assigned To | christos | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 5.45 | ||||
Fixed in Version | HEAD | ||||
Summary | 0000618: Arbitrary file starting with "%!" misidentified as PostScript document text | ||||
Description | Any file starting with "%!" is identified as PostScript document text, even files that are not PostScript, which is wrong. | ||||
Steps To Reproduce | $ echo '%!' | file - /dev/stdin: PostScript document text | ||||
Additional Information | I found this issue on a LaTeX file starting with %!TEX root = rapport-Aric.tex Such a line syntax seems to be used by some tools: https://tex.stackexchange.com/questions/148649/tex-root-to-parent-directory | ||||
Tags | No tags attached. | ||||
|
I've just seen that there is an existing bug in the Debian BTS (reported in 2021): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988451 There, Hilmar Preuße says: > The file too starts with "%!". According to [1] the magic byte for Postscript is "%!PS". So the check is not strict enough to rule out false positives. |
|
The fix is to change "%!" to "%!PS" in the magic/Magdir/printer file. I've attached a patch I've written (for the Debian package). file-postscript.patch (599 bytes)
Description: Stricter PostScript magic Bug-Debian: https://bugs.debian.org/988451 Bug: https://bugs.astron.com/view.php?id=618 Author: Vincent Lefevre <vincent@vinc17.net> Last-Update: 2025-01-28 Index: b/magic/Magdir/printer =================================================================== --- a/magic/Magdir/printer +++ b/magic/Magdir/printer @@ -5,7 +5,7 @@ # # PostScript, updated by Daniel Quinlan (quinlan@yggdrasil.com) -0 string %! PostScript document text +0 string %!PS PostScript document text !:mime application/postscript !:apple ASPSTEXT >2 string PS-Adobe- conforming |
|
Added magic for %!TEX\040root |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-01-28 12:57 | vinc17 | New Issue | |
2025-01-28 13:12 | vinc17 | Note Added: 0004163 | |
2025-01-28 14:31 | vinc17 | Note Added: 0004164 | |
2025-01-28 14:31 | vinc17 | File Added: file-postscript.patch | |
2025-01-30 18:42 | christos | Assigned To | => christos |
2025-01-30 18:42 | christos | Status | new => assigned |
2025-01-30 18:43 | christos | Status | assigned => resolved |
2025-01-30 18:43 | christos | Resolution | open => fixed |
2025-01-30 18:43 | christos | Fixed in Version | => HEAD |
2025-01-30 18:43 | christos | Note Added: 0004169 |