openwrt/tools/dosfstools/patches/0006-fsck.fat-Make-r-option...

604 lines
15 KiB
Diff

From 357ab077198bfa6239fa62fd03a546da959ec756 Mon Sep 17 00:00:00 2001
From: Andreas Bombe <aeb@debian.org>
Date: Thu, 19 Feb 2015 21:22:54 +0100
Subject: [PATCH 06/14] fsck.fat: Make -r option default
Default mode is now to interactively repair with the option to write
the changes back at the end (like the -r option) instead of the previous
default mode of interactively correcting but never writing back the
changes.
The -r option continues to be recognized by fsck.fat.
Signed-off-by: Andreas Bombe <aeb@debian.org>
---
manpages/de/fsck.fat.de.8 | 6 ++--
manpages/en/fsck.fat.8 | 5 +--
manpages/po/de/fsck.fat.8.po | 76 ++++++++++++++++++++------------------------
manpages/pot/fsck.fat.8.pot | 76 ++++++++++++++++++++------------------------
src/fsck.fat.c | 6 ++--
5 files changed, 76 insertions(+), 93 deletions(-)
diff --git a/manpages/de/fsck.fat.de.8 b/manpages/de/fsck.fat.de.8
index 1d96e23..f9d70b8 100644
--- a/manpages/de/fsck.fat.de.8
+++ b/manpages/de/fsck.fat.de.8
@@ -123,7 +123,8 @@ anything to the filesystem.
Same as (\fB\-a\fP), for compatibility with other *fsck.
.IP \fB\-r\fP 4
Interactively repair the filesystem. The user is asked for advice whenever
-there is more than one approach to fix an inconsistency.
+there is more than one approach to fix an inconsistency. This is the default
+mode and the option is only retained for backwards compatibility.
.IP \fB\-t\fP 4
Mark unreadable clusters as bad.
.IP \fB\-u\fP 4
@@ -143,9 +144,6 @@ Write changes to disk immediately.
.IP \fB\-y\fP 4
Same as \fB\-a\fP (automatically repair filesystem) for compatibility with other
fsck tools.
-.PP
-\fBNote:\fP If \fB\-a\fP and \fB\-r\fP are absent, the filesystem is only checked, but
-not repaired.
.SH "EXIT STATUS"
.IP 0 4
diff --git a/manpages/en/fsck.fat.8 b/manpages/en/fsck.fat.8
index 3d95dc8..8c54372 100644
--- a/manpages/en/fsck.fat.8
+++ b/manpages/en/fsck.fat.8
@@ -93,8 +93,7 @@ anything to the filesystem.
.IP "\fB\-p\fR" 4
Same as (\fB\-a\fR), for compatibility with other *fsck.
.IP "\fB\-r\fR" 4
-Interactively repair the filesystem. The user is asked for advice whenever
-there is more than one approach to fix an inconsistency.
+Interactively repair the filesystem. The user is asked for advice whenever there is more than one approach to fix an inconsistency. This is the default mode and the option is only retained for backwards compatibility.
.IP "\fB\-t\fR" 4
Mark unreadable clusters as bad.
.IP "\fB\-u\fR" 4
@@ -107,8 +106,6 @@ Perform a verification pass. The filesystem check is repeated after the first ru
Write changes to disk immediately.
.IP "\fB\-y\fR" 4
Same as \fB\-a\fR (automatically repair filesystem) for compatibility with other fsck tools.
-.PP
-\fBNote:\fR If \fB\-a\fR and \fB\-r\fR are absent, the filesystem is only checked, but not repaired.
.SH "EXIT STATUS"
.IP "0" 4
diff --git a/manpages/po/de/fsck.fat.8.po b/manpages/po/de/fsck.fat.8.po
index 3035906..7ca0bc1 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-11-12 00:52+0100\n"
+"POT-Creation-Date: 2015-02-20 20:47+0100\n"
"PO-Revision-Date: 2013-06-06 09:34+0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@@ -56,30 +56,30 @@ msgid "OPTIONS"
msgstr ""
#. type: SH
-#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:78
+#: en/fatlabel.8:41 en/fsck.fat.8:125 en/mkfs.fat.8:78
#, no-wrap
msgid "SEE ALSO"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:45 en/fsck.fat.8:132
+#: en/fatlabel.8:45 en/fsck.fat.8:129
msgid "B<mkfs.fat>(8)"
msgstr ""
#. type: SH
-#: en/fatlabel.8:46 en/fsck.fat.8:133 en/mkfs.fat.8:83
+#: en/fatlabel.8:46 en/fsck.fat.8:130 en/mkfs.fat.8:83
#, no-wrap
msgid "HOMEPAGE"
msgstr ""
#. type: SH
-#: en/fatlabel.8:49 en/fsck.fat.8:136 en/mkfs.fat.8:86
+#: en/fatlabel.8:49 en/fsck.fat.8:133 en/mkfs.fat.8:86
#, no-wrap
msgid "AUTHORS"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:50 en/fsck.fat.8:137 en/mkfs.fat.8:87
+#: en/fatlabel.8:50 en/fsck.fat.8:134 en/mkfs.fat.8:87
msgid ""
"B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
"almesberger@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
@@ -365,31 +365,32 @@ msgid "B<-r>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:98
+#: en/fsck.fat.8:97
msgid ""
"Interactively repair the filesystem. The user is asked for advice whenever "
-"there is more than one approach to fix an inconsistency."
+"there is more than one approach to fix an inconsistency. This is the default "
+"mode and the option is only retained for backwards compatibility."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:98
+#: en/fsck.fat.8:97
#, no-wrap
msgid "B<-t>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:100
+#: en/fsck.fat.8:99
msgid "Mark unreadable clusters as bad."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:100
+#: en/fsck.fat.8:99
#, no-wrap
msgid "B<-u>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:102
+#: en/fsck.fat.8:101
msgid ""
"Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
"contiguous unallocated clusters beginning with the start cluster of the "
@@ -397,24 +398,24 @@ msgid ""
msgstr ""
#. type: IP
-#: en/fsck.fat.8:102 en/mkfs.fat.8:72
+#: en/fsck.fat.8:101 en/mkfs.fat.8:72
#, no-wrap
msgid "B<-v>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:104
+#: en/fsck.fat.8:103
msgid "Verbose mode. Generates slightly more output."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:104
+#: en/fsck.fat.8:103
#, no-wrap
msgid "B<-V>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:106
+#: en/fsck.fat.8:105
msgid ""
"Perform a verification pass. The filesystem check is repeated after the "
"first run. The second pass should never report any fixable errors. It may "
@@ -424,91 +425,84 @@ msgid ""
msgstr ""
#. type: IP
-#: en/fsck.fat.8:106
+#: en/fsck.fat.8:105
#, no-wrap
msgid "B<-w>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:108
+#: en/fsck.fat.8:107
msgid "Write changes to disk immediately."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:108
+#: en/fsck.fat.8:107
#, no-wrap
msgid "B<-y>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:110
+#: en/fsck.fat.8:109
msgid ""
"Same as B<-a> (automatically repair filesystem) for compatibility with other "
"fsck tools."
msgstr ""
-#. type: Plain text
-#: en/fsck.fat.8:112
-msgid ""
-"B<Note:> If B<-a> and B<-r> are absent, the filesystem is only checked, but "
-"not repaired."
-msgstr ""
-
#. type: SH
-#: en/fsck.fat.8:113
+#: en/fsck.fat.8:110
#, no-wrap
msgid "EXIT STATUS"
msgstr ""
#. type: IP
-#: en/fsck.fat.8:114
+#: en/fsck.fat.8:111
#, no-wrap
msgid "0"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:116
+#: en/fsck.fat.8:113
msgid "No recoverable errors have been detected."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:116
+#: en/fsck.fat.8:113
#, no-wrap
msgid "1"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:118
+#: en/fsck.fat.8:115
msgid ""
"Recoverable errors have been detected or B<fsck.fat> has discovered an "
"internal inconsistency."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:118
+#: en/fsck.fat.8:115
#, no-wrap
msgid "2"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:120
+#: en/fsck.fat.8:117
msgid "Usage error. B<fsck.fat> did not access the filesystem."
msgstr ""
#. type: SH
-#: en/fsck.fat.8:121
+#: en/fsck.fat.8:118
#, no-wrap
msgid "FILES"
msgstr ""
#. type: IP
-#: en/fsck.fat.8:122
+#: en/fsck.fat.8:119
#, no-wrap
msgid "fsck0000.rec, fsck0001.rec, ..."
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:124
+#: en/fsck.fat.8:121
msgid ""
"When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
"data into files named 'fsckNNNN.rec' in the top level directory of the "
@@ -516,13 +510,13 @@ msgid ""
msgstr ""
#. type: SH
-#: en/fsck.fat.8:125 en/mkfs.fat.8:75
+#: en/fsck.fat.8:122 en/mkfs.fat.8:75
#, no-wrap
msgid "BUGS"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:127
+#: en/fsck.fat.8:124
msgid ""
"Does not create . and .. files where necessary. Does not remove entirely "
"empty directories. Should give more diagnostic messages. Undeleting files "
@@ -530,12 +524,12 @@ msgid ""
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:130 en/mkfs.fat.8:80
+#: en/fsck.fat.8:127 en/mkfs.fat.8:80
msgid "B<fatlabel>(8)"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:135 en/mkfs.fat.8:85
+#: en/fsck.fat.8:132 en/mkfs.fat.8:85
msgid ""
"More information about B<fsck.fat> and B<dosfstools> can be found at "
"E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
diff --git a/manpages/pot/fsck.fat.8.pot b/manpages/pot/fsck.fat.8.pot
index e411819..f5ca313 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-11-12 00:52+0100\n"
+"POT-Creation-Date: 2015-02-20 20:47+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -59,30 +59,30 @@ msgid "OPTIONS"
msgstr ""
#. type: SH
-#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:78
+#: en/fatlabel.8:41 en/fsck.fat.8:125 en/mkfs.fat.8:78
#, no-wrap
msgid "SEE ALSO"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:45 en/fsck.fat.8:132
+#: en/fatlabel.8:45 en/fsck.fat.8:129
msgid "B<mkfs.fat>(8)"
msgstr ""
#. type: SH
-#: en/fatlabel.8:46 en/fsck.fat.8:133 en/mkfs.fat.8:83
+#: en/fatlabel.8:46 en/fsck.fat.8:130 en/mkfs.fat.8:83
#, no-wrap
msgid "HOMEPAGE"
msgstr ""
#. type: SH
-#: en/fatlabel.8:49 en/fsck.fat.8:136 en/mkfs.fat.8:86
+#: en/fatlabel.8:49 en/fsck.fat.8:133 en/mkfs.fat.8:86
#, no-wrap
msgid "AUTHORS"
msgstr ""
#. type: Plain text
-#: en/fatlabel.8:50 en/fsck.fat.8:137 en/mkfs.fat.8:87
+#: en/fatlabel.8:50 en/fsck.fat.8:134 en/mkfs.fat.8:87
msgid ""
"B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
"almesberger@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
@@ -368,31 +368,32 @@ msgid "B<-r>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:98
+#: en/fsck.fat.8:97
msgid ""
"Interactively repair the filesystem. The user is asked for advice whenever "
-"there is more than one approach to fix an inconsistency."
+"there is more than one approach to fix an inconsistency. This is the default "
+"mode and the option is only retained for backwards compatibility."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:98
+#: en/fsck.fat.8:97
#, no-wrap
msgid "B<-t>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:100
+#: en/fsck.fat.8:99
msgid "Mark unreadable clusters as bad."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:100
+#: en/fsck.fat.8:99
#, no-wrap
msgid "B<-u>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:102
+#: en/fsck.fat.8:101
msgid ""
"Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
"contiguous unallocated clusters beginning with the start cluster of the "
@@ -400,24 +401,24 @@ msgid ""
msgstr ""
#. type: IP
-#: en/fsck.fat.8:102 en/mkfs.fat.8:72
+#: en/fsck.fat.8:101 en/mkfs.fat.8:72
#, no-wrap
msgid "B<-v>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:104
+#: en/fsck.fat.8:103
msgid "Verbose mode. Generates slightly more output."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:104
+#: en/fsck.fat.8:103
#, no-wrap
msgid "B<-V>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:106
+#: en/fsck.fat.8:105
msgid ""
"Perform a verification pass. The filesystem check is repeated after the "
"first run. The second pass should never report any fixable errors. It may "
@@ -427,91 +428,84 @@ msgid ""
msgstr ""
#. type: IP
-#: en/fsck.fat.8:106
+#: en/fsck.fat.8:105
#, no-wrap
msgid "B<-w>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:108
+#: en/fsck.fat.8:107
msgid "Write changes to disk immediately."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:108
+#: en/fsck.fat.8:107
#, no-wrap
msgid "B<-y>"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:110
+#: en/fsck.fat.8:109
msgid ""
"Same as B<-a> (automatically repair filesystem) for compatibility with other "
"fsck tools."
msgstr ""
-#. type: Plain text
-#: en/fsck.fat.8:112
-msgid ""
-"B<Note:> If B<-a> and B<-r> are absent, the filesystem is only checked, but "
-"not repaired."
-msgstr ""
-
#. type: SH
-#: en/fsck.fat.8:113
+#: en/fsck.fat.8:110
#, no-wrap
msgid "EXIT STATUS"
msgstr ""
#. type: IP
-#: en/fsck.fat.8:114
+#: en/fsck.fat.8:111
#, no-wrap
msgid "0"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:116
+#: en/fsck.fat.8:113
msgid "No recoverable errors have been detected."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:116
+#: en/fsck.fat.8:113
#, no-wrap
msgid "1"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:118
+#: en/fsck.fat.8:115
msgid ""
"Recoverable errors have been detected or B<fsck.fat> has discovered an "
"internal inconsistency."
msgstr ""
#. type: IP
-#: en/fsck.fat.8:118
+#: en/fsck.fat.8:115
#, no-wrap
msgid "2"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:120
+#: en/fsck.fat.8:117
msgid "Usage error. B<fsck.fat> did not access the filesystem."
msgstr ""
#. type: SH
-#: en/fsck.fat.8:121
+#: en/fsck.fat.8:118
#, no-wrap
msgid "FILES"
msgstr ""
#. type: IP
-#: en/fsck.fat.8:122
+#: en/fsck.fat.8:119
#, no-wrap
msgid "fsck0000.rec, fsck0001.rec, ..."
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:124
+#: en/fsck.fat.8:121
msgid ""
"When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
"data into files named 'fsckNNNN.rec' in the top level directory of the "
@@ -519,13 +513,13 @@ msgid ""
msgstr ""
#. type: SH
-#: en/fsck.fat.8:125 en/mkfs.fat.8:75
+#: en/fsck.fat.8:122 en/mkfs.fat.8:75
#, no-wrap
msgid "BUGS"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:127
+#: en/fsck.fat.8:124
msgid ""
"Does not create . and .. files where necessary. Does not remove entirely "
"empty directories. Should give more diagnostic messages. Undeleting files "
@@ -533,12 +527,12 @@ msgid ""
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:130 en/mkfs.fat.8:80
+#: en/fsck.fat.8:127 en/mkfs.fat.8:80
msgid "B<fatlabel>(8)"
msgstr ""
#. type: Plain text
-#: en/fsck.fat.8:135 en/mkfs.fat.8:85
+#: en/fsck.fat.8:132 en/mkfs.fat.8:85
msgid ""
"More information about B<fsck.fat> and B<dosfstools> can be found at "
"E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
diff --git a/src/fsck.fat.c b/src/fsck.fat.c
index c073d9a..6c7fd87 100644
--- a/src/fsck.fat.c
+++ b/src/fsck.fat.c
@@ -108,8 +108,8 @@ int main(int argc, char **argv)
uint32_t free_clusters = 0;
memset(&fs, 0, sizeof(fs));
- rw = salvage_files = verify = 0;
- interactive = 1;
+ salvage_files = verify = 0;
+ rw = interactive = 1;
check_atari();
while ((c = getopt(argc, argv, "Aac:d:bflnprtu:vVwy")) != EOF)
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
}
set_dos_codepage(-1); /* set default codepage if none was given in command line */
if ((test || write_immed) && !rw) {
- fprintf(stderr, "-t and -w require -a or -r\n");
+ fprintf(stderr, "-t and -w can not be used in read only mode\n");
exit(2);
}
if (optind != argc - 1)
--
1.9.1