From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ1Tu-0006pa-Og for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:39:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJ1Tr-0000BM-HV for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:39:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ1Tr-0000BI-8x for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:39:51 -0400 References: <1467149250-31165-1-git-send-email-stefanha@redhat.com> <1467149250-31165-7-git-send-email-stefanha@redhat.com> <57738543.3030006@openvz.org> From: Eric Blake Message-ID: <57769CD5.7060008@redhat.com> Date: Fri, 1 Jul 2016 10:39:49 -0600 MIME-Version: 1.0 In-Reply-To: <57738543.3030006@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nxBUCaPUkhVsUhhFxPUILjCp4FEi1eWuH" Subject: Re: [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before commands processing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nxBUCaPUkhVsUhhFxPUILjCp4FEi1eWuH From: Eric Blake To: "Denis V. Lunev" , Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Paolo Bonzini Message-ID: <57769CD5.7060008@redhat.com> Subject: Re: [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before commands processing References: <1467149250-31165-1-git-send-email-stefanha@redhat.com> <1467149250-31165-7-git-send-email-stefanha@redhat.com> <57738543.3030006@openvz.org> In-Reply-To: <57738543.3030006@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/29/2016 02:22 AM, Denis V. Lunev wrote: > On 06/29/2016 12:27 AM, Stefan Hajnoczi wrote: >> From: "Denis V. Lunev" >> >> This is necessary to enable creation of common qemu-img options which >> will >> be specified before command. >> + cmdname =3D argv[optind]; >> + >> + /* reset getopt_long scanning */ >> + argc -=3D optind; >> + if (argc < 1) { >> + return 0; >> + } >> + argv +=3D optind; >> + optind =3D 1; > this patch breaks check-block.sh > we should have here > 'optind =3D 0' Uggh. You've landed in one of the portability traps of getopt(). On glibc, you can reset option parsing by assigning optind to 1 (but it also works by assigning it to 0); on BSD, you instead set the variable 'optreset'; on Solaris, there is no way to reset option parsing (but then again, Solaris doesn't maintain any invisible state like glibc or BSD where you need to go out of your way to do a full reset). But regardless of how you look at it, the patch has now been committed to master without your suggested fix, so you'll have to propose a formal followup patch as a new thread. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nxBUCaPUkhVsUhhFxPUILjCp4FEi1eWuH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXdpzVAAoJEKeha0olJ0NqoHEIAKvtfsdGcx2GmIUWarujM4Iv wmZcXkNhtj7fM4Dk2IVGRMeOEl97T6IYw1ZzWOE4H34VYH0/6ZLanoGRDnPWTRWK ll6W5xP+LsOkqbpIn2tRaf3xyGOQe4UxVQgelZea2N85yjzn0YUHgoYr33aQiLK+ WMo1rMFjMHNF8GK0wGT4FhLbeBbZEFeEnIxUebEefz+U+vMuOBKf2YqTbfgxscil 2MJ738fGf+tuvPYwjYihtopxS+c2EOHDAuE2QS9aoAIuB5rLinB677T3k19INaKN GagQqx5bzrN3z2WX3fa91Y0bGM5rYP7LBtT7Gkn1bGhn1b00uvCHSDRuVBnBgBk= =XQxT -----END PGP SIGNATURE----- --nxBUCaPUkhVsUhhFxPUILjCp4FEi1eWuH--