On Tue, 14 Nov 2023 at 13:05, Thomas Huth <th...@redhat.com> wrote:
>
> QOM names currently don't have any enforced naming rules. This
> can be problematic, e.g. when they are used on the command line
> for the "-device" option (where the comma is used to separate
> properties). To avoid that such problematic type names come in
> again, let's restrict the set of acceptable characters during the
> type registration.
>
> Ideally, we'd apply here the same rules as for QAPI, i.e. all type
> names should begin with a letter, and contain only ASCII letters,
> digits, hyphen, and underscore. However, we already have so many
> pre-existing types like:
>
>     486-x86_64-cpu
>     cfi.pflash01
>     power5+_v2.1-spapr-cpu-core
>     virt-2.6-machine::hotplug-handler
>     aspeed.i2c.slave::vmstate-if
>     pc-i440fx-3.0-machine::nmi

I think all these '::' are specifically interface types --
see type_initialize_interface(), which constructs the
interface type name by gluing together the class name and
the interface name with a '::'. The rule we ought to be
requiring for ':' I think is "no : in the type name, unless
it is the one generated by type_initialize_interface()".

I think we could do that by having the type_name_is_valid()
checks done in:
 * type_initialize_interface(), on ti->name and interface_type->name
 * type_register_internal(), on info->name

If we do that, can we take ':' out of the list of characters
we permit in type_name_is_valid() ?

thanks
-- PMM

Reply via email to