REGRESSION: volume labels have underscores instead of spaces

Bug #347370 reported by Alexander Jones
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Fix Released
Low
Martin Pitt
Nominated for Jaunty by Alexander Jones

Bug Description

Binary package hint: hal

In 8.10, my disks are labelled "Ubuntu Root" and "Macintosh HD" in Nautilus and HAL.

In 9.04, they are "Ubuntu_Root" and "Macintosh_HD". I have confirmed this directly in HAL.

GParted correctly shows the labels with spaces.

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 9.04
NonfreeKernelModules: nvidia
Package: hal 0.5.12~rc1+git20090204-0ubuntu3
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: hal
Uname: Linux 2.6.28-11-generic x86_64

Revision history for this message
Alexander Jones (alex-weej) wrote :
Revision history for this message
Steve Beattie (sbeattie) wrote :

Confirmed this is a behavior change between intrepid and jaunty:

ubuntu@jaunty-i386:~$ sudo tune2fs -l /dev/sda1 | grep -i "uuid\|name"
Filesystem volume name: My Boot
Filesystem UUID: 11bcff22-6f53-41c7-9ea9-6b71dcb195a8
ubuntu@jaunty-i386:~$ lshal -u volume_uuid_11bcff22_6f53_41c7_9ea9_6b71dcb195a8 | grep -i label
  volume.label = 'My_Boot' (string)

However, it's unclear to me whether this is an intended change or if it breaks anything (mounting by label works correctly)

Changed in hal:
assignee: nobody → ubuntu-foundations
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Robbie Williamson (robbiew) wrote :

Is this actually breaking anything?

Changed in hal:
status: Confirmed → Incomplete
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

No change to libvolume-id (and using jaunty libvolume-id with intrepid HAL produces same non-escaped result). Escaping must be happening inside HAL.

Changed in hal (Ubuntu):
assignee: ubuntu-foundations → pitti
status: Incomplete → Confirmed
Martin Pitt (pitti)
Changed in hal (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Note to self: the only relevant change in jaunty was

  http://cgit.freedesktop.org/hal/commit/?id=79b92dbdf65b8c978d5a8f6fb2b421aac83c3de3

I'll reproduce this here and track it down; I agree that it looks like hal, and it does not look like an intended change.

Changed in hal (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

The udev event looks like this:

UDEV [1238756110.231878] add /devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.2/1-8.2:1.0/host9/target9:0:0/9:0:0:0/block/sdf/sdf1 (block)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.2/1-8.2:1.0/host9/target9:0:0/9:0:0:0/block/sdf/sdf1
SUBSYSTEM=block
DEVTYPE=partition
SEQNUM=1909
ID_VENDOR=OTi
ID_VENDOR_ENC=OTi\x20\x20\x20\x20\x20
ID_MODEL=Flash_Disk
ID_MODEL_ENC=Flash\x20Disk\x20\x20\x20\x20\x20\x20
ID_REVISION=1.11
ID_SERIAL=OTi_Flash_Disk_F3018E93E8BADA0-0:0
ID_SERIAL_SHORT=F3018E93E8BADA0
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
ID_USB_INTERFACES=:080650:
ID_PATH=pci-0000:00:1d.7-usb-0:8.2:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=6E13-F868
ID_FS_UUID_ENC=6E13-F868
ID_FS_LABEL=Pitti_USB
ID_FS_LABEL_ENC=Pitti\x20USB
DEVNAME=/dev/sdf1
MAJOR=8
MINOR=81
DEVLINKS=/dev/block/8:81 /dev/disk/by-id/usb-OTi_Flash_Disk_F3018E93E8BADA0-0:0-part1 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:8.2:1.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/6E13-F868 /dev/disk/by-label/Pitti\x20USB

Currently, hal uses ID_FS_LABEL, which gets the '_' smuggled in. Should hal use ID_FS_LABEL_ENC instead and decode it somehow, or should udev not mangle ID_FS_LABEL?

Revision history for this message
Martin Pitt (pitti) wrote :

For the record, this happens in ./hald/linux/coldplug.c:

   udevdb to UdevInfo struct:

   hal_util_init_sysfs_to_udev_map():

       char *udevdb_export_argv[] = { "/sbin/udevadm", "info", "-e", NULL };
       [...]
         else if (strncmp(line, "E: ID_FS_LABEL=", 15) == 0) {
                info->fslabel = &line[15];

   and further on, conversion to HotplugEvent*:

   static HotplugEvent* udev_info_to_hotplug_event(const UdevInfo *info):

        if ((str = hal_util_strdup_valid_utf8(info->fslabel)) != NULL) {
                g_strlcpy (hotplug_event->sysfs.fslabel, str, sizeof(hotplug_event->sysfs.fslabel));
                g_free (str);
        }

Revision history for this message
Martin Pitt (pitti) wrote :

I could probably work around this in hal, but since DeviceKit-disks and probably other parts of the system use the udev database as well, this is IMHO better fixed in udev itself.

affects: hal (Ubuntu) → udev (Ubuntu)
Changed in hal (Ubuntu):
assignee: pitti → nobody
Changed in udev (Ubuntu):
status: In Progress → Triaged
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The udev information deliberately has character codes stripped, you can use the _ENC to get an encoded version of the unstripped, or if using libudev just request the attribute (which is completely unencoded and unescaped)

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Note also that udev has *ALWAYS* behaved this way - HAL simply changed the source of information, it previously got the unescaped/encoded labels

affects: udev (Ubuntu) → hal (Ubuntu)
Revision history for this message
Martin Pitt (pitti) wrote :
Changed in hal (Ubuntu):
assignee: nobody → pitti
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hal - 0.5.12~rc1+git20090403-0ubuntu1

---------------
hal (0.5.12~rc1+git20090403-0ubuntu1) jaunty; urgency=low

  * Update to current git HEAD to collect some more bug fixes:
    - Fix volume label parsing (directly committed upstream) (LP: #347370)
    - Regenerate FDI cache if it's zero sized
    - Fix handling of floppy and MO discs.
    - Fix various memory leaks and unused pointers.
    - Fix linking against libsmbios.
    - Allow specifying a udev dir in etc (Fedora still has udev rules dir in
      /etc)
  * debian/rules: Update --with-udev-prefix according to above upstream
    change.
  * Drop 86_smbios_configure_error.patch, applied upstream.

 -- Martin Pitt <email address hidden> Fri, 03 Apr 2009 17:10:56 +0200

Changed in hal (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.