same-inode: revert prior change; it is not yet ready
authorEric Blake <ebb9@byu.net>
Thu, 24 Sep 2009 11:51:28 +0000 (05:51 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 24 Sep 2009 11:52:00 +0000 (05:52 -0600)
This reverts commit b5eb8386645bf1bcfafa63c729ff9a86454def87.

* NEWS: Undo mention of this change.
* lib/same-inode.h (same-inode.h): Undo tri-state change.
* lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
* lib/cycle-check.c (cycle_check): Likewise.
* lib/same.c (same_name): Likewise.
* lib/at-func2.c (at_func2): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/at-func2.c
lib/cycle-check.c
lib/cycle-check.h
lib/same-inode.h
lib/same.c

index 855e69d..697d2c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-24  Eric Blake  <ebb9@byu.net>
+
+       same-inode: revert prior change; it is not yet ready
+       * NEWS: Undo mention of this change.
+       * lib/same-inode.h (same-inode.h): Undo tri-state change.
+       * lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
+       * lib/cycle-check.c (cycle_check): Likewise.
+       * lib/same.c (same_name): Likewise.
+       * lib/at-func2.c (at_func2): Likewise.
+
 2009-09-23  Eric Blake  <ebb9@byu.net>
 
        linkat: new module
diff --git a/NEWS b/NEWS
index 87fc884..62c631f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,9 +6,6 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
-2009-09-23  same-inode      The macro SAME_INODE is now tri-state, adding -1
-                            for unknown.
-
 2009-09-16  canonicalize-lgpl
                             The include file is changed from "canonicalize.h"
                             to <stdlib.h>.
index a19b60b..e3cfc7f 100644 (file)
@@ -132,7 +132,7 @@ at_func2 (int fd1, char const *file1,
           errno = ENOTDIR;
           return -1;
         }
-      if (SAME_INODE (st1, st2) == 1) /* Reduced to cases 1, 5.  */
+      if (SAME_INODE (st1, st2)) /* Reduced to cases 1, 5.  */
         return func (file1, file2);
     }
   else if (fd2 == AT_FDCWD) /* Cases 12, 13.  */
@@ -144,7 +144,7 @@ at_func2 (int fd1, char const *file1,
           errno = ENOTDIR;
           return -1;
         }
-      if (SAME_INODE (st1, st2) == 1) /* Reduced to cases 4, 5.  */
+      if (SAME_INODE (st1, st2)) /* Reduced to cases 4, 5.  */
         return func (file1, file2);
     }
   else if (fd1 != fd2) /* Case 15b.  */
@@ -156,10 +156,10 @@ at_func2 (int fd1, char const *file1,
           errno = ENOTDIR;
           return -1;
         }
-      if (SAME_INODE (st1, st2) == 1) /* Reduced to case 15a.  */
+      if (SAME_INODE (st1, st2)) /* Reduced to case 15a.  */
         {
           fd2 = fd1;
-          if (stat (".", &st1) == 0 && SAME_INODE (st1, st2) == 1)
+          if (stat (".", &st1) == 0 && SAME_INODE (st1, st2))
             return func (file1, file2); /* Further reduced to case 5.  */
         }
     }
@@ -172,7 +172,7 @@ at_func2 (int fd1, char const *file1,
           errno = ENOTDIR;
           return -1;
         }
-      if (stat (".", &st2) == 0 && SAME_INODE (st1, st2) == 1)
+      if (stat (".", &st2) == 0 && SAME_INODE (st1, st2))
         return func (file1, file2); /* Reduced to case 5.  */
     }
 
index a5b6df1..e120460 100644 (file)
@@ -1,7 +1,6 @@
 /* help detect directory cycles efficiently
 
-   Copyright (C) 2003, 2004, 2005, 2006, 2009 Free Software
-   Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -63,7 +62,7 @@ cycle_check (struct cycle_check_state *state, struct stat const *sb)
   /* If the current directory ever happens to be the same
      as the one we last recorded for the cycle detection,
      then it's obviously part of a cycle.  */
-  if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino) == 1)
+  if (state->chdir_counter && SAME_INODE (*sb, state->dev_ino))
     return true;
 
   /* If the number of `descending' chdir calls is a power of two,
index ea9b9c4..ee3bf21 100644 (file)
@@ -1,6 +1,6 @@
 /* help detect directory cycles efficiently
 
-   Copyright (C) 2003, 2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ bool cycle_check (struct cycle_check_state *state, struct stat const *sb);
       /* You must call cycle_check at least once before using this macro.  */ \
       if ((State)->chdir_counter == 0)                         \
         abort ();                                              \
-      if (SAME_INODE ((State)->dev_ino, SB_subdir) == 1)       \
+      if (SAME_INODE ((State)->dev_ino, SB_subdir))            \
        {                                                       \
          (State)->dev_ino.st_dev = (SB_dir).st_dev;            \
          (State)->dev_ino.st_ino = (SB_dir).st_ino;            \
index 4b89dd1..0632711 100644 (file)
@@ -1,6 +1,6 @@
 /* Determine whether two stat buffers refer to the same file.
 
-   Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #ifndef SAME_INODE_H
 # define SAME_INODE_H 1
 
-/* Perform a tri-state query on whether STAT_BUF_1 and STAT_BUF_2
-   represent the same file.  Return 1 for equal, 0 for distinct, and
-   -1 for indeterminate (the latter is generally possible only on
-   mingw).  Algorithms that use this macro must be prepared to handle
-   the indeterminate case without wrong results.  For example, if an
-   optimization is possible if two files are the same but unsafe if
-   distinct, use SAME_INODE()==1; whereas for an optimization that is
-   possible only for distinct files, use !SAME_INODE().  */
-
 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
-   (((Stat_buf_1).st_ino == (Stat_buf_2).st_ino         \
-     && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)     \
-    ? 1 - 2 * !(Stat_buf_1).st_ino : 0)
+   ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
+    && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
 
 #endif
index 5251fb8..af3a95e 100644 (file)
@@ -1,7 +1,7 @@
 /* Determine whether two file names refer to the same file.
 
-   Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-   2009 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free
+   Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -97,9 +97,6 @@ same_name (const char *source, const char *dest)
        }
 
       same = SAME_INODE (source_dir_stats, dest_dir_stats);
-      if (same < 0)
-       same = (identical_basenames
-               && strcmp (source_basename, dest_basename) == 0);
 
 #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
       if (same && ! identical_basenames)