Tcl Library Source Code

View Ticket
Login
Ticket UUID: 201a0a0bf5376bf3f315c51bd4c1d62fd41fe9d3
Title: The fileutil::magic compiler does not work with current "magic" files.
Type: Bug Version: 886f13b91e 2026-03-14
Submitter: kjnash Created on: 2026-03-16 12:05:16
Subsystem: fileutil :: magic Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2026-03-16 12:05:16
Resolution: None Closed By: nobody
    Closed on:
Description:
The compiler (Tcl code generator) in the "fumagic" (fileutil::magic::*) module does not work with current "magic" files.

1. In addition to the expected warnings, there are over 100 errors parsing recent magic files, e.g. those from file-5.47

ftp://ftp.astron.com/pub/file/file-5.47.tar.gz

% ::fileutil::magic::cfront::generate compressed 0 -- /path/to/file-5.47/magic/Magdir

2. The script generated by the command above produces nonsense when used

% ::fileutil::magic::filetype /bin/ls

{{P0-9][0-9]\\.[0-9][0-9][0-9][0-9]\\.[0-9][0-9][0-9][0-9\\.[0-9} NAXOS\ CAD\ System\ file\ from\ version\  followed by over 2000 characters, mostly non-printing.

The expected output (using file-5.34 magic files) is:

{ELF 64-bit LSB {pie executable} x86-64 {version 1} SYSV} {application x-pie-executable} {}