All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avoid recursing into dotdirs
@ 2006-09-14 18:30 Robert Millan
  2006-09-14 18:47 ` Marco Gerards
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Millan @ 2006-09-14 18:30 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]


grub-probefs used to recurse into /dev/.static, then come up with
/dev/.static/dev/hda as my root disk, which later fails to pass the
pathname-based checks that expect things like /dev/[hsf]d[0-9].

2006-09-14  Robert Millan  <rmh@aybabtu.com>

	* util/i386/pc/getroot.c:  Don't recurse into dotdirs (e.g. ".static").

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.

[-- Attachment #2: 03_avoid_recursing_into_dot_static.diff --]
[-- Type: text/plain, Size: 883 bytes --]

2006-09-14  Robert Millan  <rmh@aybabtu.com>

        * util/i386/pc/getroot.c:  Don't recurse into dotdirs (e.g. ".static").

Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v
retrieving revision 1.4
diff -u -r1.4 getroot.c
--- util/i386/pc/getroot.c	4 Apr 2004 13:46:03 -0000	1.4
+++ util/i386/pc/getroot.c	14 Sep 2006 17:36:24 -0000
@@ -160,9 +160,11 @@
 	/* Don't follow symbolic links.  */
 	continue;
       
-      if (S_ISDIR (st.st_mode))
+      if (S_ISDIR (st.st_mode) && ent->d_name[0] != '.')
 	{
-	  /* Find it recursively.  */
+	  /* Find it recursively, but avoid dotdirs (like ".static") since they
+          could contain duplicates, which would later break the pathname-based
+          check */
 	  char *res;
 
 	  res = find_root_device (ent->d_name, dev);

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

* Re: [PATCH] avoid recursing into dotdirs
  2006-09-14 18:30 [PATCH] avoid recursing into dotdirs Robert Millan
@ 2006-09-14 18:47 ` Marco Gerards
  2006-09-14 18:57   ` Robert Millan
  0 siblings, 1 reply; 3+ messages in thread
From: Marco Gerards @ 2006-09-14 18:47 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan <rmh@aybabtu.com> writes:

> grub-probefs used to recurse into /dev/.static, then come up with
> /dev/.static/dev/hda as my root disk, which later fails to pass the
> pathname-based checks that expect things like /dev/[hsf]d[0-9].
>
> 2006-09-14  Robert Millan  <rmh@aybabtu.com>
>
> 	* util/i386/pc/getroot.c:  Don't recurse into dotdirs (e.g. ".static").

There is a double space before "Don't", it should be a single space.

> -      if (S_ISDIR (st.st_mode))
> +      if (S_ISDIR (st.st_mode) && ent->d_name[0] != '.')
>  	{
> -	  /* Find it recursively.  */
> +	  /* Find it recursively, but avoid dotdirs (like ".static") since they
> +          could contain duplicates, which would later break the pathname-based
> +          check */

This looks fine, but funny.  I assume you are using tabs where there
should be spaces.  Can you please check that before committing?

--
Marco




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

* Re: [PATCH] avoid recursing into dotdirs
  2006-09-14 18:47 ` Marco Gerards
@ 2006-09-14 18:57   ` Robert Millan
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Millan @ 2006-09-14 18:57 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Sep 14, 2006 at 08:47:18PM +0200, Marco Gerards wrote:
> Robert Millan <rmh@aybabtu.com> writes:
> 
> > grub-probefs used to recurse into /dev/.static, then come up with
> > /dev/.static/dev/hda as my root disk, which later fails to pass the
> > pathname-based checks that expect things like /dev/[hsf]d[0-9].
> >
> > 2006-09-14  Robert Millan  <rmh@aybabtu.com>
> >
> > 	* util/i386/pc/getroot.c:  Don't recurse into dotdirs (e.g. ".static").
> 
> There is a double space before "Don't", it should be a single space.

Ok.

> > -      if (S_ISDIR (st.st_mode))
> > +      if (S_ISDIR (st.st_mode) && ent->d_name[0] != '.')
> >  	{
> > -	  /* Find it recursively.  */
> > +	  /* Find it recursively, but avoid dotdirs (like ".static") since they
> > +          could contain duplicates, which would later break the pathname-based
> > +          check */
> 
> This looks fine, but funny.  I assume you are using tabs where there
> should be spaces.  Can you please check that before committing?

Yep, I had it wrong.  Fixed now.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



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

end of thread, other threads:[~2006-09-14 18:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-14 18:30 [PATCH] avoid recursing into dotdirs Robert Millan
2006-09-14 18:47 ` Marco Gerards
2006-09-14 18:57   ` Robert Millan

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.