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