RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1164729 - set-label can only set <=63 bytes for btrfs and ntfs filesystem which not meet the help message. Also for btrfs and ntfs it should give a warning message when the length exceed the limited length
Summary: set-label can only set <=63 bytes for btrfs and ntfs filesystem which not mee...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.6
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1301844
TreeView+ depends on / blocked
 
Reported: 2014-11-17 09:11 UTC by Lingfei Kong
Modified: 2016-05-10 19:55 UTC (History)
7 users (show)

Fixed In Version: libguestfs-1.20.11-16.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-10 19:55:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1164708 0 low CLOSED set-label can only set <=127 bytes for btrfs and <=126 bytes for ntfs filesystem which not meet the help message. Also f... 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2016:0762 0 normal SHIPPED_LIVE libguestfs bug fix update 2016-05-10 22:33:40 UTC

Internal Links: 1164708

Description Lingfei Kong 2014-11-17 09:11:50 UTC
Description of problem:
For btrfs:
I can confirm that the label length for btrfs is less than 256 bytes both in libguestfs and linux system. Check 'help set-label' in guestfish and 'man mkfs.btrfs' in linux system. When i try to set a label who's length is 180 bytes, i can set the label successfully, but when i get the new label via 'vfs-label' i only got 63 bytes. Also it should give a warning message when the length > 255 bytes. 

In 'help set-label' i can obtain that i can set 256 bytes for btrfs, obviously this is wrong, for btrfs the max bytes is 255:
><fs> help set-label
[...]
   btrfs
        The label is limited to 256 bytes and some characters are not
        allowed. Setting the label on a btrfs subvolume will set the label
        on its parent filesystem. The filesystem must not be mounted when
        trying to set the label.


For ntfs:
set-label for ntfs can only set <=63 bytes which is less than 128 bytes according to 'help set-label', also it should give a warning message when the length > 128 bytes. 

Version-Release number of selected component (if applicable):
libguestfs-1.20.11-11.el6


How reproducible:
100%


Steps to Reproduce:
1. # str="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d"
   # echo ${#str}
180

2. #guestfish -N fs:btrfs
><fs> set-label  /dev/sda1 2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d
><fs> vfs-label /dev/sda1
2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955

# str2="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955"
# echo ${#str2}
63

3. Check 'help set-label' in guestfish

4. # str="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d"
   # echo ${#str}
180

5. #guestfish -N fs:ntfs
><fs> set-label  /dev/sda1 2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d
><fs> vfs-label /dev/sda1
2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955

# str2="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955"
# echo ${#str2}
126

6. Check 'help set-label' in guestfish


Actual results:
At step 2, only get the first 127 bytes of the label name
At step 3, the limited number is 256 which is wrong
At step 5, only get the first 126 bytes of the label name


Expected results:
At step 2, i can get the right label name(180 bytes) when i run 'vfs-label /dev/sda1'
At step 3, the limited number should be 255
At step 5, can get the first 128 bytes of the label name when i run 'vfs-label /dev/sda1'

Additional info:

Comment 1 Richard W.M. Jones 2014-11-17 10:04:44 UTC
See my script and analysis starting here:
https://bugzilla.redhat.com/show_bug.cgi?id=1164708#c1

Comment 5 Xianghua Chen 2015-12-07 05:08:05 UTC
Verified with the packages:
libguestfs-1.20.11-16.el6.x86_64
libguestfs-winsupport-1.0-7.el6.x86_64


Verify steps:
1. # str="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d"
# echo ${#str}
180

2. # guestfish -N fs:btrfs
><fs>  set-label  /dev/sda1 2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d
><fs>  vfs-label /dev/sda1
2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d
><fs> quit

Can get the right label name(180 bytes)

3. # str="2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d"
   # echo ${#str}
180

4. guestfish -N fs:ntfs
><fs> help set-label

You can find the following info is correct:
btrfs
        The label is limited to 255 bytes

><fs> set-label  /dev/sda1 2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d
><fs>  vfs-label /dev/sda1
2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-816c-955bf2c0b43d2c395734-c68b-4181-8
><fs> quit

Can get the first 128 bytes of the label name.


So verified.

Comment 7 errata-xmlrpc 2016-05-10 19:55:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0762.html


Note You need to log in before you can comment on or make changes to this bug.