* [Qemu-devel] blockdev.c - bug
@ 2013-10-15 0:28 Edivaldo de Araujo Pereira
2013-10-15 1:12 ` Fam Zheng
0 siblings, 1 reply; 2+ messages in thread
From: Edivaldo de Araujo Pereira @ 2013-10-15 0:28 UTC (permalink / raw)
To: qemu-devel@nongnu.org
[-- Attachment #1: Type: text/plain, Size: 1630 bytes --]
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) {
-------------------------------------------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 4246 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] blockdev.c - bug
2013-10-15 0:28 [Qemu-devel] blockdev.c - bug Edivaldo de Araujo Pereira
@ 2013-10-15 1:12 ` Fam Zheng
0 siblings, 0 replies; 2+ messages in thread
From: Fam Zheng @ 2013-10-15 1:12 UTC (permalink / raw)
To: Edivaldo de Araujo Pereira; +Cc: qemu-devel@nongnu.org
On Mon, 10/14 17:28, Edivaldo de Araujo Pereira wrote:
> 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.
>
Thanks for reporting this.
> 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 );
Media check is right above this stanza, we can set the value for it there.
> copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false);
>
> if (read_only && copy_on_read) {
>
> -------------------------------------------------------------------------------------------------------
Please use `git send-email` to format (and send) your email. See
http://qemu-project.org/Contribute/SubmitAPatch for instructions on sending
patches.
However as this is a short fix, I'll roll out a patch and Cc you.
Thanks.
Fam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-15 1:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 0:28 [Qemu-devel] blockdev.c - bug Edivaldo de Araujo Pereira
2013-10-15 1:12 ` Fam Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).