This bug does appear to be a problem with the dosfslabel command
not setting the volume label in two locations.

It is interesting to note that the mkdosfs command from the
dosfstools-3.0.5 package _does_ set the label in two locations.

Following is some more information regarding this bug that I
previously emailed to Daniel prior to learning of this bug
report:


NOTE: Significant extra editing has been performed on the below
email to help enhance the readability, and add more testing.

---------- email follows ----------

Hi Daniel,

Thank you for your efforts to enhance the dosfstools package.  It
is much appreciated to see some activity once again on this
important software.

Recently I discovered what appears to be a bug in the dosfslabel
command.

The dosfslabel command seems to change the label in one location
of the file system, but the label appears to be stored in at
least two locations.

This creates problems later when other commands are used to
reference the label, such as blkid or mlabel from the mtools
package.  These other commands can potentially see a different
label than is seen by dosfslabel.

Below is a list of commands and sample output that demonstrates
the dosfslabel problem.  My testing used dosfstools v3.0.5.

Please feel free to contact me if you need further details
regarding this problem.

Regards,
Curtis Gedak
(Maintainer of GParted)



# ----------
# Define device and three unique labels.
# NOTE:  A five character string was chosen so that it could be
#        easily found with the hexdump and grep commands.
#        Anything longer will overlap onto another line
#        of the hexdump output.  :)

$ dev=/dev/sdd
$ label1=AAAAA
$ label2=BBBBB
$ label3=CCCCC
$


# ----------
# Zero out initial part of device to ensure
#   that none of the above strings appear on
#   the partition to be created next.

$ dd if=/dev/zero of=$dev bs=512 count=17000
17000+0 records in
17000+0 records out
8704000 bytes (8.7 MB) copied, 0.687667 s, 12.7 MB/s
$


# ----------
# Create a partition and display the resulting partition.

$ parted -s $dev mklabel msdos
$ parted -s $dev mkpart primary 63s 17000s
$ parted -s $dev u s p
Model: ATA ST3160022ACE (scsi)
Disk /dev/sdd: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
1      63s    17000s  16938s  primary

$


# ----------
# Confirm that none of the above chosen volume labels
#   exist in the partition.

$ hexdump -C ${dev}1 | egrep "($label1|$label2|$label3)"
$


# ----------
# Create FAT16 file system with the first label.

$ mkdosfs -F16 -v -n $label1 ${dev}1
mkdosfs 3.0.5 (27 Jul 2009)
/dev/sdd1 has 255 heads and 63 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 16938 sectors;
file system has 2 16-bit FATs and 4 sectors per cluster.
FAT size is 17 sectors, and provides 4217 clusters.
Root directory contains 512 slots.
Volume ID is dff52bc8, volume label AAAAA      .
$


# ----------
# Find the labels within the partition.
# NOTE:  The first label is found in two locations.
#        The mkdosfs command from dosfstools creates the
#        volume label in two locations.

$ hexdump -C ${dev}1 | egrep "($label1|$label2|$label3)"
00000020 00 00 00 00 00 00 29 92 c7 c8 4a 41 41 41 41 41 |......)...JAAAAA| 00004600 41 41 41 41 41 20 20 20 20 20 20 08 00 00 91 50 |AAAAA ....P|
$


# ----------
# Display the label with dosfslabel, blkid, and mlabel.

$ dosfslabel ${dev}1
AAAAA $ blkid -c /dev/null ${dev}1
/dev/sdd1: SEC_TYPE="msdos" LABEL="AAAAA" UUID="4AC8-C792" TYPE="vfat"
$

# NOTE: Mtools requires a configuration file be setup first.
#       For this file we will use 'H' as the drive letter.

$ export MTOOLSRC=/tmp/MyTempFile
$ echo "drive H: file=\"${dev}1\"" > $MTOOLSRC
$ echo "mtools_skip_check=1"      >> $MTOOLSRC
$ mlabel -s H:
Volume label is AAAAA $


# ----------
# Change the label with dosfslabel.

$ dosfslabel ${dev}1 $label2


# ----------
# Display the label with dosfslabel, blkid, and mlabel.
# NOTE:  Only dosfslabel will show the new (second) label.
#        Both blkid and mlabel will show the old (first) label.

$ dosfslabel ${dev}1
BBBBB $ blkid -c /dev/null ${dev}1
/dev/sdd1: SEC_TYPE="msdos" LABEL="AAAAA" UUID="4AC8-C792" TYPE="vfat"
$ mlabel -s H:
Volume label is AAAAA $


# ----------
# Find the labels within the partition.
# NOTE:  The new (second) label is only found in one location.
#        The old (first) label is still found in one location.

$ hexdump -C ${dev}1 | egrep "($label1|$label2|$label3)"
00000020 00 00 00 00 00 00 29 92 c7 c8 4a 42 42 42 42 42 |......)...JBBBBB| 00004600 41 41 41 41 41 20 20 20 20 20 20 08 00 00 91 50 |AAAAA ....P|
$

# ----------
# Change the label with mlabel.
# NOTE:  There is no space between the drive letter
#        and the label.

$ mlabel H:"$label3"

# ----------
# Display the label with dosfslabel, blkid, and mlabel.
# NOTE:  All three commands display this new (third) label.

$ dosfslabel ${dev}1
CCCCC $ blkid -c /dev/null $dev{1}
/dev/sdd1: SEC_TYPE="msdos" LABEL="CCCCC" UUID="4AC8-C792" TYPE="vfat"
$ mlabel -s H:
Volume label is CCCCC $


# ----------
# Find the labels within the partition.
# NOTE:  The label has been changed in both locations

$ hexdump -C ${dev}1 | egrep "($label1|$label2|$label3)"
00000020 00 00 00 00 00 00 29 c8 2b f5 df 43 43 43 43 43 |......).+..CCCCC| 00004600 43 43 43 43 43 20 20 20 20 20 20 08 00 00 39 55 |CCCCC ...9U|
$


# ----------
# From this analysis I have observed the following:
#
# 1)  mkdosfs creates the volume label in two locations.
# 2)  mlabel changes the label in both of these locations.
# 3)  dosfslabel only changes the label in one of the locations.
#
# My conclusion is that I believe the dosfslabel command should
#   change the volume label in both locations to be consistent
#   with other tools, such as mkdosfs which is part of the
#   same dosfstools package.




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to