- update to 3.0.16: label fixes

* dropped upstreamed
    - dosfstools-create-rootdir-label.patch
    - dosfstools-dosfslabel-forbid-lowercase.patch
    - dosfstools-dosfslabel-from-rootdir.patch
    - dosfstools-fsck-file-name.patch
    - dosfstools-mkdosfs-no-label.patch
    - dosfstools-mkdosfs-uppercase-label.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/dosfstools?expand=0&rev=33
This commit is contained in:
Petr Gajdos 2013-03-04 07:18:27 +00:00 committed by Git OBS Bridge
parent 10c640b2d2
commit 7aad6adc66
10 changed files with 16 additions and 259 deletions

View File

@ -1,53 +0,0 @@
Create rootdir entry volume label with mkdosfs, create it when
it doesn't exist with dosfslabel.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Index: dosfstools-3.0.15/src/boot.c
===================================================================
--- dosfstools-3.0.15.orig/src/boot.c
+++ dosfstools-3.0.15/src/boot.c
@@ -35,6 +35,7 @@
#include "fat.h"
#include "io.h"
#include "boot.h"
+#include "check.h"
#define ROUND_TO_MULTIPLE(n,m) ((n) && (m) ? (n)+(m)-1-((n)-1)%(m) : 0)
/* don't divide by zero */
@@ -532,12 +533,16 @@ static void write_volume_label(DOS_FS *
time_t now = time(NULL);
struct tm *mtime = localtime(&now);
loff_t offset;
+ int created;
DIR_ENT de;
+ created = 0;
offset = find_volume_de(fs, &de);
if (offset == 0)
- return;
-
+ {
+ created = 1;
+ offset = alloc_rootdir_entry(fs, &de, label);
+ }
memcpy(de.name, label, 11);
de.time = CT_LE_W((unsigned short)((mtime->tm_sec >> 1) +
(mtime->tm_min << 5) +
@@ -545,6 +550,18 @@ static void write_volume_label(DOS_FS *
de.date = CT_LE_W((unsigned short)(mtime->tm_mday +
((mtime->tm_mon + 1) << 5) +
((mtime->tm_year - 80) << 9)));
+ if (created)
+ {
+ de.attr = ATTR_VOLUME;
+ de.ctime_ms = 0;
+ de.ctime = de.time;
+ de.cdate = de.date;
+ de.adate = de.date;
+ de.starthi = CT_LE_W(0);
+ de.start = CT_LE_W(0);
+ de.size = CT_LE_L(0);
+ }
+
fs_write(offset, sizeof(DIR_ENT), &de);
}

View File

@ -1,38 +0,0 @@
Forbid lowercase letters in label.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
http://support.microsoft.com/kb/71715/en-us
Index: dosfstools-3.0.15/src/dosfslabel.c
===================================================================
--- dosfstools-3.0.15.orig/src/dosfslabel.c
+++ dosfstools-3.0.15/src/dosfslabel.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
+#include <ctype.h>
#include "common.h"
#include "dosfsck.h"
@@ -86,6 +87,8 @@ int main(int argc, char *argv[])
DOS_FS fs = {0};
rw = 0;
+ int i;
+
char *device = NULL;
char *label = NULL;
@@ -109,6 +112,13 @@ int main(int argc, char *argv[])
"dosfslabel: labels can be no longer than 11 characters\n");
exit(1);
}
+ for (i = 0; i < 11; i++)
+ /* don't know if here should be more strict !uppercase(label[i])*/
+ if (islower(label[i])) {
+ fprintf(stderr,
+ "dosfslabel: labels cannot contain lower case characters\n");
+ exit(1);
+ }
rw = 1;
}

View File

@ -1,54 +0,0 @@
Read label also from rootdir entry.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Index: dosfstools-3.0.15/src/boot.c
===================================================================
--- dosfstools-3.0.15.orig/src/boot.c
+++ dosfstools-3.0.15/src/boot.c
@@ -498,7 +498,7 @@ static void write_boot_label(DOS_FS * fs
fs_write(fs->backupboot_start, sizeof(b), &b);
}
-static loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
+loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
{
unsigned long cluster;
loff_t offset;
Index: dosfstools-3.0.15/src/boot.h
===================================================================
--- dosfstools-3.0.15.orig/src/boot.h
+++ dosfstools-3.0.15/src/boot.h
@@ -25,6 +25,7 @@
void read_boot(DOS_FS * fs);
void write_label(DOS_FS * fs, char *label);
+loff_t find_volume_de(DOS_FS *fs, DIR_ENT *de);
/* Reads the boot sector from the currently open device and initializes *FS */
Index: dosfstools-3.0.15/src/dosfslabel.c
===================================================================
--- dosfstools-3.0.15.orig/src/dosfslabel.c
+++ dosfstools-3.0.15/src/dosfslabel.c
@@ -92,6 +92,9 @@ int main(int argc, char *argv[])
char *device = NULL;
char *label = NULL;
+ loff_t offset;
+ DIR_ENT de;
+
check_atari();
if (argc < 2 || argc > 3)
@@ -127,7 +130,11 @@ int main(int argc, char *argv[])
if (fs.fat_bits == 32)
read_fat(&fs);
if (!rw) {
- fprintf(stdout, "%s\n", fs.label);
+ offset = find_volume_de(&fs, &de);
+ if (offset == 0)
+ fprintf(stdout, "%s\n", fs.label);
+ else
+ fprintf(stdout, "%.8s%.3s\n", de.name, de.ext);
exit(0);
}

View File

@ -1,18 +0,0 @@
alloc_rootdir_entry() is intended to be called with
pattern == "FSCK%04dREC", the old code (probably c&p from auto_rename())
doesn't reflect this
Index: dosfstools-3.0.15/src/check.c
===================================================================
--- dosfstools-3.0.15.orig/src/check.c
+++ dosfstools-3.0.15/src/check.c
@@ -132,8 +132,8 @@ loff_t alloc_rootdir_entry(DOS_FS * fs,
while (1) {
char expanded[12];
sprintf(expanded, pattern, curr_num);
- memcpy(de->name + 4, expanded, 4);
- memcpy(de->ext, expanded + 4, 3);
+ memcpy(de->name, expanded, 8);
+ memcpy(de->ext, expanded + 8, 3);
clu_num = fs->root_cluster;
i = 0;
offset2 = cluster_start(fs, clu_num);

View File

@ -1,44 +0,0 @@
Instead of eleven blanks, fill in "NO NAME " as specification tells,
see e. g.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
http://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html
Index: dosfstools-3.0.15/src/mkdosfs.c
===================================================================
--- dosfstools-3.0.15.orig/src/mkdosfs.c
+++ dosfstools-3.0.15/src/mkdosfs.c
@@ -106,6 +106,8 @@
#define HARD_SECTOR_SIZE 512
#define SECTORS_PER_BLOCK ( BLOCK_SIZE / HARD_SECTOR_SIZE )
+#define NO_NAME "NO NAME "
+
/* Macro definitions */
/* Report a failure message and return a failure error code */
@@ -279,7 +281,7 @@ static int verbose = 0; /* Default to v
static long volume_id; /* Volume ID number */
static time_t create_time; /* Creation time */
static struct timeval create_timeval; /* Creation time */
-static char volume_name[] = " "; /* Volume name */
+static char volume_name[] = NO_NAME; /* Volume name */
static unsigned long long blocks; /* Number of blocks in filesystem */
static int sector_size = 512; /* Size of a logical sector */
static int sector_size_set = 0; /* User selected sector size */
@@ -1199,7 +1201,7 @@ static void setup_tables(void)
}
printf("Volume ID is %08lx, ", volume_id &
(atari_format ? 0x00ffffff : 0xffffffff));
- if (strcmp(volume_name, " "))
+ if (strcmp(volume_name, NO_NAME))
printf("volume label %s.\n", volume_name);
else
printf("no volume label.\n");
@@ -1238,7 +1240,7 @@ static void setup_tables(void)
}
memset(root_dir, 0, size_root_dir);
- if (memcmp(volume_name, " ", 11)) {
+ if (memcmp(volume_name, NO_NAME, 11)) {
struct msdos_dir_entry *de = &root_dir[0];
memcpy(de->name, volume_name, 8);
memcpy(de->ext, volume_name + 8, 3);

View File

@ -1,25 +0,0 @@
Write uppercase letters in label.
https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
http://support.microsoft.com/kb/71715/en-us
Index: dosfstools-3.0.15/src/mkdosfs.c
===================================================================
--- dosfstools-3.0.15.orig/src/mkdosfs.c
+++ dosfstools-3.0.15/src/mkdosfs.c
@@ -63,6 +63,7 @@
#include <unistd.h>
#include <time.h>
#include <errno.h>
+#include <ctype.h>
#include <asm/types.h>
@@ -1564,6 +1565,9 @@ int main(int argc, char **argv)
case 'n': /* n : Volume name */
sprintf(volume_name, "%-11.11s", optarg);
+ for (i = 0; i < 11; i++)
+ volume_name[i] = toupper(volume_name[i]);
+
break;
case 'r': /* r : Root directory entries */

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Mar 4 07:16:53 UTC 2013 - pgajdos@suse.com
- update to 3.0.16: label fixes
* dropped upstreamed
- dosfstools-create-rootdir-label.patch
- dosfstools-dosfslabel-forbid-lowercase.patch
- dosfstools-dosfslabel-from-rootdir.patch
- dosfstools-fsck-file-name.patch
- dosfstools-mkdosfs-no-label.patch
- dosfstools-mkdosfs-uppercase-label.patch
-------------------------------------------------------------------
Mon Feb 25 07:01:42 UTC 2013 - pgajdos@suse.com

View File

@ -22,28 +22,11 @@ Provides: mkdosfs
Summary: Utilities for Making and Checking MS-DOS FAT File Systems on Linux
License: GPL-3.0+
Group: System/Filesystems
Version: 3.0.15
Version: 3.0.16
Release: 0
Url: http://freshmeat.net/projects/dosfstools
Source: %{name}_%{version}.orig.tar.xz
Patch0: %{name}-suse-dirs.patch
# to be upstreamed: dosfsck: fix file name to be really FSCK%04d.REC
Patch1: %{name}-fsck-file-name.patch
# to be upstreamed: mkdosfs: empty label should be "NO NAME ", not " "
# https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Patch2: %{name}-mkdosfs-no-label.patch
# to be upstreamed: mkdosfs: label should be uppercase
# https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Patch3: %{name}-mkdosfs-uppercase-label.patch
# to be upstreamed: dosfslabel: label should not contain lowercase characters
# https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Patch4: %{name}-dosfslabel-forbid-lowercase.patch
# to be upstreamed: dosfslabel, mkdosfs: create rootdir entry if not exist
# https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Patch5: %{name}-create-rootdir-label.patch
# to be upstreamed: dosfslabel: read label also from rootdir entry
# https://bugzilla.novell.com/show_bug.cgi?id=657011#c4
Patch6: %{name}-dosfslabel-from-rootdir.patch
# workaround for
# https://bugs.launchpad.net/ubuntu/+source/dosfstools/+bug/746262
Patch100: ppc-reserved-sectors-fix.patch
@ -58,12 +41,6 @@ drives or on floppies.
%prep
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch100 -p1
%build

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bbbeabd630f20c9d10592b2cc974926b15e8e010e29d49f308d5464528e2dfc1
size 71716

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:450b422d89a305bcca76b1af076c51944a5cc0f1707727ee8ef64e969dd4e956
size 72424