file command does not recognise xz archives

General support questions

file command does not recognise xz archives

Postby Moray » 2012/06/11 13:32:41

In CentOS 6.2 (minimal install, at least), file(1) does not recognise xz archives:

Code: Select all
# file initrd.img
initrd.img: data


Expected result: something along the lines of
Code: Select all
#file initrd.img
initrd.img: xz LZMA compressed archive


Is that a CentOS, Upstream Vendor, or Fedora bug?
Moray
 
Posts: 63
Joined: 2008/02/28 17:38:08
Location: England

Re: file command does not recognise xz archives

Postby TrevorH » 2012/06/11 13:45:44

Works for me. My /boot/init* files are not in xz format however so I had to xz an existing file to test with and that came back and said

Code: Select all
$ file modes.txt.xz
modes.txt.xz: xz compressed data
$  mv modes.txt.xz modes.txt.img
$ file modes.txt.img
modes.txt.img: xz compressed data
User avatar
TrevorH
Forum Moderator
 
Posts: 9166
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: file command does not recognise xz archives

Postby Moray » 2012/06/11 14:16:10

Ah. Naturally.

Code: Select all
$ echo Hello | xz -c | file -
/dev/stdin: xz compressed data


but

Code: Select all
$ echo Hello | xz -c --format=lzma | file -
/dev/stdin: data


The specific format that they use is the very one that it can't identify.
Moray
 
Posts: 63
Joined: 2008/02/28 17:38:08
Location: England

Re: file command does not recognise xz archives

Postby TrevorH » 2012/06/11 15:34:26

Mine are still in gzip format

Code: Select all
# file /boot/initramfs-2.6.32-220.*
/boot/initramfs-2.6.32-220.13.1.el6.x86_64.img: gzip compressed data, from Unix, last modified: Fri Apr 20 01:43:30 2012, max compression
/boot/initramfs-2.6.32-220.17.1.el6.x86_64.img: gzip compressed data, from Unix, last modified: Wed May 30 10:34:48 2012, max compression
/boot/initramfs-2.6.32-220.7.1.el6.x86_64.img:  gzip compressed data, from Unix, last modified: Wed Mar 14 23:27:52 2012, max compression
User avatar
TrevorH
Forum Moderator
 
Posts: 9166
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: file command does not recognise xz archives

Postby Moray » 2012/06/11 15:48:22

The initramfs files on the running system are, but the initrd file on the install CD isn't:

Code: Select all
# mount /dev/cdrom /mnt
# file /mnt/isolinux/initrd.img
/mnt/isolinux/initrd.img: data


Although according to The .lzma File Format it might be quite difficult to get file(1) to recognise the .lzma. There is no specific header sequence as there is for .xz, just a variable sequence of property data. That might make this a feature, not a bug.
Moray
 
Posts: 63
Joined: 2008/02/28 17:38:08
Location: England


Return to CentOS 6 - General Support

Who is online

Users browsing this forum: No registered users and 7 guests