From b476038bc29e37b1bf6e42844d24b019b612421700cb4ff54bd3e472ef316d4e Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Wed, 27 Feb 2013 14:39:12 +0000 Subject: [PATCH 1/3] - update to 3.0.15: bugfixes for device detection, root directory allocation, and messages about unicode filenames. * dropped dosfstools-filename-buffer-overflow.patch (upstreamed) * dropped dosfstools-mdraid-partition.patch (upstreamed) * refreshed dosfstools-suse-dirs.patch * refreshed ppc-reserved-sectors-fix.patch (will be dropped if not upstreamed) * dosfstools-label.patch splitted to: - 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 (will be upstreamed or dropped) OBS-URL: https://build.opensuse.org/package/show/Base:System/dosfstools?expand=0&rev=31 --- dosfstools-create-rootdir-label.patch | 53 ++++++ dosfstools-dosfslabel-forbid-lowercase.patch | 38 ++++ dosfstools-dosfslabel-from-rootdir.patch | 54 ++++++ dosfstools-filename-buffer-overflow.patch | 16 -- dosfstools-fsck-file-name.patch | 18 ++ dosfstools-label.patch | 189 ------------------- dosfstools-mdraid-partition.patch | 20 -- dosfstools-mkdosfs-no-label.patch | 44 +++++ dosfstools-mkdosfs-uppercase-label.patch | 25 +++ dosfstools-suse-dirs.patch | 10 +- dosfstools.changes | 19 ++ dosfstools.spec | 34 +++- dosfstools_3.0.10.orig.tar.bz2 | 3 - dosfstools_3.0.15.orig.tar.xz | 3 + ppc-reserved-sectors-fix.patch | 20 +- 15 files changed, 295 insertions(+), 251 deletions(-) create mode 100644 dosfstools-create-rootdir-label.patch create mode 100644 dosfstools-dosfslabel-forbid-lowercase.patch create mode 100644 dosfstools-dosfslabel-from-rootdir.patch delete mode 100644 dosfstools-filename-buffer-overflow.patch create mode 100644 dosfstools-fsck-file-name.patch delete mode 100644 dosfstools-label.patch delete mode 100644 dosfstools-mdraid-partition.patch create mode 100644 dosfstools-mkdosfs-no-label.patch create mode 100644 dosfstools-mkdosfs-uppercase-label.patch delete mode 100644 dosfstools_3.0.10.orig.tar.bz2 create mode 100644 dosfstools_3.0.15.orig.tar.xz diff --git a/dosfstools-create-rootdir-label.patch b/dosfstools-create-rootdir-label.patch new file mode 100644 index 0000000..b392317 --- /dev/null +++ b/dosfstools-create-rootdir-label.patch @@ -0,0 +1,53 @@ +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); + } + diff --git a/dosfstools-dosfslabel-forbid-lowercase.patch b/dosfstools-dosfslabel-forbid-lowercase.patch new file mode 100644 index 0000000..4f839d5 --- /dev/null +++ b/dosfstools-dosfslabel-forbid-lowercase.patch @@ -0,0 +1,38 @@ +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 + #include + #include ++#include + + #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; + } + diff --git a/dosfstools-dosfslabel-from-rootdir.patch b/dosfstools-dosfslabel-from-rootdir.patch new file mode 100644 index 0000000..a0bf9c2 --- /dev/null +++ b/dosfstools-dosfslabel-from-rootdir.patch @@ -0,0 +1,54 @@ +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); + } + diff --git a/dosfstools-filename-buffer-overflow.patch b/dosfstools-filename-buffer-overflow.patch deleted file mode 100644 index 85d83b5..0000000 --- a/dosfstools-filename-buffer-overflow.patch +++ /dev/null @@ -1,16 +0,0 @@ -Index: dosfstools-3.0.10/src/check.c -=================================================================== ---- dosfstools-3.0.10.orig/src/check.c -+++ dosfstools-3.0.10/src/check.c -@@ -174,7 +174,10 @@ loff_t alloc_rootdir_entry(DOS_FS *fs, D - offset = fs->root_start+next_free*sizeof(DIR_ENT); - memset(de,0,sizeof(DIR_ENT)); - while (1) { -- sprintf(de->name,pattern,curr_num); -+ char expanded[12]; -+ sprintf(expanded, pattern, curr_num); -+ memcpy(de->name, expanded, 8); -+ memcpy(de->ext, expanded+8, 3); - for (scan = 0; scan < fs->root_entries; scan++) - if (scan != next_free && - !strncmp(root[scan].name,de->name,MSDOS_NAME)) diff --git a/dosfstools-fsck-file-name.patch b/dosfstools-fsck-file-name.patch new file mode 100644 index 0000000..783b15d --- /dev/null +++ b/dosfstools-fsck-file-name.patch @@ -0,0 +1,18 @@ +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); diff --git a/dosfstools-label.patch b/dosfstools-label.patch deleted file mode 100644 index e2fc64d..0000000 --- a/dosfstools-label.patch +++ /dev/null @@ -1,189 +0,0 @@ -Index: dosfstools-3.0.10/src/dosfslabel.c -=================================================================== ---- dosfstools-3.0.10.orig/src/dosfslabel.c -+++ dosfstools-3.0.10/src/dosfslabel.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - - #include "common.h" - #include "dosfsck.h" -@@ -89,7 +90,14 @@ int main(int argc, char *argv[]) - rw = 0; - - char *device = NULL; -- char *label = NULL; -+ char label[11]; -+ -+ int i; -+ -+ loff_t offset; -+ DIR_ENT de; -+ -+ memset(&fs, 0, sizeof(fs)); - - check_atari(); - -@@ -105,19 +113,31 @@ int main(int argc, char *argv[]) - - device = argv[1]; - if (argc == 3) { -- label = argv[2]; -- if (strlen(label) > 11) { -+ if (strlen(argv[2]) > 11) { - fprintf(stderr, - "dosfslabel: labels can be no longer than 11 characters\n"); - exit(1); - } -+ strncpy(label, argv[2], 11); -+ for (i = 0; i < 11; i++) -+ if (islower(label[i])) -+ { -+ fprintf(stderr, -+ "dosfslabel: labels cannot contain lower case characters\n"); -+ exit(1); -+ } - rw = 1; - } - - fs_open(device, rw); - read_boot(&fs); -+ 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); - } - -Index: dosfstools-3.0.10/src/mkdosfs.c -=================================================================== ---- dosfstools-3.0.10.orig/src/mkdosfs.c -+++ dosfstools-3.0.10/src/mkdosfs.c -@@ -105,6 +105,7 @@ - #define HARD_SECTOR_SIZE 512 - #define SECTORS_PER_BLOCK ( BLOCK_SIZE / HARD_SECTOR_SIZE ) - -+#define NO_NAME "NO NAME " - - /* Macro definitions */ - -@@ -285,7 +286,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 */ -@@ -1248,7 +1249,7 @@ 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"); -@@ -1287,7 +1288,7 @@ 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); -@@ -1630,6 +1631,8 @@ 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 */ -Index: dosfstools-3.0.10/src/boot.c -=================================================================== ---- dosfstools-3.0.10.orig/src/boot.c -+++ dosfstools-3.0.10/src/boot.c -@@ -34,6 +34,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) -@@ -453,7 +454,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; -@@ -492,7 +493,10 @@ static void write_volume_label(DOS_FS *f - - offset = find_volume_de(fs, &de); - if (offset == 0) -- return; -+ { -+ offset = alloc_rootdir_entry(fs, &de, label); -+ /*return 0;*/ -+ } - - memcpy(de.name, label, 11); - de.time = CT_LE_W((unsigned short)((mtime->tm_sec >> 1) + -@@ -501,7 +505,16 @@ static void write_volume_label(DOS_FS *f - 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); -+ 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); - } - - void write_label(DOS_FS *fs, char *label) -Index: dosfstools-3.0.10/src/check.c -=================================================================== ---- dosfstools-3.0.10.orig/src/check.c -+++ dosfstools-3.0.10/src/check.c -@@ -133,8 +133,8 @@ loff_t alloc_rootdir_entry(DOS_FS *fs, D - 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); -Index: dosfstools-3.0.10/src/boot.h -=================================================================== ---- dosfstools-3.0.10.orig/src/boot.h -+++ dosfstools-3.0.10/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 */ - diff --git a/dosfstools-mdraid-partition.patch b/dosfstools-mdraid-partition.patch deleted file mode 100644 index c3bbca5..0000000 --- a/dosfstools-mdraid-partition.patch +++ /dev/null @@ -1,20 +0,0 @@ -Index: src/mkdosfs.c -=================================================================== ---- src/mkdosfs.c.orig -+++ src/mkdosfs.c -@@ -1763,10 +1763,11 @@ main (int argc, char **argv) - * this is a MO disk I introduce a -I (ignore) switch. -Joey - */ - if (!ignore_full_disk && ( -- (statbuf.st_rdev & 0xff3f) == 0x0300 || /* hda, hdb */ -- (statbuf.st_rdev & 0xff0f) == 0x0800 || /* sd */ -- (statbuf.st_rdev & 0xff3f) == 0x0d00 || /* xd */ -- (statbuf.st_rdev & 0xff3f) == 0x1600 ) /* hdc, hdd */ -+ (statbuf.st_rdev & 0xfff3f) == 0x00300 || -+ (major(statbuf.st_rdev) == 3 && (minor(statbuf.st_rdev) % 64) == 0) || /* hda, hdb */ -+ (major(statbuf.st_rdev) == 8 && (minor(statbuf.st_rdev) % 16) == 0) || /* sd */ -+ (major(statbuf.st_rdev) == 13 && (minor(statbuf.st_rdev) % 64) == 0) || /* xd */ -+ (major(statbuf.st_rdev) == 22 && (minor(statbuf.st_rdev) % 64) == 0)) /* hdc, hdd */ - ) - die ("Device partition expected, not making filesystem on entire device '%s' (use -I to override)"); - diff --git a/dosfstools-mkdosfs-no-label.patch b/dosfstools-mkdosfs-no-label.patch new file mode 100644 index 0000000..0c02bdc --- /dev/null +++ b/dosfstools-mkdosfs-no-label.patch @@ -0,0 +1,44 @@ +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); diff --git a/dosfstools-mkdosfs-uppercase-label.patch b/dosfstools-mkdosfs-uppercase-label.patch new file mode 100644 index 0000000..6836662 --- /dev/null +++ b/dosfstools-mkdosfs-uppercase-label.patch @@ -0,0 +1,25 @@ +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 + #include + #include ++#include + + #include + +@@ -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 */ diff --git a/dosfstools-suse-dirs.patch b/dosfstools-suse-dirs.patch index 3d86e06..3594ed1 100644 --- a/dosfstools-suse-dirs.patch +++ b/dosfstools-suse-dirs.patch @@ -1,9 +1,9 @@ -Index: dosfstools-3.0.10/Makefile +Index: dosfstools-3.0.15/Makefile =================================================================== ---- dosfstools-3.0.10.orig/Makefile -+++ dosfstools-3.0.10/Makefile -@@ -19,9 +19,9 @@ - # can be found in /usr/share/common-licenses/GPL-3 file. +--- dosfstools-3.0.15.orig/Makefile ++++ dosfstools-3.0.15/Makefile +@@ -20,9 +20,9 @@ + DESTDIR = -PREFIX = /usr/local diff --git a/dosfstools.changes b/dosfstools.changes index 947c669..4e0ada7 100644 --- a/dosfstools.changes +++ b/dosfstools.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Mon Feb 25 07:01:42 UTC 2013 - pgajdos@suse.com + +- update to 3.0.15: bugfixes for device detection, root directory + allocation, and messages about unicode filenames. + * dropped dosfstools-filename-buffer-overflow.patch (upstreamed) + * dropped dosfstools-mdraid-partition.patch (upstreamed) + * refreshed dosfstools-suse-dirs.patch + * refreshed ppc-reserved-sectors-fix.patch + (will be dropped if not upstreamed) + * dosfstools-label.patch splitted to: + - 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 + (will be upstreamed or dropped) + ------------------------------------------------------------------- Fri Oct 26 15:19:38 UTC 2012 - dvaleev@suse.com diff --git a/dosfstools.spec b/dosfstools.spec index 58a8339..d97f95f 100644 --- a/dosfstools.spec +++ b/dosfstools.spec @@ -1,7 +1,7 @@ # # spec file for package dosfstools # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,15 +22,30 @@ 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.10 +Version: 3.0.15 Release: 0 Url: http://freshmeat.net/projects/dosfstools -Source: %{name}_%{version}.orig.tar.bz2 +Source: %{name}_%{version}.orig.tar.xz Patch0: %{name}-suse-dirs.patch -Patch1: %{name}-mdraid-partition.patch -Patch2: %{name}-label.patch -Patch3: %{name}-filename-buffer-overflow.patch -Patch4: ppc-reserved-sectors-fix.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 +# following will be dropped if not upstreamed in the next update +Patch100: ppc-reserved-sectors-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Supplements: filesystem(vfat) @@ -42,10 +57,13 @@ drives or on floppies. %prep %setup %patch0 -p1 -%patch1 +%patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch100 -p1 %build make CC="%__cc" OPTFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE $RPM_OPT_FLAGS" %{?_smp_mflags} diff --git a/dosfstools_3.0.10.orig.tar.bz2 b/dosfstools_3.0.10.orig.tar.bz2 deleted file mode 100644 index 0e2e9f1..0000000 --- a/dosfstools_3.0.10.orig.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c8f6155c329c90e6bffdb339d702301316aeb6b365d95dcebd1cdc9968ad9162 -size 69718 diff --git a/dosfstools_3.0.15.orig.tar.xz b/dosfstools_3.0.15.orig.tar.xz new file mode 100644 index 0000000..d3c8430 --- /dev/null +++ b/dosfstools_3.0.15.orig.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbbeabd630f20c9d10592b2cc974926b15e8e010e29d49f308d5464528e2dfc1 +size 71716 diff --git a/ppc-reserved-sectors-fix.patch b/ppc-reserved-sectors-fix.patch index 96b1841..f084a9d 100644 --- a/ppc-reserved-sectors-fix.patch +++ b/ppc-reserved-sectors-fix.patch @@ -1,13 +1,13 @@ -Index: dosfstools-3.0.10/src/mkdosfs.c +Index: dosfstools-3.0.15/src/mkdosfs.c =================================================================== ---- dosfstools-3.0.10.orig/src/mkdosfs.c -+++ dosfstools-3.0.10/src/mkdosfs.c -@@ -1059,7 +1059,7 @@ setup_tables (void) - } +--- dosfstools-3.0.15.orig/src/mkdosfs.c ++++ dosfstools-3.0.15/src/mkdosfs.c +@@ -1016,7 +1016,7 @@ static void setup_tables(void) + } - /* Adjust the reserved number of sectors for alignment */ -- reserved_sectors = align_object(reserved_sectors, bs.cluster_size); -+ /* reserved_sectors = align_object(reserved_sectors, bs.cluster_size); */ - bs.reserved = CT_LE_W(reserved_sectors); + /* Adjust the reserved number of sectors for alignment */ +- reserved_sectors = align_object(reserved_sectors, bs.cluster_size); ++ /* reserved_sectors = align_object(reserved_sectors, bs.cluster_size); */ + bs.reserved = CT_LE_W(reserved_sectors); - /* Adjust the number of root directory entries to help enforce alignment */ + /* Adjust the number of root directory entries to help enforce alignment */ From 10c640b2d2f5168d5219653f82d94b83455dfa330a61fe5c2c5b894205cfd685 Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Wed, 27 Feb 2013 14:43:47 +0000 Subject: [PATCH 2/3] OBS-URL: https://build.opensuse.org/package/show/Base:System/dosfstools?expand=0&rev=32 --- dosfstools.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dosfstools.spec b/dosfstools.spec index d97f95f..23e32d3 100644 --- a/dosfstools.spec +++ b/dosfstools.spec @@ -44,7 +44,8 @@ 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 -# following will be dropped if not upstreamed in the next update +# workaround for +# https://bugs.launchpad.net/ubuntu/+source/dosfstools/+bug/746262 Patch100: ppc-reserved-sectors-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Supplements: filesystem(vfat) From 7aad6adc66fef0bc1b8818af97cfdf74a2f0b002f857fdde2da182aabc2f494d Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Mon, 4 Mar 2013 07:18:27 +0000 Subject: [PATCH 3/3] - 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 --- dosfstools-create-rootdir-label.patch | 53 ------------------- dosfstools-dosfslabel-forbid-lowercase.patch | 38 -------------- dosfstools-dosfslabel-from-rootdir.patch | 54 -------------------- dosfstools-fsck-file-name.patch | 18 ------- dosfstools-mkdosfs-no-label.patch | 44 ---------------- dosfstools-mkdosfs-uppercase-label.patch | 25 --------- dosfstools.changes | 12 +++++ dosfstools.spec | 25 +-------- dosfstools_3.0.15.orig.tar.xz | 3 -- dosfstools_3.0.16.orig.tar.xz | 3 ++ 10 files changed, 16 insertions(+), 259 deletions(-) delete mode 100644 dosfstools-create-rootdir-label.patch delete mode 100644 dosfstools-dosfslabel-forbid-lowercase.patch delete mode 100644 dosfstools-dosfslabel-from-rootdir.patch delete mode 100644 dosfstools-fsck-file-name.patch delete mode 100644 dosfstools-mkdosfs-no-label.patch delete mode 100644 dosfstools-mkdosfs-uppercase-label.patch delete mode 100644 dosfstools_3.0.15.orig.tar.xz create mode 100644 dosfstools_3.0.16.orig.tar.xz diff --git a/dosfstools-create-rootdir-label.patch b/dosfstools-create-rootdir-label.patch deleted file mode 100644 index b392317..0000000 --- a/dosfstools-create-rootdir-label.patch +++ /dev/null @@ -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); - } - diff --git a/dosfstools-dosfslabel-forbid-lowercase.patch b/dosfstools-dosfslabel-forbid-lowercase.patch deleted file mode 100644 index 4f839d5..0000000 --- a/dosfstools-dosfslabel-forbid-lowercase.patch +++ /dev/null @@ -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 - #include - #include -+#include - - #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; - } - diff --git a/dosfstools-dosfslabel-from-rootdir.patch b/dosfstools-dosfslabel-from-rootdir.patch deleted file mode 100644 index a0bf9c2..0000000 --- a/dosfstools-dosfslabel-from-rootdir.patch +++ /dev/null @@ -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); - } - diff --git a/dosfstools-fsck-file-name.patch b/dosfstools-fsck-file-name.patch deleted file mode 100644 index 783b15d..0000000 --- a/dosfstools-fsck-file-name.patch +++ /dev/null @@ -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); diff --git a/dosfstools-mkdosfs-no-label.patch b/dosfstools-mkdosfs-no-label.patch deleted file mode 100644 index 0c02bdc..0000000 --- a/dosfstools-mkdosfs-no-label.patch +++ /dev/null @@ -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); diff --git a/dosfstools-mkdosfs-uppercase-label.patch b/dosfstools-mkdosfs-uppercase-label.patch deleted file mode 100644 index 6836662..0000000 --- a/dosfstools-mkdosfs-uppercase-label.patch +++ /dev/null @@ -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 - #include - #include -+#include - - #include - -@@ -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 */ diff --git a/dosfstools.changes b/dosfstools.changes index 4e0ada7..6ec7c99 100644 --- a/dosfstools.changes +++ b/dosfstools.changes @@ -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 diff --git a/dosfstools.spec b/dosfstools.spec index 23e32d3..887138a 100644 --- a/dosfstools.spec +++ b/dosfstools.spec @@ -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 diff --git a/dosfstools_3.0.15.orig.tar.xz b/dosfstools_3.0.15.orig.tar.xz deleted file mode 100644 index d3c8430..0000000 --- a/dosfstools_3.0.15.orig.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bbbeabd630f20c9d10592b2cc974926b15e8e010e29d49f308d5464528e2dfc1 -size 71716 diff --git a/dosfstools_3.0.16.orig.tar.xz b/dosfstools_3.0.16.orig.tar.xz new file mode 100644 index 0000000..2e82864 --- /dev/null +++ b/dosfstools_3.0.16.orig.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:450b422d89a305bcca76b1af076c51944a5cc0f1707727ee8ef64e969dd4e956 +size 72424