forked from dosfstools/dosfstools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangeLog
3221 lines (2141 loc) · 104 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
commit cad2c17
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Jan 23 03:10:56 2017 +0100
fatlabel: Make sure printf style patterns in label are not expanded
Writing a label to an unlabeled filesystem involves creating a root
directory entry to contain the label. For this, the
alloc_rootdir_entry() function used for creating new directory nodes for
recovered orphan cluster chains is reused. However, this expects the
filename to be a printf style pattern to generate a unique name.
If the filesystem is unlabeled and the new label contains a printf
specifier other than %d or similar, the attempted expansion of the
pattern might crash fatlabel.
Change alloc_rootdir_entry() to take an additional argument gen_name and
only expand the name if its value is true.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 77371e2
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Nov 4 13:10:58 2016 +0100
testsuite: Add missing fsck test files to dist_check_DATA
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit d6df1d4
Author: Andreas Bombe <aeb@debian.org>
Date: Thu Nov 3 20:03:25 2016 +0100
testsuite: Test for bad characters in file names
The FAT16 test image contains four files with three errors. One has a
space in the name, one a space in the extension and one contains '>' in
the name.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 307966c
Author: Andreas Bombe <aeb@debian.org>
Date: Sun Sep 18 00:11:43 2016 +0200
fsck: Fix reporting of length to truncate with shared clusters
When files share clusters and one of the two files has been selected to
truncate fsck reports which file has been selected and the length to
which it will be truncated. All code paths erronously printed the length
of the file that was not going to be truncated, leading to possible user
confusion.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit b33424e
Author: Andreas Bombe <aeb@debian.org>
Date: Sat Sep 17 23:34:07 2016 +0200
testsuite: Test for files sharing clusters
The FAT32 test image contains three files. One shares a cluster with the
root directory and the other two share clusters among themselves.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit db5ec04
Author: Andreas Bombe <aeb@debian.org>
Date: Sat Sep 17 22:41:07 2016 +0200
testsuite: Run fsck in test-mkfs
Now the test-mkfs script also runs fsck on the created image to test its
basic operation. The test fails if fsck reports seeing an error.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 4ac17ae
Author: Andreas Bombe <aeb@debian.org>
Date: Sat Sep 17 22:25:06 2016 +0200
Fix FAT32 FSInfo signature checking
In commit 7444694 the definition of struct info_sector was corrected to
match the FSInfo sector specification. The initialization was adapted,
but other places were missed. All runs of fsck would then incorrectly
report a signature error on the FSInfo sector.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit e883d07
Author: Nico Roeser <nico@n1c0.de>
Date: Fri Sep 16 20:05:08 2016 +0200
mkfs: Bring back ability to set sector size.
This had accidently been broken when the code was overhauled, resulting
in unconditionally setting the sector size when devinfo detected it.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 4ef83db
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 16 03:32:12 2016 +0200
Request minimum automake version 1.11 and add workaround for <1.13
Before automake 1.13, parallel-tests wasn't the default set it
explicitly in the automake options list. The parallel test harness was
introduced in 1.11 therefore that is the minimum now.
However, the AM_TESTS_ENVIRONMENT variable was only starting to work in
1.13, so there is now a version check and a conditional assignment to
TESTS_ENVIRONMENT (which should be for user setting only) in case
automake is 1.11 or 1.12.
Without it, the fact of xxd being found is not passed to the test
scripts which then skip all tests due to perceived lack of xxd.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 6a8c8b7
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 16 01:45:17 2016 +0200
Add missing autoreconf step to Travis CI configuration
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 54f7aef
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 16 01:39:08 2016 +0200
Add configuration for the Travis CI build service
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 5421752
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Sep 14 20:37:57 2016 +0200
Check and fix printf style arguments to die() and pdie()
Add the "format" gcc style attribute to the declarations of die() and
pdie() so that the compiler knows how to check their arguments for
correctness.
Fix all problematic calls detected by this.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 83e5ec5
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Sep 14 03:38:08 2016 +0200
Make some implicit integer conversions safer
Coverity reports a few places where signed or short integers are
promoted to int and then extended to long which might cause unintended
sign extension. Given the context (being sector sizes and similar) the
values should never actually reach unsafe values, but this patch cleans
it up anyway.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ff5e718
Author: Andreas Bombe <aeb@debian.org>
Date: Tue Sep 13 20:25:34 2016 +0200
mkfs: Remove redundant unreachable warning message
At some point the check for too many clusters for user requested FAT16
was moved a few lines above. The original location can only be reached
when the cluster count is too low for FAT16 which means the too many
clusters message can not be triggered there.
Found through the dead code detection of Coverity Scan.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit e359a33
Author: Andreas Bombe <aeb@debian.org>
Date: Tue Sep 13 20:12:21 2016 +0200
Fix octal character parsing in file_cvt()
Apparently the octal code parsing got rewritten into a loop at some
point while the rest of the code was not removed. It was impossible to
specify an octal character code without the function returning an error.
This affected the -u and -d options for fsck.
Found through the dead code detection of Coverity Scan.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ccd0a9d
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 12 20:21:53 2016 +0200
testsuite: Test for circular cluster chain
The test image contains a file four clusters in length where the third
cluster has been modified to point back to the second cluster.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit fab40f8
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 12 19:51:10 2016 +0200
Fix truncation logic in circular chain check
When scanning for circular chains, the first FAT entry that appeared a
second time in a chain should cause the previous cluster to be the
termination of the chain.
To that end, test_file() keeps variables to point to the previous
cluster and the current number of clusters. When the -t option is given,
all clusters are checked to be readable and skipped (variables not
updates) in test_file() when they are not.
The problem was that the variables were updated only when the read check
succeeded. If the -t option is not given, that check does not happen and
the variables keep their initial value. The circular chain fix would
then always truncate to zero length and fail to update the free cluster
count, requiring a second fsck run.
Fix by updating these variables unconditionally when -t option is not
given.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 8394ceb
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 12 14:39:11 2016 +0200
testsuite: Test for too long cluster chain
The test image contains a file marked as 7 bytes in length (just a small
part of 1 cluster) in the directory entry that has 2 clusters assigned
to it in the FAT.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 7444694
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Sep 7 21:09:41 2016 +0200
Fix definition and initialization of fsinfo sector
Change the definition of the fsinfo struct to be more in line with the
official definition, in particular make the trailing signature field 32
bit instead of 16 bit. During initialization in init_fsinfo(), first
clear the whole struct to zero before setting fields, to make sure
reserved fields are zeroed.
Fixes #33.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit f78cb68
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Sep 7 20:45:29 2016 +0200
Add fsck testsuite
Add the framework for a fsck testsuite and a few tests, including a test
for the yet unimplemented check for misordered dot/dotdot directory
entries.
The test driver runs fsck twice on a given image and fails the test if
the first run does not detect an error or the second run still detects
an error.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 7667295
Author: Andreas Bombe <aeb@debian.org>
Date: Tue May 31 03:32:42 2016 +0200
Add testsuite foundations
Add testsuite on the basis of the automake framework. As a start, three
tests for basic mkfs functionality compare mkfs generated images against
references images.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit f881195
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Sep 7 03:48:16 2016 +0200
Append +git to version number in configure.ac
Don't let dosfstools compiled from git with additional commits show the
exact release version number.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 8788615
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date: Thu Jun 30 08:43:50 2016 +0200
Add config.guess and config.sub to gitignore
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 39ab842
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date: Thu Jun 30 08:41:51 2016 +0200
Use autoconf to look for OS X endian include.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 69ac2b0
Author: Alessio Sergi <al3hex@gmail.com>
Date: Fri May 6 18:18:18 2016 +0200
src/device_info.c: Fix undefined PATH_MAX under musl
In musl libc, PATH_MAX is defined in <limits.h>.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 744db84
Author: Lars Wendler <polynomial-c@gentoo.org>
Date: Tue May 10 09:47:57 2016 +0200
Don't link to udev via LDFLAGS. There's LDADD for such a task.
See also:
https://www.gnu.org/software/automake/manual/html_node/Linking.html
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 1e76e57
Author: Andreas Bombe <aeb@debian.org>
Date: Wed May 11 03:44:58 2016 +0200
mkfs: Default to 64/32 heads/sectors for targets smaller than 512 MB
This may put defaults in certain use cases a little bit more in line
with the old defaults in versions up to 3.0.28. It has mostly aesthetic
value in most cases.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 786e66e (tag: v4.0)
Author: Andreas Bombe <aeb@debian.org>
Date: Fri May 6 03:19:07 2016 +0200
Releasing version 4.0.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit a79ff90
Author: Andreas Bombe <aeb@debian.org>
Date: Fri May 6 02:34:42 2016 +0200
src/Makefile.am: Fix CPPFLAGS for VPATH builds
The -I flag to add the blkdev subdir to the include search path is now
relative to $(srcdir) to allow VPATH builds to work. Additionally move
the -I flag from the mkfs_fat and testdevinfo CFLAGS to CPPFLAGS where
it actually belongs.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit e8eff14
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Apr 27 21:38:37 2016 +0200
read_boot(): Handle excessive FAT size specifications
The variable used for storing the FAT size (in bytes) was an unsigned
int. Since the size in sectors read from the BPB was not sufficiently
checked, this could end up being zero after multiplying it with the
sector size while some offsets still stayed excessive. Ultimately it
would cause segfaults when accessing FAT entries for which no memory
was allocated.
Make it more robust by changing the types used to store FAT size to
off_t and abort if there is no room for data clusters. Additionally
check that FAT size is not specified as zero.
Fixes #25 and fixes #26.
Reported-by: Hanno Böck
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 016800e
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Apr 27 14:16:53 2016 +0200
Use variable total_fat_entries in read_boot() for readability
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit a6478d8
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date: Fri Apr 8 12:20:46 2016 +0200
Add missing iconv library for OS X
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ce67dc6
Author: Álvaro Fernández Rojas <noltari@gmail.com>
Date: Fri Apr 8 12:20:27 2016 +0200
Add endian support for OS X
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 08f3869
Author: Joel Holdsworth <joel.holdsworth@vcatechnology.com>
Date: Thu Mar 10 00:53:07 2016 +0000
Configure option to disable building with libudev
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ed4e47b
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Feb 22 03:47:14 2016 +0100
Remove use of PATH_MAX in path_name()
The length of a file path on the checked filesystem has no relation to
the maximum path length of the system fsck is running on. So replace it
with a constant of our own.
As a bonus this will not fail compilation on a system without PATH_MAX.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit b1a38ab
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 17 21:04:35 2016 +0100
Add preliminary entry for release 4.0 to NEWS
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 4ad3e9e
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 17 21:02:06 2016 +0100
Adjust ridiculous source indentation in io.c
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit b96acb2
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 17 20:51:53 2016 +0100
Document ./configure --enable-compat-symlinks in README
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit de39c5c
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 17 15:16:27 2016 +0100
Add include paths.h in the HAVE_DECL_GETMNTENT case
_PATH_MOUNTED is now used for getmntent() in place of MOUNTED because
the latter was marked as a deprecated alias in glibc's mntent.h. The
mntent.h of musl libc does not include the _PATH_MOUNTED however. Fix
this by including paths.h alongside mntent.h
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 86c7acd
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 17 15:06:56 2016 +0100
man fsck: Document the -c option
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ef9a73c
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Feb 15 02:10:57 2016 +0100
Add NEWS file with changes of the last two releases
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit bda6551
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Feb 12 03:56:16 2016 +0100
Make filesystem mounted check portable
A new function is_device_mounted() in device_info.c is now used by
check_mount() in mkfs.fat.c. It contains the getmntent() using code
used before in check_mount() and now an alternative using getmntinfo()
as found on the BSDs.
In case neither function is available, is_device_mounted() defaults to
reporting that the device isn't mounted.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 4b8c9cc
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Feb 12 01:57:33 2016 +0100
Make use of endian.h portable to BSD
The endian.h found on Linux and the BSDs appear to be compatible, but
they are found in different locations. Add tests in configure.ac and a
new endian_compat.h file that has the logic to include the correct
files.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit d7665f2
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 10 21:30:06 2016 +0100
Fix format string in check_file() (%lu → %llu)
The cluster chain length printing needs a 64 bit calculation, so we can
just use unsigned long long instead of uint64_t and use the format
string %llu.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 6225e59
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Feb 5 14:39:00 2016 +0100
blkdev.c: Prevent unused parameter warnings in fallback code
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 34cdded
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Feb 5 14:36:14 2016 +0100
blkdev_get_size(): Remove unused variable ch
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 5571d29
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 10 03:22:19 2016 +0100
Reinstate alignment of FAT32 structures to cluster size
This reverts commits 17c956cb9 and d63e0d627 where the alignment was
removed because it created problems with a device that refused to read
the aligned filesystem. The option -a is already provided to disable
alignment in order to handle such cases.
This change brings it back in line with FAT12/16 where alignment wasn't
disabled and brings consistency with the current command line options,
where only the option to disable alignment exists but no opposite option
to enable it.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 2c71ace
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 3 03:38:33 2016 +0100
Makefile.am: Add historic documentation to distribution
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit bcbae63
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 3 02:38:24 2016 +0100
src/Makefile.am: Add forgotten msdos_fs.h to mkfs_fat_SOURCES
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 19d1a13
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 3 02:34:51 2016 +0100
Remove sys/ioctl.h and linux/fd.h include from io.c
These weren't used anymore and the linux/fd.h include would
gratuitously cause compilation to fail on non-Linux environments.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit f691660
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Feb 3 02:31:00 2016 +0100
Reinstate some #include <sys/types.h>
These shouldn't have been removed in commit 245d0cce5. Put them back for
correctness even though the definitions were pulled in implicitly.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 51afd41
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Jan 27 21:38:29 2016 +0100
src/Makefile.am: Put all header files in appropriate _SOURCES variables
With the headers missing the dist targets of the automake generated
Makefiles would not include them and make the resulting dist
unbuildable.
Also combine sources collections into common variables for
deduplication.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit bf6f142
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Jan 27 15:28:42 2016 +0100
mkfs man: Note that sector sizes > 4096 are non-standard
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit ea96c32
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Jan 25 21:30:23 2016 +0100
mkfs: Improve parsing of bad blocks file
The bad blocks file that can be given to mkfs via the -l option had a
very simplistic design. It failed to notice it was parsing an empty
line and would report errors for that.
Replace it with a more robust version that ignores empty lines as well
as leading and trailing white space. Additionally it produces meaningful
error messages.
GitHub: Fixes #17
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit dfb5bea
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Jan 25 02:47:12 2016 +0100
mkfs: Limit filesystem size on targets that are too large
For FAT filesystems, the number of sectors has to fit into a 32 bit
variable. Previously this was not checked possibly causing invalid
filesystems to be generated.
Now there is a check for that case which will limit the number of
sectors if needed and print a warning that disk space will be left
unused in that case.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit fc0343f
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Jan 22 21:29:20 2016 +0100
mkfs: Improved bounds checking in mark_FAT_sector()/mark_FAT_cluster()
In mark_FAT_sector() the sector number itself is now checked against
limits instead of the computed cluster number. Even with sector number
before the start of the data area, the cluster number may be valid for
the first cluster due to dividing by the cluster size.
Both functions now check for upper limits and should prevent writing
past the valid end of the FAT.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 9211c8a
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Jan 15 02:17:16 2016 +0100
mkfs: Fix offset error in FAT12/16 bad cluster marking
The root directory wasn't factored in to the calculation of the data
area start sector. On FAT32 the root directory is in the data area, but
for FAT12 and FAT16 it is a reserved space before the start of the data
area.
On FAT12 and FAT16, this resulted in the wrong clusters being marked
during bad blocks mapping, whether from check_blocks() or from reading
the user supplied bad blocks file.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 0627a62
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Jan 15 01:59:59 2016 +0100
mkfs: Fix off-by-2 error in bad cluster marking
mark_FAT_sector(), which has the mark_sector_bad() macro as its sole
user, computed the cluster number corresponding to the sector by taking
its offset from the first data sector and dividing by sectors per
cluster.
What it missed was that the first data cluster is number 2 and not 0.
This meant all marks were off by 2 and when the first two clusters are
supposed to be marked, it would overwrite the reserved cluster values
and create an invalid filesystem.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 2dca9aa
Author: Andreas Bombe <aeb@debian.org>
Date: Thu Jan 14 14:43:00 2016 +0100
.gitignore: Add .dirstamp
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 6a966fb
Author: Andreas Bombe <aeb@debian.org>
Date: Thu Jan 14 14:38:53 2016 +0100
mkfs: Reword non-standard sector size warning
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit bebc9ac
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Dec 30 15:10:35 2015 +0100
Clean up includes in mkfs.fat.c
Moving the device probing out into device_info.c removed the need for a
number of includes in mkfs.fat.c. Remove them and add a define for
BLOCK_SIZE, which was the only thing used from linux/fs.h.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 12a1d46
Author: Andreas Bombe <aeb@debian.org>
Date: Sun Nov 29 01:59:10 2015 +0100
Don't use pointer to first member when more of the struct gets copied
Where a fs_write() of "first 13 bytes of directory entry" is intended,
actually use pointer to directory entry structure instead of the 11
byte name field at the beginning.
This does not change how the code works, it is just a clean up.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit d38bd2d
Author: Andreas Bombe <aeb@debian.org>
Date: Sun Nov 29 00:44:48 2015 +0100
Remove name/extension split in directory entry structures
Both the DIR_ENT structure in fsck.fat.h and the msdos_dir_entry in
msdos_fs.h - these represent the on disk format of directory entries -
had the name field split into name[8] followed by ext[3].
By far the most operations on name are on the full name including
extension and they treated the name field as an 11 byte array. This is
an array overflow that worked because the structs have the attribute
packed and the extension field is following right after.
Nevertheless, this is not clean C and the merging of both fields
actually simplified the code in a few places.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 0847e4c
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Nov 27 21:29:49 2015 +0100
Free allocated strings after use
There are multiple calls to cnv_unicode() in lfn.c which returns an
allocated string. Most had the appropriate free() calls after printing
the strings. Add the missing two calls where memory was leaked.
Found by Coverity.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 1b7d91e
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Nov 27 03:34:51 2015 +0100
Add test for and include linux/hdreg.h in blkdev.c
Before, blkdev did not include it and depended on its own fallback
definition of the ioctl and struct hd_geometry.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 5024372
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Nov 27 03:28:14 2015 +0100
Add FDGETPRM attempt to blkdev_get_geometry()
If HDIO_GETGEO isn't available or has failed, try FDGETPRM. This should
get the geometry from floppy drivers where HDIO_GETGEO isn't supported.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 4a146d7
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Nov 27 03:25:55 2015 +0100
Add blkdev_get_start() for getting partition start offset
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 254f8ab
Author: Andreas Bombe <aeb@debian.org>
Date: Thu Nov 26 23:33:02 2015 +0100
Remove use of libblkid again
It appears libblkid is not as widely available as presumed, since some
platforms only have the original libblkid included in e2fsprogs which
lacks the needed functionality. This commit removes the requirement and
use of libblkid.
As a replacement, blkdev.c from util-linux is included, which offers the
required basic functionality in a portable way.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit c9fb33c
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Oct 21 21:32:30 2015 +0200
Use just device size not major number in Atari mode
In Atari mode, read_boot() in boot.c used the device major number to
determine whether to use FAT12. It would always use FAT12 for a floppy,
otherwise only if it is a RAM disk or loopback device and has a size
corresponding to standard floppy formats.
Since this check was already broken for a long time (another place that
assumed 8 bit major numbers) and there is no real point to make the
distinction based on device, this commit reduces the check to just
compare against standard floppy sizes.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 64486ad
Author: Andreas Bombe <aeb@debian.org>
Date: Wed Oct 21 00:18:22 2015 +0200
Remove loff_t and llseek()
There appear to have been multiple conversions to 64 bit file offsets on
32 bit architectures in dosfstools over the years, but today with the
proper setup off_t is 64 bits and simple lseek() can be used. The
AC_SYS_LARGEFILE macro in configure.ac does what is required to make
that happen.
Given this, convert all uses of loff_t to off_t, remove llseek()
definitions and change llseek() calls to plain lseek().
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit e03a5f4
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Oct 16 21:47:04 2015 +0200
Remove DJGPP support
These macros have been added back when dosfstools was around version 2.
It is difficult to say whether these are still working correctly or
whether they are in use at all. FreeDOS appears to still show version
2.11 of dosfstools in their software directory.
Supporting actual MS-DOS or compatible may need more work in the
current state of things and this DJGPP support can be removed until
then.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 5b9a88d
Author: Andreas Bombe <aeb@debian.org>
Date: Thu Oct 8 16:17:22 2015 +0200
mkfs.fat: Complete overhaul of device probing
The device probing in mkfs.fat is used to get device parameters where
needed and also to decide whether to refuse overwriting a device due to
possible user error. This code has suffered severe bitrot and is highly
Linux specific. Highlights include using hardcoded major/minor device
numbers to classify a device, and using 8 bits major/minor numbers that
have become obsolete a long time ago and thus often misidentifying a
device.
The overhauled implementation is now in src/device_info.c and makes use
of libudev (optional, recommended) and libblkid (required) to probe the
device and where Linux ioctls are required it provides fallbacks and
does not attempt to call these on non-Linux systems. The FAT parameter
selection has been unified and simplified in the process.
A new executable testdevinfo has been added that gets built but not
automatically installed. It takes one file name, uses the same probing
as mkfs.fat would with verbose messages enabled and displays the
results.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 53eddfc
Author: Andreas Bombe <aeb@debian.org>
Date: Sat Sep 12 02:54:33 2015 +0200
Die on out of range cluster values in set_fat()/get_fat()
To prevent bugs caused by FAT corruption inside fsck to go unnoticed,
add a check against out of range requested cluster values in get_fat()
and against out of range cluster to change and new cluster value in
set_fat().
When an invalid cluster value is detected, these functions now die()
with an "internal error" message.
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 456767b
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 14 00:33:49 2015 +0200
configure.ac: Use AS_HELP_STRING to format option help
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 3cfb479
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 14 00:30:40 2015 +0200
version.h: Use @configure_input@ autoconf variable in boilerplate
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 41ef834
Author: Andreas Bombe <aeb@debian.org>
Date: Mon Sep 14 00:29:27 2015 +0200
.gitignore: Add TAGS in addition to tags
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit bdc3d2a
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 11 20:28:12 2015 +0200
Rename clusters field in DOS_FS struct
Rename it to data_clusters to prevent mistaking the clusters field of
the DOS_FS struct as the total number of FAT entries instead of the
number of data clusters (two less than the number of entries).
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 0790812
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 11 19:47:29 2015 +0200
set_fat(): Fix off-by-2 error leading to corruption in FAT12
In FAT12 two 12 bit entries are combined to a 24 bit value (three
bytes). Therefore, when an even numbered FAT entry is set in FAT12, it
must be be combined with the following entry. To prevent accessing
beyond the end of the FAT array, it must be checked that the cluster is
not the last one.
Previously, the check tested that the requested cluster was equal to
fs->clusters - 1. However, fs->clusters is the number of data clusters
not including the two reserved FAT entries at the start so the test
triggered two clusters early.
If the third to last entry was written on a FAT12 filesystem with an
odd number of clusters, the second to last entry would be corrupted.
This corruption may also lead to invalid memory accesses when the
corrupted entry becomes out of bounds and is used later.
Change the test to fs->clusters + 1 to fix.
Reported-by: Hanno Böck
Signed-off-by: Andreas Bombe <aeb@debian.org>
commit 39ce90f
Author: Andreas Bombe <aeb@debian.org>
Date: Fri Sep 11 19:34:10 2015 +0200