From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc9Ai-0008EI-5p for qemu-devel@nongnu.org; Sun, 29 Mar 2015 05:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yc9Ad-00011o-6g for qemu-devel@nongnu.org; Sun, 29 Mar 2015 05:06:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc9Ad-00011k-1R for qemu-devel@nongnu.org; Sun, 29 Mar 2015 05:06:15 -0400 From: Markus Armbruster References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-22-git-send-email-eblake@redhat.com> Date: Sun, 29 Mar 2015 11:06:12 +0200 In-Reply-To: <1427227433-5030-22-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 24 Mar 2015 14:03:46 -0600") Message-ID: <874mp45g1n.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com Eric Blake writes: [...] > +valid_characters = set(string.ascii_letters + string.digits + '.' + '-' + '_') > +def check_name(expr_info, source, name, allow_optional = False): > + membername = name > + > + if not isinstance(name, str): > + raise QAPIExprError(expr_info, > + "%s requires a string name" % source) > + if name == '**': > + return > + if name.startswith('*'): > + membername = name[1:] > + if not allow_optional: > + raise QAPIExprError(expr_info, > + "%s does not allow optional name '%s'" > + % (source, name)) > + if not set(membername) <= valid_characters: > + raise QAPIExprError(expr_info, > + "%s uses invalid name '%s'" % (source, name)) > + This accepts names starting with a digit. Sure we generate valid C identifiers for such beauties? qapi-code-gen.txt: Downstream vendors may add extensions; such extensions should begin with a prefix matching "__RFQDN_" (for the reverse-fully-qualified- domain-name of the vendor), even if the rest of the command or field name uses dash (example: __com.redhat_drive-mirror). Other than the dots used in RFQDN of a downstream extension, all command, type, and field names should begin with a letter, and contain only ASCII letters, numbers, dash, and underscore. One, I think "all command, type, and field names" is too narrow, what about event names, or enumeration value names? Suggest say just "all names". Two, "letters, digits, dash, and underscore", please. Three, I think check_name() should enforce "starts with letter or '_'". [...]