Received: from eggs.gnu.org ([2001:4830:134:3::10]:58038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVsXk-000395-Bb for qemu-devel@nongnu.org; Mon, 14 Oct 2013 20:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVsXb-0003UH-Dk for qemu-devel@nongnu.org; Mon, 14 Oct 2013 20:31:24 -0400 Received: from nm47.bullet.mail.ne1.yahoo.com ([98.138.120.54]:36273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVsXb-0003U7-4a for qemu-devel@nongnu.org; Mon, 14 Oct 2013 20:31:15 -0400 Message-ID: <1381796904.95421.YahooMailNeo@web163905.mail.gq1.yahoo.com> Date: Mon, 14 Oct 2013 17:28:24 -0700 (PDT) From: Edivaldo de Araujo Pereira MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1582955329-1342980063-1381796904=:95421" Subject: [Qemu-devel] blockdev.c - bug Reply-To: Edivaldo de Araujo Pereira List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" --1582955329-1342980063-1381796904=:95421 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Dear qemu developers,=0A=0A=0AI've noticed about 3 days ago a bug, apparent= ly introduced by the last massive modifications in blockdev.c, that prevent= s the use of a cdrom ISO without write permission, like in "qemu-system-i38= 6 -cdrom /some.iso ...", giving the message "could not open disk image /bpd= /bpd.iso: Could not open file: Permission denied".=0A=0AI didn't make a git= bisect to identify the offending commit, but, as the problem seemed too si= mple, I've searched through the source code for references to "cdrom", "fop= en", "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. =0A= =0AI 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.=0A=0AThank you, very much.=0A=0AEdi= valdo de Ara=FAjo Pereira=0A=0A=0APatch:=0A--------------------------------= -----------------------------------------------------------------------=0Ad= iff -rupN a/blockdev.c b/blockdev.c=0A--- a/blockdev.c 2013-10-14 13= :59:59.000000000 -0300=0A+++ b/blockdev.c 2013-10-14 20:54:42.342329= 073 -0300=0A@@ -709,7 +709,7 @@ DriveInfo *drive_init(QemuOpts *all_opts=0A= }=0A=0A/* copy-on-read is disabled with a warning for read-only devices */= =0A- read_only =3D qemu_opt_get_bool(legacy_opts, "read-only", false);= =0A+ read_only =3D ( qemu_opt_get_bool(legacy_opts, "read-only", false) = || media =3D=3D MEDIA_CDROM );=0Acopy_on_read =3D qemu_opt_get_bool(legacy_= opts, "copy-on-read", false);=0A=0Aif (read_only && copy_on_read) {=0A=0A--= ---------------------------------------------------------------------------= -------------------------- --1582955329-1342980063-1381796904=:95421 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Dear qemu develo= pers,

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 /som= e.iso ...", giving the message "could not open disk image /bpd/bpd.iso: Cou= ld not open file: Permission denied".

I didn't make a git bisect to i= dentify the offending commit, but, as the problem seemed too simple, I've s= earched 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 bee= n 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 ver= y well, but it works for me.

Thank you, very much.

<= div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: "Times= New Roman"; background-color: transparent; font-style: normal;">Ediva= ldo de Ara=FAjo Pereira


Patch:
--------------------------------= -----------------------------------------------------------------------
di= ff -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.34232= 9073 -0300
@@ -709,7 +709,7 @@ DriveInfo *drive_init(QemuOpts *all_opts<= br> }

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

if (rea= d_only && copy_on_read) {
------------------------------------= -------------------------------------------------------------------
--1582955329-1342980063-1381796904=:95421--