public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory
@ 2012-07-19 22:02 Benoît Thébaudeau
  2012-07-20 13:20 ` [U-Boot] [PATCH v2 5/8] " Benoît Thébaudeau
  0 siblings, 1 reply; 5+ messages in thread
From: Benoît Thébaudeau @ 2012-07-19 22:02 UTC (permalink / raw)
  To: u-boot

With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular file

The previous code read the contents of file as if it were directory entries to
list. This patch refuses to list file contents as if it were a folder.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 .../fs/fat/fat.c                                   |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c
index fcce412..943cdb6 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -1105,11 +1105,11 @@ rootdir_done:
 			goto exit;
 		}
 
-		if (idx >= 0) {
-			if (!(dentptr->attr & ATTR_DIR))
-				goto exit;
+		if (isdir && !(dentptr->attr & ATTR_DIR))
+			goto exit;
+
+		if (idx >= 0)
 			subname = nextname;
-		}
 	}
 
 	ret = get_contents(mydata, dentptr, buffer, maxsize);

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

* [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory
  2012-07-19 22:02 [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory Benoît Thébaudeau
@ 2012-07-20 13:20 ` Benoît Thébaudeau
  2012-09-02 15:21   ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Benoît Thébaudeau @ 2012-07-20 13:20 UTC (permalink / raw)
  To: u-boot

With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular file

The previous code read the contents of file as if it were directory entries to
list. This patch refuses to list file contents as if it were a folder.

Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
---
Changes for v2:
 - Patch renumbering because of the new v2 1/8.
 - Possible code style changes due to the new v2 1/8.

 .../fs/fat/fat.c                                   |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c
index fbc2d7d..5d08948 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -1103,11 +1103,11 @@ rootdir_done:
 			goto exit;
 		}
 
-		if (idx >= 0) {
-			if (!(dentptr->attr & ATTR_DIR))
-				goto exit;
+		if (isdir && !(dentptr->attr & ATTR_DIR))
+			goto exit;
+
+		if (idx >= 0)
 			subname = nextname;
-		}
 	}
 
 	ret = get_contents(mydata, dentptr, buffer, maxsize);

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

* [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory
  2012-07-20 13:20 ` [U-Boot] [PATCH v2 5/8] " Benoît Thébaudeau
@ 2012-09-02 15:21   ` Wolfgang Denk
  2012-09-03 14:08     ` Benoît Thébaudeau
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2012-09-02 15:21 UTC (permalink / raw)
  To: u-boot

Dear Beno?t Th?baudeau,

In message <2017658963.332562.1342790429735.JavaMail.root@advansee.com> you wrote:
> With:
> fatls mmc 0 /dir/file
> dir: regular directory
> file: regular file
>
> The previous code read the contents of file as if it were directory entries to
> list. This patch refuses to list file contents as if it were a folder.

But this means that "fatls" on a plain file stops working?

This doesn't make sense to me.  Or what am I missing?


Patch skipped for now.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
At the source of every error which is blamed on the computer you will
find at least two human errors, including the error of blaming it  on
the computer.

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

* [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory
  2012-09-02 15:21   ` Wolfgang Denk
@ 2012-09-03 14:08     ` Benoît Thébaudeau
  2012-09-18 19:03       ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Benoît Thébaudeau @ 2012-09-03 14:08 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk,

On Sunday, September 2, 2012 5:21:15 PM, Wolfgang Denk wrote:
> Dear Beno?t Th?baudeau,
> 
> In message
> <2017658963.332562.1342790429735.JavaMail.root@advansee.com> you
> wrote:
> > With:
> > fatls mmc 0 /dir/file
> > dir: regular directory
> > file: regular file
> >
> > The previous code read the contents of file as if it were directory
> > entries to
> > list. This patch refuses to list file contents as if it were a
> > folder.
> 
> But this means that "fatls" on a plain file stops working?
> 
> This doesn't make sense to me.  Or what am I missing?

This already did not work before, because "fatls" is supposed to support only
directories:

$ help fatls
fatls - list files in a directory (default /)

Usage:
fatls <interface> <dev[:part]> [directory]
    - list files from 'dev' on 'interface' in a 'directory'

Best regards,
Beno?t

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

* [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory
  2012-09-03 14:08     ` Benoît Thébaudeau
@ 2012-09-18 19:03       ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2012-09-18 19:03 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 03, 2012 at 04:08:02PM +0200, Beno??t Th??baudeau wrote:
> Dear Wolfgang Denk,
> 
> On Sunday, September 2, 2012 5:21:15 PM, Wolfgang Denk wrote:
> > Dear Beno??t Th??baudeau,
> > 
> > In message
> > <2017658963.332562.1342790429735.JavaMail.root@advansee.com> you
> > wrote:
> > > With:
> > > fatls mmc 0 /dir/file
> > > dir: regular directory
> > > file: regular file
> > >
> > > The previous code read the contents of file as if it were directory
> > > entries to
> > > list. This patch refuses to list file contents as if it were a
> > > folder.
> > 
> > But this means that "fatls" on a plain file stops working?
> > 
> > This doesn't make sense to me.  Or what am I missing?
> 
> This already did not work before, because "fatls" is supposed to support only
> directories:
> 
> $ help fatls
> fatls - list files in a directory (default /)
> 
> Usage:
> fatls <interface> <dev[:part]> [directory]
>     - list files from 'dev' on 'interface' in a 'directory'

Note that ext2ls _also_ fails to ls files so we're being consistent as I
believe Wolfgang was expecting that *ls of a file would work like real
ls does, but that's not the case.  Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/92f842f0/attachment.pgp>

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

end of thread, other threads:[~2012-09-18 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 22:02 [U-Boot] [PATCH 4/7] FAT: Fix file contents listed as directory Benoît Thébaudeau
2012-07-20 13:20 ` [U-Boot] [PATCH v2 5/8] " Benoît Thébaudeau
2012-09-02 15:21   ` Wolfgang Denk
2012-09-03 14:08     ` Benoît Thébaudeau
2012-09-18 19:03       ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox