You are not logged in.

#1 2015-05-19 14:46:51

cyker
Member
Registered: 2009-05-30
Posts: 86

[SOLVED] udev: ID_FS_LABEL vs ID_FS_LABEL_ENC

Just a simple question:

What is the difference between ID_FS_LABEL and ID_FS_LABEL_ENC in udev rules?

They are both environment variables and usually appear the same in

udevadm info

Thanks.

Last edited by cyker (2015-05-19 20:53:20)


.

Offline

#2 2015-05-19 17:59:17

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] udev: ID_FS_LABEL vs ID_FS_LABEL_ENC

They are both variables containg the label of a filesystem and are defined by udev (see udev-builtin-blkid.c) using the functions blkid_encode_string and  blkid_safe_string, which are provided by libblkid. Basically ID_FS_LABEL contains plain ascii, with hex-escaped and any valid utf8 characters but all whitespaces are replaced with '_' , while in ID_FS_LABEL_ENC all potentially unsafe characters are replaced by the corresponding hex value prefixed by '\x'.

For example if the file system label is "Simple Label", then the two variables will be

ID_FS_LABEL=Simple_Label
ID_FS_LABEL_ENC=Simple\x20Label

In older versions of udev, ID_FS_LABEL actually contained the unmodified label of the filsystem and a third variable (ID_FS_LABEL_SAFE) was used for the "safe" lable

Last edited by mauritiusdadd (2015-05-19 18:41:45)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

Board footer

Powered by FluxBB