Bug 254142 - gpart silently truncates the GPT label
Summary: gpart silently truncates the GPT label
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-geom (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-08 19:56 UTC by rashey
Modified: 2021-05-14 12:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rashey 2021-03-08 19:56:48 UTC
If a specified label is too long for the GPT scheme, gpart silently truncates it and does not return an error.

# freebsd-version
13.0-RC1
# gpart create -s GPT da1
da1 created
# gpart add -t freebsd-ufs -l 12345678901234567890123456789012345678901234567890 da1
da1p1 added
# echo $?
0
# gpart show -l da1
=>     40  8388528  da1  GPT  (4.0G)
       40  8388528    1  123456789012345678901234567890123456  (4.0G)
Comment 1 David Schlachter 2021-03-11 01:56:32 UTC
Partition names (labels) are limited to 36 characters in GPT. Wikipedia has a nice breakdown of the format of the partition entries where you can see this: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries_(LBA_2–33)

I tried your example, and inspecting the GPT partition table on-disk with a hex editor, e.g.

   doas cat /dev/da1 | xxd | less

I can see that the label is 123456789012345678901234567890123456, as displayed by gpart (first 36 characters of the label you had tried to assign).

The bug here would be that gpart doesn't complain about the label being too long in `gpart add`.