Skip to contentSkip to conversation

Is ASCII the expected udev character encoding?

DISCUSSION James Hunt 2 participants 2 messages Sep 30, 2011

lore
Share & tools
lore

James Hunt

author
#0 lore raw

Hi All,

Working on the Ubuntu bug below where a battery unit is exposing non-printable characters via udev made me wonder: is the expected character encoding for all udev messages ASCII? Or is the expectation that the kernel simply acts as a pass-through (such that it is the responsibility of userspace to determine the exact meaning of such messages)? If ASCII is expected, should this be made manifest somewhere?

https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/829980

I'm happy to provide a kernel patch for the bug above, but need to understand whether the kernel should be sanitizing udev message content, or leaving that up to userspace.

Kind regards,

James.

#1 lore raw
Quoted 10 lines · James Hunt

Working on the Ubuntu bug below where a battery unit is exposing non-printable characters via udev made me wonder: is the expected character encoding for all udev messages ASCII? Or is the expectation that the kernel simply acts as a pass-through (such that it is the responsibility of userspace to determine the exact meaning of such messages)? If ASCII is expected, should this be made manifest somewhere?

 https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/829980

I'm happy to provide a kernel patch for the bug above, but need to understand whether the kernel should be sanitizing udev message content, or leaving that up to userspace.

There are no rules really. Especially not about valid utf8 encoding, or printable chars only.

If you use D-Bus to transport udev properties as D-Bus strings, you need to make sure they are valid utf8, or use byte arrays instead of strings.

Kay