From c32e05cf546485e759f6280adb5345785a9c1dfb Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 26 Dec 2022 13:14:06 +0900 Subject: [PATCH] Imported Upstream version 3.0.26 --- ChangeLog | 53 +++++++++++++++++++++++++++++++++++++++++++- VERSION | 2 +- manpages/de/fatlabel.de.8 | 2 +- manpages/de/fsck.fat.de.8 | 2 +- manpages/de/mkfs.fat.de.8 | 2 +- manpages/en/fatlabel.8 | 2 +- manpages/en/fsck.fat.8 | 2 +- manpages/en/mkfs.fat.8 | 2 +- manpages/po/de/fatlabel.8.po | 6 ++--- manpages/po/de/fsck.fat.8.po | 6 ++--- manpages/po/de/mkfs.fat.8.po | 6 ++--- manpages/pot/fatlabel.8.pot | 6 ++--- manpages/pot/fsck.fat.8.pot | 6 ++--- manpages/pot/mkfs.fat.8.pot | 6 ++--- src/check.c | 36 ++++++++++++++++++++++++++++-- src/fsck.fat.h | 1 + src/io.h | 2 +- src/mkfs.fat.c | 1 + src/version.h | 4 ++-- 19 files changed, 116 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 414d1db..6807d23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,55 @@ -commit acf64ae (HEAD, origin/master, origin/HEAD, master) +commit 6893c45 (HEAD, origin/master, origin/HEAD, master) +Author: Dir Lotter +Date: Fri Mar 7 18:25:39 2014 +0100 + + Fix "odd" files created by frequent power-loss. + + After running many power losses the filesystem can degrate, containing "odd" + files making the filesystem corrupt that could not be solved by fsck: + + * file was not visible in a ls -l + * ls -i reported a "invalid file name" on the console + * a test program with diropen/dirread showed the file, a stat on this file + failed + * file was not accessible and could not be deleted + + After digging into the code we found why fsck didn't repair the file system: + One thing was we don't have short filenames. Another issue was that the LFN + pointer was set to NULL and so it looked like we didn't have short and long + filenames. + + Our patch of check.c includes: + + * returns 1 from function bad_name() in case no short and no long filename + exist + * auto_rename() and rename_file() got a special handling for the case no short + file name exist: + - it enables the short file name (we think here was a weakness of the old + code: it changed the short filename but didn't enabled it in the + file->dir_ent.lcase entry) + - it reset all attributes except ATTR_DIR and ATTR_VOLUME + + This solved our problem pretty well. + + Signed-off-by: Daniel Baumann + +commit 621e11f +Author: Natanael Copa +Date: Sat Feb 8 18:53:30 2014 +0100 + + Build fixes for musl libc. + + Signed-off-by: Daniel Baumann + +commit 52588b7 (tag: v3.0.25) +Author: Daniel Baumann +Date: Fri Jan 17 07:11:11 2014 +0100 + + Releasing version 3.0.25. + + Signed-off-by: Daniel Baumann + +commit acf64ae Author: Daniel Baumann Date: Fri Jan 17 07:09:54 2014 +0100 diff --git a/VERSION b/VERSION index de2e889..2551016 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.25 +3.0.26 diff --git a/manpages/de/fatlabel.de.8 b/manpages/de/fatlabel.de.8 index 52b3025..8c9802b 100644 --- a/manpages/de/fatlabel.de.8 +++ b/manpages/de/fatlabel.de.8 @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH FATLABEL 8 2014\-01\-17 3.0.25 dosfstools +.TH FATLABEL 8 2014\-03\-07 3.0.26 dosfstools .SH NAME \fBfatlabel\fP \- set or get MS\-DOS filesystem label diff --git a/manpages/de/fsck.fat.de.8 b/manpages/de/fsck.fat.de.8 index 4c0c4fe..674a51f 100644 --- a/manpages/de/fsck.fat.de.8 +++ b/manpages/de/fsck.fat.de.8 @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH FSCK.FAT 8 2014\-01\-17 3.0.25 dosfstools +.TH FSCK.FAT 8 2014\-03\-07 3.0.26 dosfstools .SH NAME \fBfsck.fat\fP \- check and repair MS\-DOS filesystems diff --git a/manpages/de/mkfs.fat.de.8 b/manpages/de/mkfs.fat.de.8 index c34f932..6d81c4f 100644 --- a/manpages/de/mkfs.fat.de.8 +++ b/manpages/de/mkfs.fat.de.8 @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH MKFS.FAT 8 2014\-01\-17 3.0.25 dosfstools +.TH MKFS.FAT 8 2014\-03\-07 3.0.26 dosfstools .SH NAME \fBmkfs.fat\fP \- create an MS\-DOS filesystem under Linux diff --git a/manpages/en/fatlabel.8 b/manpages/en/fatlabel.8 index ba944dc..341117b 100644 --- a/manpages/en/fatlabel.8 +++ b/manpages/en/fatlabel.8 @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH FATLABEL 8 2014\-01\-17 3.0.25 "dosfstools" +.TH FATLABEL 8 2014\-03\-07 3.0.26 "dosfstools" .SH NAME \fBfatlabel\fR \- set or get MS\-DOS filesystem label diff --git a/manpages/en/fsck.fat.8 b/manpages/en/fsck.fat.8 index 61d14e5..af4b6ec 100644 --- a/manpages/en/fsck.fat.8 +++ b/manpages/en/fsck.fat.8 @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH FSCK.FAT 8 2014\-01\-17 3.0.25 "dosfstools" +.TH FSCK.FAT 8 2014\-03\-07 3.0.26 "dosfstools" .SH NAME \fBfsck.fat\fR \- check and repair MS\-DOS filesystems diff --git a/manpages/en/mkfs.fat.8 b/manpages/en/mkfs.fat.8 index f358516..d76d7a6 100644 --- a/manpages/en/mkfs.fat.8 +++ b/manpages/en/mkfs.fat.8 @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH MKFS.FAT 8 2014\-01\-17 3.0.25 "dosfstools" +.TH MKFS.FAT 8 2014\-03\-07 3.0.26 "dosfstools" .SH NAME \fBmkfs.fat\fR \- create an MS-DOS filesystem under Linux diff --git a/manpages/po/de/fatlabel.8.po b/manpages/po/de/fatlabel.8.po index 5428ba0..256d5ed 100644 --- a/manpages/po/de/fatlabel.8.po +++ b/manpages/po/de/fatlabel.8.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -22,13 +22,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/manpages/po/de/fsck.fat.8.po b/manpages/po/de/fsck.fat.8.po index 5075781..70793da 100644 --- a/manpages/po/de/fsck.fat.8.po +++ b/manpages/po/de/fsck.fat.8.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,13 +16,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/manpages/po/de/mkfs.fat.8.po b/manpages/po/de/mkfs.fat.8.po index 9688d3e..dffecd5 100644 --- a/manpages/po/de/mkfs.fat.8.po +++ b/manpages/po/de/mkfs.fat.8.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,13 +16,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/manpages/pot/fatlabel.8.pot b/manpages/pot/fatlabel.8.pot index 6e11e04..4b06bca 100644 --- a/manpages/pot/fatlabel.8.pot +++ b/manpages/pot/fatlabel.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/manpages/pot/fsck.fat.8.pot b/manpages/pot/fsck.fat.8.pot index eed92a8..22ff5fa 100644 --- a/manpages/pot/fsck.fat.8.pot +++ b/manpages/pot/fsck.fat.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,13 +19,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/manpages/pot/mkfs.fat.8.pot b/manpages/pot/mkfs.fat.8.pot index 35df010..98b36c0 100644 --- a/manpages/pot/mkfs.fat.8.pot +++ b/manpages/pot/mkfs.fat.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2014-01-17 07:10+0100\n" +"POT-Creation-Date: 2014-03-07 18:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,13 +19,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2014-01-17" +msgid "2014-03-07" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.25" +msgid "3.0.26" msgstr "" #. type: TH diff --git a/src/check.c b/src/check.c index 213542f..a330caf 100644 --- a/src/check.c +++ b/src/check.c @@ -273,6 +273,12 @@ static int bad_name(DOS_FILE * file) strncmp((const char *)name, "WP ROOT SF", 11) == 0) return 0; + /* PATCH ED+DL */ + /* check if we have neither a long filename nor a short name */ + if ((file->lfn == NULL) && (file->dir_ent.lcase & FAT_NO_83NAME)) { + return 1; + } + /* don't complain about the dummy 11 bytes used by patched Linux kernels */ if (file->dir_ent.lcase & FAT_NO_83NAME) @@ -395,7 +401,20 @@ static void auto_rename(DOS_FILE * file) (const char *)file->dir_ent.name, MSDOS_NAME)) break; if (!walk) { - fs_write(file->offset, MSDOS_NAME, file->dir_ent.name); + /* PATCH ED+DL */ + if(file->dir_ent.lcase & FAT_NO_83NAME) + { + /* as we only assign a new 8.3 filename, reset flag that 8.3 name is not + present */ + file->dir_ent.lcase &= ~FAT_NO_83NAME; + /* reset the attributes */ + file->dir_ent.attr &= ~(ATTR_DIR | ATTR_VOLUME); /* only keep the DIR and VOLUME attributes */ + fs_write(file->offset, MSDOS_NAME+2, file->dir_ent.name); + } + else + { + fs_write(file->offset, MSDOS_NAME, file->dir_ent.name); + } if (file->lfn) lfn_fix_checksum(file->lfn_offset, file->offset, (const char *)file->dir_ent.name); @@ -429,7 +448,20 @@ static void rename_file(DOS_FILE * file) walk[1] = 0; for (walk = name; *walk == ' ' || *walk == '\t'; walk++) ; if (file_cvt(walk, file->dir_ent.name)) { - fs_write(file->offset, MSDOS_NAME, file->dir_ent.name); + /* PATCH ED+DL */ + if(file->dir_ent.lcase & FAT_NO_83NAME) + { + /* as we only assign a new 8.3 filename, reset flag that 8.3 name is not + present */ + file->dir_ent.lcase &= ~FAT_NO_83NAME; + /* reset the attributes */ + file->dir_ent.attr &= ~(ATTR_DIR | ATTR_VOLUME); /* only keep the DIR and VOLUME attributes */ + fs_write(file->offset, MSDOS_NAME+2, file->dir_ent.name); + } + else + { + fs_write(file->offset, MSDOS_NAME, file->dir_ent.name); + } if (file->lfn) lfn_fix_checksum(file->lfn_offset, file->offset, (const char *)file->dir_ent.name); diff --git a/src/fsck.fat.h b/src/fsck.fat.h index 9d4bb16..e5ade5b 100644 --- a/src/fsck.fat.h +++ b/src/fsck.fat.h @@ -27,6 +27,7 @@ #ifndef _DOSFSCK_H #define _DOSFSCK_H +#include #include #define _LINUX_STAT_H /* hack to avoid inclusion of */ #define _LINUX_STRING_H_ /* hack to avoid inclusion of */ diff --git a/src/io.h b/src/io.h index ea0e35d..d23d07e 100644 --- a/src/io.h +++ b/src/io.h @@ -27,7 +27,7 @@ #ifndef _IO_H #define _IO_H -#include /* for loff_t */ +#include /* for loff_t */ loff_t llseek(int fd, loff_t offset, int whence); diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c index 96ba47e..604b7d0 100644 --- a/src/mkfs.fat.c +++ b/src/mkfs.fat.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include diff --git a/src/version.h b/src/version.h index 683a7f7..bf941bf 100644 --- a/src/version.h +++ b/src/version.h @@ -23,7 +23,7 @@ #ifndef _version_h #define _version_h -#define VERSION "3.0.25" -#define VERSION_DATE "2014-01-17" +#define VERSION "3.0.26" +#define VERSION_DATE "2014-03-07" #endif -- 2.7.4