1 From 357ab077198bfa6239fa62fd03a546da959ec756 Mon Sep 17 00:00:00 2001
2 From: Andreas Bombe <aeb@debian.org>
3 Date: Thu, 19 Feb 2015 21:22:54 +0100
4 Subject: [PATCH 06/14] fsck.fat: Make -r option default
6 Default mode is now to interactively repair with the option to write
7 the changes back at the end (like the -r option) instead of the previous
8 default mode of interactively correcting but never writing back the
11 The -r option continues to be recognized by fsck.fat.
13 Signed-off-by: Andreas Bombe <aeb@debian.org>
15 manpages/de/fsck.fat.de.8 | 6 ++--
16 manpages/en/fsck.fat.8 | 5 +--
17 manpages/po/de/fsck.fat.8.po | 76 ++++++++++++++++++++------------------------
18 manpages/pot/fsck.fat.8.pot | 76 ++++++++++++++++++++------------------------
19 src/fsck.fat.c | 6 ++--
20 5 files changed, 76 insertions(+), 93 deletions(-)
22 diff --git a/manpages/de/fsck.fat.de.8 b/manpages/de/fsck.fat.de.8
23 index 1d96e23..f9d70b8 100644
24 --- a/manpages/de/fsck.fat.de.8
25 +++ b/manpages/de/fsck.fat.de.8
26 @@ -123,7 +123,8 @@ anything to the filesystem.
27 Same as (\fB\-a\fP), for compatibility with other *fsck.
29 Interactively repair the filesystem. The user is asked for advice whenever
30 -there is more than one approach to fix an inconsistency.
31 +there is more than one approach to fix an inconsistency. This is the default
32 +mode and the option is only retained for backwards compatibility.
34 Mark unreadable clusters as bad.
36 @@ -143,9 +144,6 @@ Write changes to disk immediately.
38 Same as \fB\-a\fP (automatically repair filesystem) for compatibility with other
41 -\fBNote:\fP If \fB\-a\fP and \fB\-r\fP are absent, the filesystem is only checked, but
46 diff --git a/manpages/en/fsck.fat.8 b/manpages/en/fsck.fat.8
47 index 3d95dc8..8c54372 100644
48 --- a/manpages/en/fsck.fat.8
49 +++ b/manpages/en/fsck.fat.8
50 @@ -93,8 +93,7 @@ anything to the filesystem.
52 Same as (\fB\-a\fR), for compatibility with other *fsck.
54 -Interactively repair the filesystem. The user is asked for advice whenever
55 -there is more than one approach to fix an inconsistency.
56 +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.
58 Mark unreadable clusters as bad.
60 @@ -107,8 +106,6 @@ Perform a verification pass. The filesystem check is repeated after the first ru
61 Write changes to disk immediately.
63 Same as \fB\-a\fR (automatically repair filesystem) for compatibility with other fsck tools.
65 -\fBNote:\fR If \fB\-a\fR and \fB\-r\fR are absent, the filesystem is only checked, but not repaired.
69 diff --git a/manpages/po/de/fsck.fat.8.po b/manpages/po/de/fsck.fat.8.po
70 index 3035906..7ca0bc1 100644
71 --- a/manpages/po/de/fsck.fat.8.po
72 +++ b/manpages/po/de/fsck.fat.8.po
76 "Project-Id-Version: dosfstools VERSION\n"
77 -"POT-Creation-Date: 2014-11-12 00:52+0100\n"
78 +"POT-Creation-Date: 2015-02-20 20:47+0100\n"
79 "PO-Revision-Date: 2013-06-06 09:34+0300\n"
80 "Last-Translator: Automatically generated\n"
81 "Language-Team: none\n"
82 @@ -56,30 +56,30 @@ msgid "OPTIONS"
86 -#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:78
87 +#: en/fatlabel.8:41 en/fsck.fat.8:125 en/mkfs.fat.8:78
93 -#: en/fatlabel.8:45 en/fsck.fat.8:132
94 +#: en/fatlabel.8:45 en/fsck.fat.8:129
95 msgid "B<mkfs.fat>(8)"
99 -#: en/fatlabel.8:46 en/fsck.fat.8:133 en/mkfs.fat.8:83
100 +#: en/fatlabel.8:46 en/fsck.fat.8:130 en/mkfs.fat.8:83
106 -#: en/fatlabel.8:49 en/fsck.fat.8:136 en/mkfs.fat.8:86
107 +#: en/fatlabel.8:49 en/fsck.fat.8:133 en/mkfs.fat.8:86
113 -#: en/fatlabel.8:50 en/fsck.fat.8:137 en/mkfs.fat.8:87
114 +#: en/fatlabel.8:50 en/fsck.fat.8:134 en/mkfs.fat.8:87
116 "B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
117 "almesberger@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
118 @@ -365,31 +365,32 @@ msgid "B<-r>"
125 "Interactively repair the filesystem. The user is asked for advice whenever "
126 -"there is more than one approach to fix an inconsistency."
127 +"there is more than one approach to fix an inconsistency. This is the default "
128 +"mode and the option is only retained for backwards compatibility."
139 -#: en/fsck.fat.8:100
141 msgid "Mark unreadable clusters as bad."
145 -#: en/fsck.fat.8:100
152 -#: en/fsck.fat.8:102
153 +#: en/fsck.fat.8:101
155 "Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
156 "contiguous unallocated clusters beginning with the start cluster of the "
157 @@ -397,24 +398,24 @@ msgid ""
161 -#: en/fsck.fat.8:102 en/mkfs.fat.8:72
162 +#: en/fsck.fat.8:101 en/mkfs.fat.8:72
168 -#: en/fsck.fat.8:104
169 +#: en/fsck.fat.8:103
170 msgid "Verbose mode. Generates slightly more output."
174 -#: en/fsck.fat.8:104
175 +#: en/fsck.fat.8:103
181 -#: en/fsck.fat.8:106
182 +#: en/fsck.fat.8:105
184 "Perform a verification pass. The filesystem check is repeated after the "
185 "first run. The second pass should never report any fixable errors. It may "
186 @@ -424,91 +425,84 @@ msgid ""
190 -#: en/fsck.fat.8:106
191 +#: en/fsck.fat.8:105
197 -#: en/fsck.fat.8:108
198 +#: en/fsck.fat.8:107
199 msgid "Write changes to disk immediately."
203 -#: en/fsck.fat.8:108
204 +#: en/fsck.fat.8:107
210 -#: en/fsck.fat.8:110
211 +#: en/fsck.fat.8:109
213 "Same as B<-a> (automatically repair filesystem) for compatibility with other "
218 -#: en/fsck.fat.8:112
220 -"B<Note:> If B<-a> and B<-r> are absent, the filesystem is only checked, but "
225 -#: en/fsck.fat.8:113
226 +#: en/fsck.fat.8:110
232 -#: en/fsck.fat.8:114
233 +#: en/fsck.fat.8:111
239 -#: en/fsck.fat.8:116
240 +#: en/fsck.fat.8:113
241 msgid "No recoverable errors have been detected."
245 -#: en/fsck.fat.8:116
246 +#: en/fsck.fat.8:113
252 -#: en/fsck.fat.8:118
253 +#: en/fsck.fat.8:115
255 "Recoverable errors have been detected or B<fsck.fat> has discovered an "
256 "internal inconsistency."
260 -#: en/fsck.fat.8:118
261 +#: en/fsck.fat.8:115
267 -#: en/fsck.fat.8:120
268 +#: en/fsck.fat.8:117
269 msgid "Usage error. B<fsck.fat> did not access the filesystem."
273 -#: en/fsck.fat.8:121
274 +#: en/fsck.fat.8:118
280 -#: en/fsck.fat.8:122
281 +#: en/fsck.fat.8:119
283 msgid "fsck0000.rec, fsck0001.rec, ..."
287 -#: en/fsck.fat.8:124
288 +#: en/fsck.fat.8:121
290 "When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
291 "data into files named 'fsckNNNN.rec' in the top level directory of the "
292 @@ -516,13 +510,13 @@ msgid ""
296 -#: en/fsck.fat.8:125 en/mkfs.fat.8:75
297 +#: en/fsck.fat.8:122 en/mkfs.fat.8:75
303 -#: en/fsck.fat.8:127
304 +#: en/fsck.fat.8:124
306 "Does not create . and .. files where necessary. Does not remove entirely "
307 "empty directories. Should give more diagnostic messages. Undeleting files "
308 @@ -530,12 +524,12 @@ msgid ""
312 -#: en/fsck.fat.8:130 en/mkfs.fat.8:80
313 +#: en/fsck.fat.8:127 en/mkfs.fat.8:80
314 msgid "B<fatlabel>(8)"
318 -#: en/fsck.fat.8:135 en/mkfs.fat.8:85
319 +#: en/fsck.fat.8:132 en/mkfs.fat.8:85
321 "More information about B<fsck.fat> and B<dosfstools> can be found at "
322 "E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
323 diff --git a/manpages/pot/fsck.fat.8.pot b/manpages/pot/fsck.fat.8.pot
324 index e411819..f5ca313 100644
325 --- a/manpages/pot/fsck.fat.8.pot
326 +++ b/manpages/pot/fsck.fat.8.pot
330 "Project-Id-Version: dosfstools VERSION\n"
331 -"POT-Creation-Date: 2014-11-12 00:52+0100\n"
332 +"POT-Creation-Date: 2015-02-20 20:47+0100\n"
333 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
334 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
335 "Language-Team: LANGUAGE <LL@li.org>\n"
336 @@ -59,30 +59,30 @@ msgid "OPTIONS"
340 -#: en/fatlabel.8:41 en/fsck.fat.8:128 en/mkfs.fat.8:78
341 +#: en/fatlabel.8:41 en/fsck.fat.8:125 en/mkfs.fat.8:78
347 -#: en/fatlabel.8:45 en/fsck.fat.8:132
348 +#: en/fatlabel.8:45 en/fsck.fat.8:129
349 msgid "B<mkfs.fat>(8)"
353 -#: en/fatlabel.8:46 en/fsck.fat.8:133 en/mkfs.fat.8:83
354 +#: en/fatlabel.8:46 en/fsck.fat.8:130 en/mkfs.fat.8:83
360 -#: en/fatlabel.8:49 en/fsck.fat.8:136 en/mkfs.fat.8:86
361 +#: en/fatlabel.8:49 en/fsck.fat.8:133 en/mkfs.fat.8:86
367 -#: en/fatlabel.8:50 en/fsck.fat.8:137 en/mkfs.fat.8:87
368 +#: en/fatlabel.8:50 en/fsck.fat.8:134 en/mkfs.fat.8:87
370 "B<dosfstools> were written by Werner Almesberger E<lt>I<werner."
371 "almesberger@lrc.di.epfl.ch>E<gt>, Roman Hodek E<lt>I<Roman.Hodek@informatik."
372 @@ -368,31 +368,32 @@ msgid "B<-r>"
379 "Interactively repair the filesystem. The user is asked for advice whenever "
380 -"there is more than one approach to fix an inconsistency."
381 +"there is more than one approach to fix an inconsistency. This is the default "
382 +"mode and the option is only retained for backwards compatibility."
393 -#: en/fsck.fat.8:100
395 msgid "Mark unreadable clusters as bad."
399 -#: en/fsck.fat.8:100
406 -#: en/fsck.fat.8:102
407 +#: en/fsck.fat.8:101
409 "Try to undelete the specified file. B<fsck.fat> tries to allocate a chain of "
410 "contiguous unallocated clusters beginning with the start cluster of the "
411 @@ -400,24 +401,24 @@ msgid ""
415 -#: en/fsck.fat.8:102 en/mkfs.fat.8:72
416 +#: en/fsck.fat.8:101 en/mkfs.fat.8:72
422 -#: en/fsck.fat.8:104
423 +#: en/fsck.fat.8:103
424 msgid "Verbose mode. Generates slightly more output."
428 -#: en/fsck.fat.8:104
429 +#: en/fsck.fat.8:103
435 -#: en/fsck.fat.8:106
436 +#: en/fsck.fat.8:105
438 "Perform a verification pass. The filesystem check is repeated after the "
439 "first run. The second pass should never report any fixable errors. It may "
440 @@ -427,91 +428,84 @@ msgid ""
444 -#: en/fsck.fat.8:106
445 +#: en/fsck.fat.8:105
451 -#: en/fsck.fat.8:108
452 +#: en/fsck.fat.8:107
453 msgid "Write changes to disk immediately."
457 -#: en/fsck.fat.8:108
458 +#: en/fsck.fat.8:107
464 -#: en/fsck.fat.8:110
465 +#: en/fsck.fat.8:109
467 "Same as B<-a> (automatically repair filesystem) for compatibility with other "
472 -#: en/fsck.fat.8:112
474 -"B<Note:> If B<-a> and B<-r> are absent, the filesystem is only checked, but "
479 -#: en/fsck.fat.8:113
480 +#: en/fsck.fat.8:110
486 -#: en/fsck.fat.8:114
487 +#: en/fsck.fat.8:111
493 -#: en/fsck.fat.8:116
494 +#: en/fsck.fat.8:113
495 msgid "No recoverable errors have been detected."
499 -#: en/fsck.fat.8:116
500 +#: en/fsck.fat.8:113
506 -#: en/fsck.fat.8:118
507 +#: en/fsck.fat.8:115
509 "Recoverable errors have been detected or B<fsck.fat> has discovered an "
510 "internal inconsistency."
514 -#: en/fsck.fat.8:118
515 +#: en/fsck.fat.8:115
521 -#: en/fsck.fat.8:120
522 +#: en/fsck.fat.8:117
523 msgid "Usage error. B<fsck.fat> did not access the filesystem."
527 -#: en/fsck.fat.8:121
528 +#: en/fsck.fat.8:118
534 -#: en/fsck.fat.8:122
535 +#: en/fsck.fat.8:119
537 msgid "fsck0000.rec, fsck0001.rec, ..."
541 -#: en/fsck.fat.8:124
542 +#: en/fsck.fat.8:121
544 "When recovering from a corrupted filesystem, B<fsck.fat> dumps recovered "
545 "data into files named 'fsckNNNN.rec' in the top level directory of the "
546 @@ -519,13 +513,13 @@ msgid ""
550 -#: en/fsck.fat.8:125 en/mkfs.fat.8:75
551 +#: en/fsck.fat.8:122 en/mkfs.fat.8:75
557 -#: en/fsck.fat.8:127
558 +#: en/fsck.fat.8:124
560 "Does not create . and .. files where necessary. Does not remove entirely "
561 "empty directories. Should give more diagnostic messages. Undeleting files "
562 @@ -533,12 +527,12 @@ msgid ""
566 -#: en/fsck.fat.8:130 en/mkfs.fat.8:80
567 +#: en/fsck.fat.8:127 en/mkfs.fat.8:80
568 msgid "B<fatlabel>(8)"
572 -#: en/fsck.fat.8:135 en/mkfs.fat.8:85
573 +#: en/fsck.fat.8:132 en/mkfs.fat.8:85
575 "More information about B<fsck.fat> and B<dosfstools> can be found at "
576 "E<lt>I<http://daniel-baumann.ch/software/dosfstools/>E<gt>."
577 diff --git a/src/fsck.fat.c b/src/fsck.fat.c
578 index c073d9a..6c7fd87 100644
581 @@ -108,8 +108,8 @@ int main(int argc, char **argv)
582 uint32_t free_clusters = 0;
584 memset(&fs, 0, sizeof(fs));
585 - rw = salvage_files = verify = 0;
587 + salvage_files = verify = 0;
588 + rw = interactive = 1;
591 while ((c = getopt(argc, argv, "Aac:d:bflnprtu:vVwy")) != EOF)
592 @@ -169,7 +169,7 @@ int main(int argc, char **argv)
594 set_dos_codepage(-1); /* set default codepage if none was given in command line */
595 if ((test || write_immed) && !rw) {
596 - fprintf(stderr, "-t and -w require -a or -r\n");
597 + fprintf(stderr, "-t and -w can not be used in read only mode\n");
600 if (optind != argc - 1)