bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] lstat/stat


From: Derek Robert Price
Subject: [Bug-gnulib] lstat/stat
Date: Tue, 27 May 2003 10:35:56 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02

I've attached a patch for the lstat half of the stat replacements.

The main problem this addresses is that on systems where lstat has problems with trailing slashes, AC_LIBOBJ(lstat) is called by AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, which is called via AC_FUNC_LSTAT. The jm_FUNC_LSTAT macro used to check an sh variable set by AC_FUNC_LSTAT before calling gl_PREREQ_STAT and miss the case where AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK found the problem. This causes compiler errors when compiling lib/stat.c since the gl_PREREQ_LSTAT macro was never called.

I also tweaked stat.c to not compile the slash-safe lstat unless configure actually detected that the system didn't treat slashes as we'd like.

The patch is against the CVS tree, but it should apply to GNULIB without a problem since the layout is the same.


Index: lib/ChangeLog
===================================================================
RCS file: /cvs/ccvs/lib/ChangeLog,v
retrieving revision 1.184
diff -u -r1.184 ChangeLog
--- lib/ChangeLog       20 May 2003 18:56:28 -0000      1.184
+++ lib/ChangeLog       20 May 2003 22:07:30 -0000
@@ -1,5 +1,10 @@
2003-05-20  Derek Price  <address@hidden>

+       * stat.c: Don't compile LSTAT code unless configure detected that we
+       need to be trailing-slash-safe.
+
+2003-05-20  Derek Price  <address@hidden>
+
        * Makefile.in: Regenerated.

2003-05-20  Derek Price  <address@hidden>
Index: lib/stat.c
===================================================================
RCS file: /cvs/ccvs/lib/stat.c,v
retrieving revision 1.1
diff -u -r1.1 stat.c
--- lib/stat.c  19 May 2003 22:05:54 -0000      1.1
+++ lib/stat.c  20 May 2003 22:07:30 -0000
@@ -27,7 +27,7 @@
#ifndef errno
extern int errno;
#endif
-#ifdef LSTAT
+#if defined( LSTAT ) && !defined( LSTAT_FOLLOWS_SLASHED_SYMLINK )
# include <string.h>

# if HAVE_STDLIB_H
@@ -94,7 +94,7 @@

  return lstat_result;
}
-#endif /* LSTAT */
+#endif /* LSTAT && !LSTAT_FOLLOWS_SLASHED_SYMLINK */

/* This is a wrapper for stat/lstat.
   If FILE is the empty string, fail with errno == ENOENT.
@@ -109,7 +109,11 @@

#ifdef LSTAT
# define rpl_xstat rpl_lstat
-# define xstat_return_val(F, S) slash_aware_lstat (F, S)
+# ifdef LSTAT_FOLLOWS_SLASHED_SYMLINK
+#   define xstat_return_val(F, S) lstat (F, S)
+# else /* !LSTAT_FOLLOWS_SLASHED_SYMLINK */
+#   define xstat_return_val(F, S) slash_aware_lstat (F, S)
+# endif /* LSTAT_FOLLOWS_SLASHED_SYMLINK */
#else
# define rpl_xstat rpl_stat
# define xstat_return_val(F, S) stat (F, S)
Index: m4/ChangeLog
===================================================================
RCS file: /cvs/ccvs/m4/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- m4/ChangeLog        20 May 2003 18:50:16 -0000      1.6
+++ m4/ChangeLog        20 May 2003 22:07:30 -0000
@@ -1,5 +1,10 @@
2003-05-20  Derek Price  <address@hidden>

+       * lstat.m4 (jm_FUNC_LSTAT): Add check for the lstat directory with a
+       trailing slash bug.
+
+2003-05-20  Derek Price  <address@hidden>
+
        * acx_with_external_zlib.m4 (--with-external-zlib): New file with new
        ACX_WITH_SYSTEM_VLIB function to use the system's installed version of
        zlib library.
Index: m4/lstat.m4
===================================================================
RCS file: /cvs/ccvs/m4/lstat.m4,v
retrieving revision 1.1
diff -u -r1.1 lstat.m4
--- m4/lstat.m4 19 May 2003 22:05:36 -0000      1.1
+++ m4/lstat.m4 20 May 2003 22:07:30 -0000
@@ -13,7 +13,11 @@
[
  AC_FUNC_LSTAT
  dnl Note: AC_FUNC_LSTAT does AC_LIBOBJ(lstat).
-  if test $ac_cv_func_lstat_empty_string_bug = yes; then
+  dnl
+  dnl It might be possible (and hopefully less code) to scan LIBOBJ here
+  dnl rather than checking multiple cache variables.  I just plain don't know.
+  if test $ac_cv_func_lstat_empty_string_bug = yes ||
+     test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
    gl_PREREQ_LSTAT
  fi
])



Derek

--
               *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!
--
Man who live in glass house dress in basement.






reply via email to

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