Opened 10 years ago

Closed 10 years ago

#43686 closed defect (fixed)

libmagic: format `(Hash, version %d, native byte-order)' does not match with `%lu'

Reported by: vergus@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: mp@…
Port: libmagic

Description

Using the file command provided by the port 'file' has not been working for a while now. It only ever produces runtime errors like the following:

$ file /tmp/testmldbm
/tmp/testmldbm: ERROR: line 46: softmagic.c, 481: format `(Hash, version %d, native byte-order)' does not match with `%lu'

However, downloading and building the same version source (5.18) works as expected:

$ ./src/file -m magic/magic.mgc /tmp/testmldbm
/tmp/testmldbm: Berkeley DB 1.85 (Hash, version 2, native byte-order)

As does the older version (5.04) provided by OS X in /usr/bin:

$ /usr/bin/file /tmp/testmldbm
/tmp/testmldbm: Berkeley DB 1.85 (Hash, version 2, native byte-order)

Attachments (2)

test_file (16.0 KB) - added by danielluke (Daniel J. Luke) 10 years ago.
file.diff (1.1 KB) - added by mp@… 10 years ago.
patch to upgrade sysutils/file to 5.19

Download all attachments as: .zip

Change History (10)

comment:1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

I haven't seen any problems with the file port recently (the latest version fixed the regex errors we were seeing before), but perhaps it's specific to this type of file your checking. How do I produce a file like your "testmldbm" to test with?

Changed 10 years ago by danielluke (Daniel J. Luke)

Attachment: test_file added

comment:2 Changed 10 years ago by danielluke (Daniel J. Luke)

I also see this with macports file vs the system provided file on BDB 1.85 hash files (like my local copy of non-macports spamassassin uses). I'm attaching a small test file which was created with the following program:

#!/opt/local/bin/perl

use DB_File;

my %hash;

my $X = tie %hash, 'DB_File', "test_file";

$X->put("foo", "bar");
$X->sync;

It also has the same issue:

% /opt/local/bin/file test_file 
test_file: ERROR: line 46: softmagic.c, 481: format `(Hash, version %d, native byte-order)' does not match with `%lu'
% /usr/bin/file test_file 
test_file: Berkeley DB 1.85 (Hash, version 2, native byte-order)

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… removed
Owner: changed from macports-tickets@… to ryandesign@…
Port: libmagic added; file removed
Status: newassigned
Summary: defect: file (libmagic) : runtime failurelibmagic: format `(Hash, version %d, native byte-order)' does not match with `%lu'

The patch I was asked to apply to fix some problems in the 5.18 release seems to have introduced this new problem.

comment:4 Changed 10 years ago by vergus@…

file 5.19 was released 3 days ago: ftp://ftp.astron.com/pub/file/

comment:5 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

I will update the port when I get a chance but I'm quite busy this week.

comment:6 Changed 10 years ago by mp@…

Cc: mp@… added

Cc Me!

Changed 10 years ago by mp@…

Attachment: file.diff added

patch to upgrade sysutils/file to 5.19

comment:7 Changed 10 years ago by mp@…

The added patch attachment:file.diff solves the issue. Tested on Mavericks.

patch-post-518.diff can be removed.

Last edited 10 years ago by mp@… (previous) (diff)

comment:8 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Thanks. r122222.

Note: See TracTickets for help on using tickets.