All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: fat: fix fat iteration
@ 2020-06-09  7:09 Christian Gmeiner
  2020-06-09  7:19 ` Heinrich Schuchardt
  2020-07-07 16:55 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Gmeiner @ 2020-06-09  7:09 UTC (permalink / raw)
  To: u-boot

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 <christian.gmeiner@gmail.com>
---
 fs/fat/fat.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 7fd29470c1..9578b74bae 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -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;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] fs: fat: fix fat iteration
  2020-06-09  7:09 [PATCH] fs: fat: fix fat iteration Christian Gmeiner
@ 2020-06-09  7:19 ` Heinrich Schuchardt
  2020-06-09  9:35   ` Christian Gmeiner
  2020-07-07 16:55 ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2020-06-09  7:19 UTC (permalink / raw)
  To: u-boot

On 09.06.20 09:09, Christian Gmeiner wrote:
> 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 <christian.gmeiner@gmail.com>

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

> ---
>  fs/fat/fat.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index 7fd29470c1..9578b74bae 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -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;
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: fat: fix fat iteration
  2020-06-09  7:19 ` Heinrich Schuchardt
@ 2020-06-09  9:35   ` Christian Gmeiner
  2020-06-09 10:00     ` Heinrich Schuchardt
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Gmeiner @ 2020-06-09  9:35 UTC (permalink / raw)
  To: u-boot

Hi

Am Di., 9. Juni 2020 um 09:19 Uhr schrieb Heinrich Schuchardt
<xypron.glpk@gmx.de>:
>
> On 09.06.20 09:09, Christian Gmeiner wrote:
> > 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 <christian.gmeiner@gmail.com>
>
> 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?

> 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.

> Best regards
>
> Heinrich
>
> > ---
> >  fs/fat/fat.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> > index 7fd29470c1..9578b74bae 100644
> > --- a/fs/fat/fat.c
> > +++ b/fs/fat/fat.c
> > @@ -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;
> >
>
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: fat: fix fat iteration
  2020-06-09  9:35   ` Christian Gmeiner
@ 2020-06-09 10:00     ` Heinrich Schuchardt
  0 siblings, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2020-06-09 10:00 UTC (permalink / raw)
  To: u-boot

On 09.06.20 11:35, Christian Gmeiner wrote:
> Hi
>
> Am Di., 9. Juni 2020 um 09:19 Uhr schrieb Heinrich Schuchardt
> <xypron.glpk@gmx.de>:
>>
>> On 09.06.20 09:09, Christian Gmeiner wrote:
>>> 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 <christian.gmeiner@gmail.com>
>>
>> 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

>
>> 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.
>
>> Best regards
>>
>> Heinrich
>>
>>> ---
>>>  fs/fat/fat.c | 4 +---
>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
>>> index 7fd29470c1..9578b74bae 100644
>>> --- a/fs/fat/fat.c
>>> +++ b/fs/fat/fat.c
>>> @@ -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;
>>>
>>
>>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: fat: fix fat iteration
  2020-06-09  7:09 [PATCH] fs: fat: fix fat iteration Christian Gmeiner
  2020-06-09  7:19 ` Heinrich Schuchardt
@ 2020-07-07 16:55 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-07-07 16:55 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 09, 2020 at 09:09:07AM +0200, Christian Gmeiner wrote:

> 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 <christian.gmeiner@gmail.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-07 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09  7:09 [PATCH] fs: fat: fix fat iteration Christian Gmeiner
2020-06-09  7:19 ` Heinrich Schuchardt
2020-06-09  9:35   ` Christian Gmeiner
2020-06-09 10:00     ` Heinrich Schuchardt
2020-07-07 16:55 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.