linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs
@ 2003-12-09  9:47 Domen Puncer
  2003-12-09 10:09 ` viro
  2003-12-09 16:28 ` Linus Torvalds
  0 siblings, 2 replies; 4+ messages in thread
From: Domen Puncer @ 2003-12-09  9:47 UTC (permalink / raw)
  To: Linux Kernel

Hi!

Played with scandir, and noticed iso9660's files d_type is always 0,
so here's a fix.

If there are no objections i'll try to fix some other filesystems too.

2.6.0-test11:
--- c/fs/isofs/dir.c	2003-08-23 01:58:53.000000000 +0200
+++ a/fs/isofs/dir.c	2003-12-09 10:29:21.000000000 +0100
@@ -230,7 +230,8 @@
 			}
 		}
 		if (len > 0) {
-			if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
+			if (filldir(dirent, p, len, filp->f_pos, inode_number,
+					(de->flags[0]&2)?DT_DIR:DT_REG) < 0)
 				break;
 		}
 		filp->f_pos += de_len;


2.4.23:
--- linux-2.4.23-clean/fs/isofs/dir.c	2002-02-25 20:38:08.000000000 +0100
+++ linux-2.4.23/fs/isofs/dir.c	2003-12-09 10:28:58.000000000 +0100
@@ -230,7 +230,8 @@
 			}
 		}
 		if (len > 0) {
-			if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
+			if (filldir(dirent, p, len, filp->f_pos, inode_number,
+					(de->flags[0]&2)?DT_DIR:DT_REG) < 0)
 				break;
 		}
 		filp->f_pos += de_len;


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

* Re: [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs
  2003-12-09  9:47 [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs Domen Puncer
@ 2003-12-09 10:09 ` viro
  2003-12-09 13:45   ` Domen Puncer
  2003-12-09 16:28 ` Linus Torvalds
  1 sibling, 1 reply; 4+ messages in thread
From: viro @ 2003-12-09 10:09 UTC (permalink / raw)
  To: Domen Puncer; +Cc: Linux Kernel

On Tue, Dec 09, 2003 at 10:47:32AM +0100, Domen Puncer wrote:
> Hi!
> 
> Played with scandir, and noticed iso9660's files d_type is always 0,
> so here's a fix.

No, it isn't.  DT_UNKNOWN is "I don't know; make no assumptions".
DT_REG is "regular file".  Returning it when object in question is
e.g. a symlink is wrong.

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

* Re: [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs
  2003-12-09 10:09 ` viro
@ 2003-12-09 13:45   ` Domen Puncer
  0 siblings, 0 replies; 4+ messages in thread
From: Domen Puncer @ 2003-12-09 13:45 UTC (permalink / raw)
  To: viro; +Cc: Linux Kernel

On Tuesday 09 of December 2003 11:09, viro@parcelfarce.linux.theplanet.co.uk wrote:
> On Tue, Dec 09, 2003 at 10:47:32AM +0100, Domen Puncer wrote:
> > Hi!
> >
> > Played with scandir, and noticed iso9660's files d_type is always 0,
> > so here's a fix.
>
> No, it isn't.  DT_UNKNOWN is "I don't know; make no assumptions".
> DT_REG is "regular file".  Returning it when object in question is
> e.g. a symlink is wrong.

Right, then how about this partial fix:
--- c/fs/isofs/dir.c	2003-08-23 01:58:53.000000000 +0200
+++ a/fs/isofs/dir.c	2003-12-09 14:37:45.000000000 +0100
@@ -230,7 +230,8 @@
 			}
 		}
 		if (len > 0) {
-			if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
+			if (filldir(dirent, p, len, filp->f_pos, inode_number,
+					(de->flags[0]&2)?DT_DIR:DT_UNKNOWN) < 0)
 				break;
 		}
 		filp->f_pos += de_len;


Or maybe we should read inode->i_mode, if it's not too time expensive?


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

* Re: [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs
  2003-12-09  9:47 [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs Domen Puncer
  2003-12-09 10:09 ` viro
@ 2003-12-09 16:28 ` Linus Torvalds
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2003-12-09 16:28 UTC (permalink / raw)
  To: Domen Puncer; +Cc: Linux Kernel



On Tue, 9 Dec 2003, Domen Puncer wrote:
>
> Played with scandir, and noticed iso9660's files d_type is always 0,
> so here's a fix.

Looks ok, but I can't convince myself to apply this at this point:
there's just not way I can call this a major stability fix ;). Can
somebody keep this around for later?

		Linus

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

end of thread, other threads:[~2003-12-09 16:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-09  9:47 [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs Domen Puncer
2003-12-09 10:09 ` viro
2003-12-09 13:45   ` Domen Puncer
2003-12-09 16:28 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).