Received: from eggs.gnu.org ([2001:4830:134:3::10]:46741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwBQO-0004Hq-H5 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:10:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwBQK-0000UT-LJ for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:10:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54170) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwBQK-0000U2-Fr for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:10:04 -0400 From: Markus Armbruster References: <1476377054-14572-1-git-send-email-armbru@redhat.com> <20161013174101.GB3275@thinpad.lan.raisama.net> <87insrdyuq.fsf@dusky.pond.sub.org> <20161017134448.GT3275@thinpad.lan.raisama.net> Date: Mon, 17 Oct 2016 19:10:01 +0200 In-Reply-To: <20161017134448.GT3275@thinpad.lan.raisama.net> (Eduardo Habkost's message of "Mon, 17 Oct 2016 11:44:48 -0200") Message-ID: <87zim29a1i.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] machine: Fix replacement of '_' by '-' in machine property names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: marcel@redhat.com, Igor Mammedov , qemu-devel@nongnu.org, afaerber@suse.de Eduardo Habkost writes: > On Mon, Oct 17, 2016 at 01:00:29PM +0200, Markus Armbruster wrote: >> Eduardo Habkost writes: >> >> > On Thu, Oct 13, 2016 at 06:44:14PM +0200, Markus Armbruster wrote: >> >> machine_set_property() replaces '_' by '-' in the property name. >> >> Except it fails to replace an initial '_'. Screwed up in commit >> >> b0ddb8b. Reproducer: "-M pc,__foo_bar=true" produces "Property >> >> '._-foo-bar' not found". >> >> >> >> Error messages using a mangled name rather than the name the user >> >> actually wrote is user-hostile, but that's a different topic. >> >> >> >> Signed-off-by: Markus Armbruster >> > >> > Reviewed-by: Eduardo Habkost >> > >> > I suggest we follow the same approach we used in the x86 CPU >> > code: instead of requiring a special parser that magically >> > translate strings, just add property aliases for the old names >> > that contained "_". It would fix the user-hostile error messages >> > as well. >> >> Adding the aliases is slightly annoying, but it's probably the easiest >> way to get decent error messages. > > I started working on it, but then I noticed I had do check for > "_" in all TYPE_MACHINE subclasses and it would take more time > than I expected. Then I put it at the end of my queue and went > work on something else. > >> How can we ensure no new alias-requiring names get added? > > Being a style issue, maybe checkpatch.pl could detect some cases. > It's not different from the other QOM classes. Can we adopt the rule for all of QOM, and enforce it right when properties get added? Or at some other suitable time?