Update list of prohibited fat label characters (#787202)
Add double quote (") to the list of prohibited FAT label characters,
previously missed [1][2].
Also add single quote (') because mlabel encoded it in a way that both
Windows and blkid don't understand, although mlabel can correctly decode
it itself.
# export MTOOLS_SKIP_CHECK=1
# mlabel ::"MIKE'S" -i /dev/sdf1
# mlabel -s :: -i /dev/sdf1
Volume label is MIKE'S (abbr=MIKE_S~1???)
# blkid -o value -s LABEL /dev/sdf1
MIKE_S~1???
(8-bit characters in the above output have been replaced with
question marks (?) just to keep this commit message as 7-bit ASCII).
Finally exclude ASCII control characters below SPACE (0x00 to 0x1F) as
they also cause mlabel to ask a question and wait for input in the same
way that prohibited characters do. As discussed in the previous commit
[1] the only way to stop GParted waiting forever is to manually kill
mlabel with signal 9 (KILL).
# mlabel ::"^A" -i /dev/sdf1
Long file name "^A" contains illegal character(s).
a)utorename A)utorename-all r)ename R)ename-all
s)kip S)kip-all q)uit (aArRsSq):
[1] 584137b32b
Remove prohibited characters from FAT16/32 labels (#755608)
[2] Microsoft TechNet: Label
https://technet.microsoft.com/en-us/library/bb490925.aspx
Bug 787202 - Update list of prohibited fat label characters
This commit is contained in:
parent
da71a30ef2
commit
c3ad49d9da
10
src/fat16.cc
10
src/fat16.cc
|
@ -265,9 +265,15 @@ const Glib::ustring fat16::sanitize_label( const Glib::ustring &label ) const
|
|||
// https://technet.microsoft.com/en-us/library/bb490925.aspx
|
||||
// [2] Replicated in Wikikedia: label (command)
|
||||
// https://en.wikipedia.org/wiki/Label_%28command%29
|
||||
Glib::ustring prohibited_chars( "*?.,;:/\\|+=<>[]" );
|
||||
// Also exclude:
|
||||
// * Single quote (') because it is encoded by mlabel but not understood by
|
||||
// Windows;
|
||||
// * ASCII control characters below SPACE because mlabel requests input in the
|
||||
// same way it does for prohibited characters causing GParted to wait forever.
|
||||
Glib::ustring prohibited_chars( "*?.,;:/\\|+=<>[]\"'" );
|
||||
for ( unsigned int i = 0 ; i < uppercase_label.size() ; i ++ )
|
||||
if ( prohibited_chars.find( uppercase_label[i] ) == Glib::ustring::npos )
|
||||
if ( prohibited_chars.find( uppercase_label[i] ) == Glib::ustring::npos &&
|
||||
uppercase_label[i] >= ' ' )
|
||||
new_label.push_back( uppercase_label[i] );
|
||||
|
||||
// Pad with spaces to prevent mlabel writing corrupted labels. See bug #700228.
|
||||
|
|
Loading…
Reference in New Issue