Received: from eggs.gnu.org ([2001:4830:134:3::10]:36684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVtBz-0007G7-3t for qemu-devel@nongnu.org; Mon, 14 Oct 2013 21:13:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVtBu-0005hZ-Cp for qemu-devel@nongnu.org; Mon, 14 Oct 2013 21:12:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVtBu-0005hO-3o for qemu-devel@nongnu.org; Mon, 14 Oct 2013 21:12:54 -0400 Date: Tue, 15 Oct 2013 09:12:50 +0800 From: Fam Zheng Message-ID: <20131015011250.GA19098@T430s.nay.redhat.com> References: <1381796904.95421.YahooMailNeo@web163905.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1381796904.95421.YahooMailNeo@web163905.mail.gq1.yahoo.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] blockdev.c - bug Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Edivaldo de Araujo Pereira Cc: "qemu-devel@nongnu.org" On Mon, 10/14 17:28, Edivaldo de Araujo Pereira wrote: > Dear qemu developers, >=20 >=20 > 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". >=20 > I didn't make a git bisect to identify the offending commit, but, as th= e problem seemed too simple, I've searched through the source code for re= ferences to "cdrom", "fopen", "media" and the like, trying to find any cl= ue. My search was fruitful and I've been succesful in producing and testi= ng the following patch.=20 >=20 Thanks for reporting this. > I don't know if it is the best solution, as I don't really know the qem= u source very well, but it works for me. >=20 > Thank you, very much. >=20 > Edivaldo de Ara=FAjo Pereira >=20 >=20 > 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 > } >=20 > /* copy-on-read is disabled with a warning for read-only devices */ > - read_only =3D qemu_opt_get_bool(legacy_opts, "read-only", false); > + read_only =3D ( qemu_opt_get_bool(legacy_opts, "read-only", false)= || media =3D=3D MEDIA_CDROM ); Media check is right above this stanza, we can set the value for it there. > copy_on_read =3D qemu_opt_get_bool(legacy_opts, "copy-on-read", false); >=20 > if (read_only && copy_on_read) { >=20 > -----------------------------------------------------------------------= -------------------------------- Please use `git send-email` to format (and send) your email. See http://qemu-project.org/Contribute/SubmitAPatch for instructions on sendi= ng patches. However as this is a short fix, I'll roll out a patch and Cc you. Thanks. Fam