[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: root-dev-ino.c limitation

From: Eric Blake
Subject: Re: root-dev-ino.c limitation
Date: Sat, 11 Mar 2006 08:22:40 -0700
User-agent: Thunderbird 1.5 (Windows/20051201)

Hash: SHA1

According to Jim Meyering on 3/3/2006 9:53 AM:
> Why do you want to merge this change with the
> already-big basename/dirname one?

OK, I'll send the root-dev-ino patch separately from the basename/dirname one.

> Thanks, this does look good.
> Would you please keep the bug-fix separate, and include
> a test for it, if possible?

The bug is present only when xgetcwd fails to determine that you are in /;
then robust_getcwd kicks in, determines that you are already at the root,
and was prepending "/" to "/" resulting in "//".  The fix is to prepend
"/" to "", but I don't see how it is possible to write a test without the
use of a debugger (since if xgetcwd fails to determine you are in /, your
system has major problems).

2006-03-11  Eric Blake  <address@hidden>

        * src/pwd.c (robust_getcwd): Prepend only one slash, not two.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

Index: src/pwd.c
RCS file: /sources/coreutils/coreutils/src/pwd.c,v
retrieving revision 1.59
diff -u -p -r1.59 pwd.c
--- src/pwd.c   26 Feb 2006 10:02:49 -0000      1.59
+++ src/pwd.c   11 Mar 2006 15:19:04 -0000
@@ -279,8 +279,9 @@ robust_getcwd (struct file_name *file_na
       find_dir_entry (&dot_sb, file_name, height++);
+  /* See if a leading slash is needed; file_name_prepend adds one.  */
   if (file_name->start[0] == '\0')
-    file_name_prepend (file_name, "/", 1);
+    file_name_prepend (file_name, "", 0);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]