Dear qemu developers,

I've noticed about 3 days ago a bug, apparently introduced by the last massive 
modifications in blockdev.c, that prevents the use of a cdrom ISO without write 
permission, like in "qemu-system-i386 -cdrom /some.iso ...", giving the message 
"could not open disk image /bpd/bpd.iso: Could not open file: Permission 
denied".

I didn't make a git bisect to identify the offending commit, but, as the 
problem seemed too simple, I've searched through the source code for references 
to "cdrom", "fopen", "media" and the like, trying to find any clue. My search 
was fruitful and I've been succesful in producing and testing the following 
patch. 

I don't know if it is the best solution, as I don't really know the qemu source 
very well, but it works for me.

Thank you, very much.

Edivaldo de Araújo Pereira


Patch:
-------------------------------------------------------------------------------------------------------
diff -rupN a/blockdev.c b/blockdev.c
--- a/blockdev.c        2013-10-14 13:59:59.000000000 -0300
+++ b/blockdev.c        2013-10-14 20:54:42.342329073 -0300
@@ -709,7 +709,7 @@ DriveInfo *drive_init(QemuOpts *all_opts
}

/* copy-on-read is disabled with a warning for read-only devices */
-    read_only = qemu_opt_get_bool(legacy_opts, "read-only", false);
+    read_only = ( qemu_opt_get_bool(legacy_opts, "read-only", false) || media 
== MEDIA_CDROM );
copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false);

if (read_only && copy_on_read) {

-------------------------------------------------------------------------------------------------------

Reply via email to