diff -Nru mtools-4.0.12/debian/changelog mtools-4.0.12/debian/changelog --- mtools-4.0.12/debian/changelog 2010-02-14 23:07:06.000000000 -0500 +++ mtools-4.0.12/debian/changelog 2013-04-15 16:25:39.000000000 -0400 @@ -1,3 +1,11 @@ +mtools (4.0.12-1ubuntu1) UNRELEASED; urgency=low + + * Add debian/patches/12-fix-mlabel.patch: + Update mlabel so that we don't have weird characters at the end of + volume labels. (LP: 887446) + + -- James M Leddy Mon, 15 Apr 2013 16:25:01 -0400 + mtools (4.0.12-1) unstable; urgency=low * New upstream version diff -Nru mtools-4.0.12/debian/patches/12-fix-mlabel.c mtools-4.0.12/debian/patches/12-fix-mlabel.c --- mtools-4.0.12/debian/patches/12-fix-mlabel.c 1969-12-31 19:00:00.000000000 -0500 +++ mtools-4.0.12/debian/patches/12-fix-mlabel.c 2013-04-12 17:05:43.000000000 -0400 @@ -0,0 +1,60 @@ +--- a/mlabel.c ++++ b/mlabel.c +@@ -35,7 +35,7 @@ + int have_lower, have_upper; + wchar_t wbuffer[12]; + +- memset(ans, ' ', sizeof(ans)-1); ++ memset(ans, ' ', sizeof(*ans)-1); + ans->sentinel = '\0'; + len = native_to_wchar(filename, wbuffer, 11, 0, 0); + if(len > 11){ +@@ -147,7 +147,7 @@ + break; + case 'N': + set_serial = SER_SET; +- serial = strtol(optarg, &eptr, 16); ++ serial = strtoul(optarg, &eptr, 16); + if(*eptr) { + fprintf(stderr, + "%s not a valid serial number\n", +@@ -178,6 +178,12 @@ + if(!clear && !newLabel[0]) { + isRop = &isRo; + } ++ if(clear && newLabel[0]) { ++ /* Clear and new label specified both */ ++ fprintf(stderr, "Both clear and new label specified\n"); ++ FREE(&RootDir); ++ exit(1); ++ } + RootDir = open_root_dir(argv[optind][0], isRop ? 0 : O_RDWR, isRop); + if(isRo) { + show = 1; +@@ -219,6 +225,12 @@ + newLabel[strlen(newLabel)-1] = '\0'; + } + ++ if(strlen(newLabel) > 11) { ++ fprintf(stderr,"New label too long\n"); ++ FREE(&RootDir); ++ exit(1); ++ } ++ + if((!show || newLabel[0]) && !isNotFound(&entry)){ + /* if we have a label, wipe it out before putting new one */ + if(interactive && newLabel[0] == '\0') +@@ -278,6 +290,13 @@ + + if(need_write_boot) { + force_write(Fs, (char *)&boot, 0, sizeof(boot)); ++ /* If this is fat 32, write backup boot sector too */ ++ if(!WORD_S(fatlen)) { ++ int backupBoot = WORD_S(ext.fat32.backupBoot); ++ force_write(Fs, (char *)&boot, ++ backupBoot * WORD_S(secsiz), ++ sizeof(boot)); ++ } + } + + FREE(&RootDir); diff -Nru mtools-4.0.12/debian/patches/12-fix-mlabel.patch mtools-4.0.12/debian/patches/12-fix-mlabel.patch --- mtools-4.0.12/debian/patches/12-fix-mlabel.patch 1969-12-31 19:00:00.000000000 -0500 +++ mtools-4.0.12/debian/patches/12-fix-mlabel.patch 2013-04-12 17:08:40.000000000 -0400 @@ -0,0 +1,60 @@ +--- a/mlabel.c ++++ b/mlabel.c +@@ -35,7 +35,7 @@ void label_name(doscp_t *cp, const char + int have_lower, have_upper; + wchar_t wbuffer[12]; + +- memset(ans, ' ', sizeof(ans)-1); ++ memset(ans, ' ', sizeof(*ans)-1); + ans->sentinel = '\0'; + len = native_to_wchar(filename, wbuffer, 11, 0, 0); + if(len > 11){ +@@ -147,7 +147,7 @@ void mlabel(int argc, char **argv, int t + break; + case 'N': + set_serial = SER_SET; +- serial = strtol(optarg, &eptr, 16); ++ serial = strtoul(optarg, &eptr, 16); + if(*eptr) { + fprintf(stderr, + "%s not a valid serial number\n", +@@ -178,6 +178,12 @@ void mlabel(int argc, char **argv, int t + if(!clear && !newLabel[0]) { + isRop = &isRo; + } ++ if(clear && newLabel[0]) { ++ /* Clear and new label specified both */ ++ fprintf(stderr, "Both clear and new label specified\n"); ++ FREE(&RootDir); ++ exit(1); ++ } + RootDir = open_root_dir(argv[optind][0], isRop ? 0 : O_RDWR, isRop); + if(isRo) { + show = 1; +@@ -219,6 +225,12 @@ void mlabel(int argc, char **argv, int t + newLabel[strlen(newLabel)-1] = '\0'; + } + ++ if(strlen(newLabel) > 11) { ++ fprintf(stderr,"New label too long\n"); ++ FREE(&RootDir); ++ exit(1); ++ } ++ + if((!show || newLabel[0]) && !isNotFound(&entry)){ + /* if we have a label, wipe it out before putting new one */ + if(interactive && newLabel[0] == '\0') +@@ -278,6 +290,13 @@ void mlabel(int argc, char **argv, int t + + if(need_write_boot) { + force_write(Fs, (char *)&boot, 0, sizeof(boot)); ++ /* If this is fat 32, write backup boot sector too */ ++ if(!WORD_S(fatlen)) { ++ int backupBoot = WORD_S(ext.fat32.backupBoot); ++ force_write(Fs, (char *)&boot, ++ backupBoot * WORD_S(secsiz), ++ sizeof(boot)); ++ } + } + + FREE(&RootDir); diff -Nru mtools-4.0.12/debian/patches/series mtools-4.0.12/debian/patches/series --- mtools-4.0.12/debian/patches/series 2010-02-14 23:26:06.000000000 -0500 +++ mtools-4.0.12/debian/patches/series 2013-04-12 17:08:32.000000000 -0400 @@ -6,3 +6,4 @@ 09-468744-mtools.1.patch 10-remove-iX-lp.patch 11-truncation-fix.patch +12-fix-mlabel.patch