New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FS#1283 - block info returns additional charactes in FAT32 label name #5793
Comments
fleskalebas: The spaces in the label name are truncated above, in reality there are multiple spaces instead of just one. |
john: are you able to build your own image if i provide a test patch ? |
fleskalebas: Yes, no problem :) |
john: try this patch please |
fleskalebas: Thanks, end of this week I'm going to build a new image and report asap. |
fleskalebas: After applying the patch, no extra character appends in the LABEL name. However, when I name the disk with a label shorter than 11 characters, block info still pads the label name with spaces until the name is 11 characters long. A label with exactly 11 characters will work to avoid spaces. In the bug report I accidentally stated that the label name must be 12 characters. This is wrong, the max size of a fat32 label is 11 characters. However, the patch still works. |
jow-: Hm I guess that other implemenations right-trim the spaces from the label for convenience reasons. I do recall that FAT labels are sometimes displayed as For maximal compatibility we likely should trim both user provided and blkid provided fat labels before working with them. |
fleskalebas: The use case for me is mounting by LABEL name instead of device name (since sda might sometimes become sdb) To ensure that it works, I use a 11-character name to avoid errors because of the spaces, but maybe the mounting ignores the spaces too, then it's all fixed by the patch. |
mirko: As a follow up - the following patch truncates the filesystem label and replaces the first occurrence of a blank (0x20) with a \0-byte: |
fleskalebas:
On several devices (ar71xx, ipq806x, mvebu) and with several versions of LEDE (all since 17.01.0) and even OpenWRT versions, block info returns not only the label name but it seems that also some random character in memory is added to the label name.
Expected:
root@router:~# block info
/dev/sda1: UUID="91f1-f7ed" LABEL="DATA" VERSION="FAT32" TYPE="vfat"
Current result:
root@router:~# block info
/dev/sda1: UUID="91f1-f7ed" LABEL="DATA â-'" VERSION="FAT32" TYPE="vfat"
Above character is the ANSI equivalent of the UTF-8 character that is returned. Sometimes (on mvebu devices for example) I got the following results:
/dev/sda1: UUID="91f1-f7ed" LABEL="DATA 1" VERSION="FAT32" TYPE="vfat"
/dev/sda1: UUID="91f1-f7ed" LABEL="DATA A" VERSION="FAT32" TYPE="vfat"
/dev/sda1: UUID="91f1-f7ed" LABEL="DATA Z" VERSION="FAT32" TYPE="vfat"
Somehow block info adds spaces and the extra character (even when I label the disk with a 12-character label name).
The text was updated successfully, but these errors were encountered: