[file PATCH] Properly detect .vdi (VirtualBox disk image) files
The current test for .vdi files is incorrect. It tries to detect the string "<<< Sun xVM VirtualBox Disk Image >>>". However this string is just free text and .vdi files often contain different strings (ref: [1]). The correct test in this patch looks for the magic number at offset 0x40 in the file (ref: [2]). Example: Upstream 'file' without the patch on an example file[3]: $ file ttylinux.vdi ttylinux.vdi: data With the patch: $ ./src/file -m magic/Magdir ttylinux.vdi ttylinux.vdi: VirtualBox Disk Image, major 1, minor 1 Rich. [1] http://repo.or.cz/w/qemu.git/blob/HEAD:/block/vdi.c#l109 [2] https://forums.virtualbox.org/viewtopic.php?t=8046 [3] https://one-vbox.googlecode.com/svn-history/r117/trunk/remotes/ttylinux.vdi -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On Nov 22, 8:54am, rjones@redhat.com ("Richard W.M. Jones") wrote: -- Subject: [file PATCH] Properly detect .vdi (VirtualBox disk image) files | The current test for .vdi files is incorrect. It tries to detect the | string "<<< Sun xVM VirtualBox Disk Image >>>". However this string | is just free text and .vdi files often contain different strings (ref: [1]). | | The correct test in this patch looks for the magic number at offset | 0x40 in the file (ref: [2]). Fixed, thanks! christos
participants (2)
-
Christos Zoulas -
Richard W.M. Jones