Your message dated Thu, 24 Dec 2009 10:17:10 +0000
with message-id <[email protected]>
and subject line Bug#559985: fixed in dosfstools 3.0.7-1
has caused the Debian Bug report #559985,
regarding dosfslabel does not set volume label in the right place
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
559985: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559985
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dosfstools
Version: 3.0.6-1
Severity: normal
Tags: patch
FAT filesystems can contain volume labels in 2 different places: a reserved
location in the boot sector, and a special directory entry in the root
directory. Here's what various libraries and commands do:
FreeDOS label: only gets/sets directory entry
libvolume_id (used by udev before v142):
gets directory entry if present, otherwise boot sector
libblkid (part of util-linux-ng; previously e2fsprogs; used by many commands):
gets directory entry if present, otherwise boot sector
mkdosfs -n: sets directory entry and boot sector
dosfslabel: only sets boot sector
dosfslabel is clearly the odd one out, not even consistent with mkdosfs from
the same package. It should look for a directory entry with the volume label
and update that if present, as well as updating the boot sector.
Demonstration:
1. $ dd bs=512 count=2880 </dev/zero >foo
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 0.0121247 s, 122 MB/s
2. $ /sbin/mkdosfs -n foo foo
mkdosfs 3.0.0 (28 Sep 2008)
3. $ /sbin/dosfslabel foo bar
4. $ /sbin/blkid foo
foo: SEC_TYPE="msdos" LABEL="foo" UUID="B63E-8D7A" TYPE="vfat"
# I would hope to see LABEL="bar"
I used the following changes on Fedora's v3.0.1 and they worked for me
on FAT12, FAT16 and FAT32 filesystems created using mkdosfs. They
appear to be applicable to the current Debian version.
Ben.
--- dosfstools-3.0.1.orig/src/boot.c
+++ dosfstools-3.0.1/src/boot.c
@@ -27,9 +27,11 @@
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
+#include <time.h>
#include "common.h"
#include "dosfsck.h"
+#include "fat.h"
#include "io.h"
#include "boot.h"
@@ -415,14 +416,10 @@
if (verbose) dump_boot(fs,&b,logical_sector_size);
}
-void write_label(DOS_FS *fs, char *label)
+static void write_boot_label(DOS_FS *fs, char *label)
{
struct boot_sector b;
struct boot_sector_16 *b16 = (struct boot_sector_16 *)&b;
- int l = strlen(label);
-
- while (l < 11)
- label[l++] = ' ';
fs_read(0, sizeof(b), &b);
if (fs->fat_bits == 12 || fs->fat_bits == 16) {
@@ -445,6 +442,68 @@
fs_write(fs->backupboot_start, sizeof(b), &b);
}
+static loff_t find_volume_de(DOS_FS *fs, DIR_ENT *de)
+{
+ unsigned long cluster;
+ loff_t offset;
+ int i;
+
+ if (fs->root_cluster) {
+ for (cluster = fs->root_cluster;
+ cluster != 0 && cluster != -1;
+ cluster = next_cluster(fs, cluster)) {
+ offset = cluster_start(fs, cluster);
+ for (i = 0; i * sizeof(DIR_ENT) < fs->cluster_size; i++) {
+ fs_read(offset, sizeof(DIR_ENT), de);
+ if (de->attr & ATTR_VOLUME)
+ return offset;
+ offset += sizeof(DIR_ENT);
+ }
+ }
+ } else {
+ for (i = 0; i < fs->root_entries; i++) {
+ offset = fs->root_start + i * sizeof(DIR_ENT);
+ fs_read(offset, sizeof(DIR_ENT), de);
+ if (de->attr & ATTR_VOLUME)
+ return offset;
+ }
+ }
+
+ return 0;
+}
+
+static void write_volume_label(DOS_FS *fs, char *label)
+{
+ time_t now = time(NULL);
+ struct tm *mtime = localtime(&now);
+ loff_t offset;
+ DIR_ENT de;
+
+ offset = find_volume_de(fs, &de);
+ if (offset == 0)
+ return;
+
+ memcpy(de.name, label, 11);
+ de.time = CT_LE_W((unsigned short)((mtime->tm_sec >> 1) +
+ (mtime->tm_min << 5) +
+ (mtime->tm_hour << 11)));
+ de.date = CT_LE_W((unsigned short)(mtime->tm_mday +
+ ((mtime->tm_mon+1) << 5) +
+ ((mtime->tm_year-80) << 9)));
+ fs_write(offset, sizeof(DIR_ENT), &de);
+}
+
+void write_label(DOS_FS *fs, char *label)
+{
+ int l = strlen(label);
+
+ while (l < 11)
+ label[l++] = ' ';
+
+ write_boot_label(fs, label);
+ write_volume_label(fs, label);
+}
+
/* Local Variables: */
/* tab-width: 8 */
/* End: */
--- END ---
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (x86_64)
Kernel: Linux 2.6.32-rc8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages dosfstools depends on:
ii libc6 2.10.2-2 GNU C Library: Shared libraries
dosfstools recommends no packages.
dosfstools suggests no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: dosfstools
Source-Version: 3.0.7-1
We believe that the bug you reported is fixed in the latest version of
dosfstools, which is due to be installed in the Debian FTP archive:
dosfstools-dbg_3.0.7-1_i386.deb
to main/d/dosfstools/dosfstools-dbg_3.0.7-1_i386.deb
dosfstools_3.0.7-1.diff.gz
to main/d/dosfstools/dosfstools_3.0.7-1.diff.gz
dosfstools_3.0.7-1.dsc
to main/d/dosfstools/dosfstools_3.0.7-1.dsc
dosfstools_3.0.7-1_i386.deb
to main/d/dosfstools/dosfstools_3.0.7-1_i386.deb
dosfstools_3.0.7.orig.tar.gz
to main/d/dosfstools/dosfstools_3.0.7.orig.tar.gz
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Daniel Baumann <[email protected]> (supplier of updated dosfstools package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Thu, 24 Dec 2009 10:57:15 +0100
Source: dosfstools
Binary: dosfstools dosfstools-dbg
Architecture: source i386
Version: 3.0.7-1
Distribution: unstable
Urgency: low
Maintainer: Daniel Baumann <[email protected]>
Changed-By: Daniel Baumann <[email protected]>
Description:
dosfstools - utilities for making and checking MS-DOS FAT filesystems
dosfstools-dbg - utilities for making and checking MS-DOS FAT filesystems
(debug)
Closes: 559985
Changes:
dosfstools (3.0.7-1) unstable; urgency=low
.
* Correcting wrong vcs-browser field.
* Adding explicit debian source version 1.0 until switch to 3.0.
* Merging upstream version 3.0.7:
- Fixes dosfslabel to set volume label in the right place (Closes:
#559985).
Checksums-Sha1:
5f9cf08d1e6798db81f6fcfee2aed79f49136512 1250 dosfstools_3.0.7-1.dsc
8eb0b2d73a5ff2430e38452589357287d6aa0605 78076 dosfstools_3.0.7.orig.tar.gz
c1a9813e16e0ac8f4efb1a2acdbe340fe18781cb 7850 dosfstools_3.0.7-1.diff.gz
86316d1cef6f737b7141b29b4f3bd1f57e35bbcb 87934 dosfstools_3.0.7-1_i386.deb
7fb03bbffda12541f356eef10fdb277e22a7af66 81814 dosfstools-dbg_3.0.7-1_i386.deb
Checksums-Sha256:
1e84dd21dfd99941eb8ce9dd597aac3b2be74a68aa13fd07879edc64a11c8364 1250
dosfstools_3.0.7-1.dsc
c3cadaf4015ce3957a9463fc970f40d9cbfd0980ed4d5d53c140565660393988 78076
dosfstools_3.0.7.orig.tar.gz
6833165fd4fdf9cedb5eeeb5ea3de59d897000f7c0b66c1b567a511229c9fc1c 7850
dosfstools_3.0.7-1.diff.gz
c08b63d34621eee00946dccc3de98cdcdc66c20c37375716473f000bff3a0b78 87934
dosfstools_3.0.7-1_i386.deb
20b319f11d33d4a6662252fef7d4b5547bd1ed47c8c648ad67155a83daff2cc6 81814
dosfstools-dbg_3.0.7-1_i386.deb
Files:
11781cdebc59faaf301855cb3cc4a121 1250 otherosfs optional dosfstools_3.0.7-1.dsc
5d4d97c79e8dae60bb08c2fba36c94d6 78076 otherosfs optional
dosfstools_3.0.7.orig.tar.gz
2515b63a048ab3a2bfce2e71584c697a 7850 otherosfs optional
dosfstools_3.0.7-1.diff.gz
40a2bbb663cd2276321e924e15cb6f81 87934 otherosfs optional
dosfstools_3.0.7-1_i386.deb
aab9b6fbe539a8c3863dd7c48be0dbd4 81814 debug extra
dosfstools-dbg_3.0.7-1_i386.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkszOywACgkQ+C5cwEsrK56tgQCgikcoifOf+2ToRSFpVhrX+Wpz
a+oAn23og36xZe+7oDo2ze7gzUI/qHpY
=iQxv
-----END PGP SIGNATURE-----
--- End Message ---