You are not logged in.

#1 2013-06-17 15:04:58

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

[Solved] the file command fails to detect a pdf file

I have a strange problem, the file command fails to detect a pdf file I have. This pdf file open perfectly in xpdf (and acroread). This file is the following one:

http://www.enseignement.be/download.php … &do_check=

[xxxxxx@xxxxxxxxx ~/downloads]$ file math.pdf 
math.pdf: data

[xxxxxx@xxxxxxxxx ~/downloads]$ pdfinfo math.pdf 
Creator:        Adobe InDesign CS5.5 (7.5)
Producer:       Adobe PDF Library 9.9
CreationDate:   Wed May  8 10:24:12 2013
ModDate:        Wed May  8 10:31:00 2013
Tagged:         yes
Form:           none
Pages:          16
Encrypted:      no
Page size:      595.276 x 841.89 pts (A4)
Page rot:       0
File size:      1469454 bytes
Optimized:      yes
PDF version:    1.6

The problem is not specific to archlinux (tested also on a Debian machine). This seems to be an upstream bug in the file command. Have you noticed problems too with the file command?

Last edited by olive (2013-06-17 17:09:58)

Offline

#2 2013-06-17 15:14:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] the file command fails to detect a pdf file

Most of my pdfs are seen as 'PDF document, version 1.x' where x is 3-7.
Only pdfs owned by festival-us are seen as data:

/usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/dur.pdf:                                     data
/usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/gv-lf0.pdf:                                  data
/usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/gv-mgc.pdf:                                  data
/usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/lf0.pdf:                                     data
/usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/mgc.pdf:                                     data

Offline

#3 2013-06-17 16:20:33

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [Solved] the file command fails to detect a pdf file

The files you mention does not seems to be pdf at all. Or if they are they are deeply corrupt. They do not open in xpdf nor even acroread and pdfinfo does not detect them.The file I have is a true pdf that open in xpdf and acroread, it is just not recognised by file.

Offline

#4 2013-06-17 17:00:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] the file command fails to detect a pdf file

olive wrote:

The files you mention does not seems to be pdf at all. Or if they are they are deeply corrupt.

Ooops, you're right:

$ apvlv /usr/share/festival/voices/us/cmu_us_slt_arctic_hts/hts/mgc.pdf
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
...

It seems that for the few pdfs I have, 'file' is working OK, but fails with the pdf you linked to.

man file wrote:

Any file that cannot be identified as having been written in any of the character sets listed above is simply said to be “data”.

Offline

#5 2013-06-17 17:03:56

aesiris
Member
Registered: 2012-02-25
Posts: 97

Re: [Solved] the file command fails to detect a pdf file

Your file has a strange "line feed"  at the beginning before the magic. If I remove it I get a working pdf and "file" recognizes it.

$ hexdump -C 1.pdf| head -n 1
00000000  0a 25 50 44 46 2d 31 2e  36 0d 25 e2 e3 cf d3 0d  |.%PDF-1.6.%.....|
$ dd if=1.pdf of=2.pdf skip=1 ibs=1 obs=4k
$ hexdump -C 2.pdf |head -n 1
00000000  25 50 44 46 2d 31 2e 36  0d 25 e2 e3 cf d3 0d 0a  |%PDF-1.6.%......|
$ file 2.pdf 
2.pdf: PDF document, version 1.6

Offline

#6 2013-06-17 17:09:34

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [Solved] the file command fails to detect a pdf file

@aesiris. Well thanks, that gives an explanation. I put the thread as solved.

Offline

Board footer

Powered by FluxBB