fs: fat: fix fat iteration
PATCH 1/1 fs: fat: fix fat iteration
According to the FAT specification it is valid to have files with an attribute value of 0x0. This fixes a regression where different U-Boot versions are showing different amount of files on the same storage device. With this change U-Boot shows the same number of files and folders as Linux and Windows.
--- fs/fat/fat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/fat/fat.c +1 -3
@@ -949,9 +949,7 @@ static int fat_itr_next(fat_itr *itr)/* Volume label or VFAT entry, skip */ continue ; } - }else if (!(dent->attr &ATTR_ARCH ) && - !(dent->attr &ATTR_DIR )) -continue ; + }/* short file name */ break ;
Signature · 1 line
2.26.2
PATCH 1/1 fs: fat: fix fat iteration
Quoted 8 lines · Christian Gmeiner
According to the FAT specification it is valid to have files with an attribute value of
0x0. This fixes a regression where different U-Boot versions are showing different amount of files on the same storage device. With this change U-Boot shows the same number of files and folders as Linux and Windows.Fixes 39606d462c ("fs: fat: handle deleted directory entries correctly")Signed-off-by Christian Gmeiner <[email protected]>
Thanks for reporting and resolving the issue.
Could you, please, provide a test image to reproduce the issue.
Further it would be helpful to add a test case in test/py/tests/test_fs.
Best regards
Heinrich
Quoted 20 lines
--- fs/fat/fat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/fat/fat.c +1
-3@@ -949,9 +949,7 @@ static int fat_itr_next(fat_itr *itr)/* Volume label or VFAT entry, skip */ continue ; } - }else if (!(dent->attr &ATTR_ARCH ) && - !(dent->attr &ATTR_DIR )) -continue ; + }/* short file name */ break ;
PATCH 1/1 fs: fat: fix fat iteration
Hi
Am Di., 9. Juni 2020 um 09:19 Uhr schrieb Heinrich Schuchardt <[email protected]>:
Quoted 8 lines · Christian Gmeiner
Quoted 6 lines
According to the FAT specification it is valid to have files with an attribute value of
0x0. This fixes a regression where different U-Boot versions are showing different amount of files on the same storage device. With this change U-Boot shows the same number of files and folders as Linux and Windows.
Quoted 7 lines
Quoted 2 lines
Fixes 39606d462c ("fs: fat: handle deleted directory entries correctly")Signed-off-by Christian Gmeiner <[email protected]>Thanks for reporting and resolving the issue.
Could you, please, provide a test image to reproduce the issue.
What are the requirements for such a test image?
Quoted 2 lines
Further it would be helpful to add a test case in test/py/tests/test_fs.
I can try it but I have almost no overview on how to do it.
Quoted 26 lines
Best regards
Heinrich
Quoted 20 lines
--- fs/fat/fat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/fat/fat.c +1
-3@@ -949,9 +949,7 @@ static int fat_itr_next(fat_itr *itr)/* Volume label or VFAT entry, skip */ continue ; } - }else if (!(dent->attr &ATTR_ARCH ) && - !(dent->attr &ATTR_DIR )) -continue ; + }/* short file name */ break ;
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info/privacypolicy
PATCH 1/1 fs: fat: fix fat iteration
Quoted 15 lines · Christian Gmeiner
Hi
Am Di., 9. Juni 2020 um 09:19 Uhr schrieb Heinrich Schuchardt <[email protected]>:
Quoted 11 lines · Christian Gmeiner
Quoted 8 lines
According to the FAT specification it is valid to have files with an attribute value of
0x0. This fixes a regression where different U-Boot versions are showing different amount of files on the same storage device. With this change U-Boot shows the same number of files and folders as Linux and Windows.Fixes 39606d462c ("fs: fat: handle deleted directory entries correctly")Signed-off-by Christian Gmeiner <[email protected]>
Quoted 6 lines
Quoted 4 lines
Thanks for reporting and resolving the issue.
Could you, please, provide a test image to reproduce the issue.
What are the requirements for such a test image?
I am looking for a file with a FAT file system that I can mount on Linux and later in U-Boot to see that it is correct in Linux but appears corrupted in U-Boot without your patch.
When thinking about a test case it would be even better if you could provide the sequence of commands that creates such an image file, e.g.
dd if=/dev/zero of=test.img bs=64k count=1
mkfs.vfat test.img
mkdir mnt
mount test.img mnt
mkdir mnt/foo
touch mnt/bar
rmdir mnt/foo
ls mnt -la
umount mnt
For testing we can use the sandbox:
make sandbox_defconfig
./u-boot
host bind 1 test.img
ls host 1:0
The sequence above does not show the problem. Here we need your experience.
Best regards
Heinrich
Quoted 34 lines
Quoted 3 lines
Further it would be helpful to add a test case in test/py/tests/test_fs.
I can try it but I have almost no overview on how to do it.
Quoted 26 lines
Best regards
Heinrich
Quoted 20 lines
--- fs/fat/fat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/fat/fat.c +1
-3@@ -949,9 +949,7 @@ static int fat_itr_next(fat_itr *itr)/* Volume label or VFAT entry, skip */ continue ; } - }else if (!(dent->attr &ATTR_ARCH ) && - !(dent->attr &ATTR_DIR )) -continue ; + }/* short file name */ break ;
PATCH 1/1 fs: fat: fix fat iteration
In reply to Christian GmeinerQuoted 8 lines · Christian Gmeiner
According to the FAT specification it is valid to have files with an attribute value of
0x0. This fixes a regression where different U-Boot versions are showing different amount of files on the same storage device. With this change U-Boot shows the same number of files and folders as Linux and Windows.Fixes 39606d462c ("fs: fat: handle deleted directory entries correctly")Signed-off-by Christian Gmeiner <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200707/73f4d191/attachment.sig>