bug#13516: tests/rm/unread3 fails on Mac OS X 10.8

2013-01-28 Thread Global Odey

On 1/27/13 8:34 PM, Paul Eggert wrote:
Thanks, can you please try this patch instead? It's a bit more 
drastic, but I hope it fixes the loop without introducing that other bug.


Thank you. Your patch does the trick on OS X 10.8.2, however, it causes 
test-getcwd.sh to fail now.


Global Odey
FAIL: test-getcwd.sh


++ initial_cwd_=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests
++ fail=0
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests 
gt-test-getcwd.sh.
+++ case $# in
+++ destdir_=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests
+++ template_=gt-test-getcwd.sh.
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ case $template_ in
 unset TMPDIR
+++ d='/tmp/-p.sDffDhsB
gt-test-getcwd.sh.DI26'
+++ fail=1
+++ case $d in
+++ fail=1
+++ test -d '/tmp/-p.sDffDhsB
gt-test-getcwd.sh.DI26'
+++ fail=1
 ls -dgo '/tmp/-p.sDffDhsB
gt-test-getcwd.sh.DI26'
 tr S -
+++ perms=
+++ case $perms in
+++ fail=1
+++ test 1 = 0
 echo gt-test-getcwd.sh.
 sed 's/XX*$//'
+++ base_template_=gt-test-getcwd.sh.
 echo gt-test-getcwd.sh.
 wc -c
+++ template_length_='  23'
 echo gt-test-getcwd.sh.
 wc -c
+++ nx_='  19'
 expr 23 - 19
+++ nx_=4
+++ err_=
+++ i_=1
+++ :
 rand_bytes_ 4
 n_=4
 chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
 dev_rand_=/dev/urandom
 test -r /dev/urandom
 dd ibs=4 count=1 if=/dev/urandom
 LC_ALL=C
 tr -c abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 
01234567abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
 return
+++ X_=Bv7A
+++ 
candidate_dir_=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
 mkdir -m 0700 
/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
+++ err_=
+++ echo 
/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
+++ return
++ 
test_dir_=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
++ cd /var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
++ gl_init_sh_nl_='
'
++ IFS='
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ .
+ test 1 '!=' 0
+ path_dir_=.
+ case $path_dir_ in
+ abs_path_dir_=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/.
+ case $abs_path_dir_ in
+ 
PATH=/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/.:/usr/local/llvm-3.2/bin:/usr/local/bin:/usr/local/stage1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
+ create_exe_shims_ /var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/.
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ test-getcwd
+ Exit 47
+ set +e
+ exit 47
+ exit 47
+ remove_tmp_
+ __st=47
+ cleanup_
+ :
+ cd /var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests
+ chmod -R u+rwx 
/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
+ rm -rf 
/var/ac/bld/coreutils-8.20.103-bb116/gnulib-tests/gt-test-getcwd.sh.Bv7A
+ exit 47


Testsuite summary for GNU coreutils 8.20.103-bb116

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

See gnulib-tests/test-suite.log
Please report to bug-coreutils@gnu.org


bug#13495: Compilation fails on Mac OS X 10.8.0

2013-01-28 Thread Assaf Gordon
Paul Eggert wrote, On 01/25/2013 05:18 PM:
 On 01/25/2013 11:25 AM, Assaf Gordon wrote:
 
 So I'm guessing that even though gnulib's stpncpy code is used,
 because the MacOS's native declaration of stpncpy is included, it
 causes problems when the macro is expanded to use __stpncpy_chk.
 
 Does the following patch fix things for you?  It attempts to change
 the substitute string.h to inhibit that macro expansion.
 

No, doesn't work, on two levels:

1. This code isn't used - due to the combination of #if's.
The resulting lib/string.h contains:
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
   last non-NUL byte written into DST.  */
#if 1
# if 0 || (!0  defined stpncpy)
#  if !(defined __cplusplus  defined GNULIB_NAMESPACE)
#   undef stpncpy
#   define stpncpy rpl_stpncpy
#  endif
# endif

And this isn't used. I checked by adding an #error above the #undef - and 
it didn't trigger an error.

2. I took the two lines (undef+defined) and put them outside the #if's (and 
verified they were processed, using #error) - but they still did not fix the 
compilation error.







bug#13516: tests/rm/unread3 fails on Mac OS X 10.8

2013-01-28 Thread Assaf Gordon
Global Odey wrote, On 01/28/2013 12:55 PM:
 On 1/27/13 8:34 PM, Paul Eggert wrote:
 Thanks, can you please try this patch instead? It's a bit more drastic, but 
 I hope it fixes the loop without introducing that other bug.
 
 Thank you. Your patch does the trick on OS X 10.8.2, however, it causes 
 test-getcwd.sh to fail now.
 

Same for me, on Mac OS 10.6.8 (Darwin 10.8):
tests/rm/unread3 succeeds, but gnulib-tests/test-getcwd.sh fails with exit code 
47 .







bug#13516: tests/rm/unread3 fails on Mac OS X 10.8

2013-01-28 Thread Paul Eggert
On 01/28/2013 09:55 AM, Global Odey wrote:
 it causes test-getcwd.sh to fail now.

OK, how about the attached patch instead?
Unless you have developer tools such as autoconf, please
patch just lib/getcwd.c and gnulib-tests/test-getcwd.c;
don't apply the patch to getcwd-abort-bug.m4.
diff --git a/ChangeLog b/ChangeLog
index bb7a142..a8eb014 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2013-01-28  Paul Eggert  egg...@cs.ucla.edu
+
+   getcwd: break a recursive loop between fdopendir and save_cwd
+   Reported for Mac OS X 10.6.8 by Assaf Gordon in
+   http://bugs.gnu.org/13516.
+   * lib/getcwd.c (HAVE_OPENAT_SUPPORT): Do not define if
+   !HAVE_OPENAT  !HAVE_FDOPENDIR.
+   * m4/getcwd-abort-bug.m4: Reformat to match test-getcwd.c
+   so that they can be kept in sync more easily.  Avoid PATH_MAX
+   test on the Hurd.  Sync from test-getcwd.c for errno tests after
+   mkdir or chdir failure.
+   * tests/test-getcwd.c (HAVE_OPENAT_SUPPORT): New macro, from
+   lib/getcwd.c.
+   (test_abort_bug): Do not test for the deep directory bug unless we
+   have openat support.  Avoid PATH_MAX test on the Hurd.
+
 2013-01-27  Paul Eggert  egg...@cs.ucla.edu
 
futimens-tests, utimens-tests: Depend on gettext.
diff --git a/lib/getcwd.c b/lib/getcwd.c
index a4cbe01..4b78138 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -28,9 +28,9 @@
 #include fcntl.h /* For AT_FDCWD on Solaris 9.  */
 
 /* If this host provides the openat function or if we're using the
-   gnulib replacement function, then enable code below to make getcwd
-   more efficient and robust.  */
-#if defined HAVE_OPENAT || defined GNULIB_OPENAT
+   gnulib replacement function with a native fdopendir, then enable
+   code below to make getcwd more efficient and robust.  */
+#if defined HAVE_OPENAT || (defined GNULIB_OPENAT  defined HAVE_FDOPENDIR)
 # define HAVE_OPENAT_SUPPORT 1
 #else
 # define HAVE_OPENAT_SUPPORT 0
diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4
index a6ee6cd..9b3b563 100644
--- a/m4/getcwd-abort-bug.m4
+++ b/m4/getcwd-abort-bug.m4
@@ -58,16 +58,18 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
 int
 main ()
 {
-  char const *dir_name = confdir-14B---;
   char *cwd;
   size_t initial_cwd_len;
   int fail = 0;
-  size_t desired_depth;
-  size_t d;
 
   /* The bug is triggered when PATH_MAX  getpagesize (), so skip
  this relatively expensive and invasive test if that's not true.  */
-  if (getpagesize () = PATH_MAX)
+#ifdef PATH_MAX
+  int bug_possible = PATH_MAX  getpagesize ();
+#else
+  int bug_possible = 0;
+#endif
+  if (! bug_possible)
 return 0;
 
   cwd = getcwd (NULL, 0);
@@ -76,35 +78,43 @@ main ()
 
   initial_cwd_len = strlen (cwd);
   free (cwd);
-  desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
-   / (1 + strlen (dir_name)));
-  for (d = 0; d  desired_depth; d++)
+
+  if (1)
 {
-  if (mkdir (dir_name, S_IRWXU)  0 || chdir (dir_name)  0)
+  static char const dir_name[] = confdir-14B---;
+  size_t desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
+  / sizeof dir_name);
+  size_t d;
+  for (d = 0; d  desired_depth; d++)
 {
-  fail = 3; /* Unable to construct deep hierarchy.  */
-  break;
+  if (mkdir (dir_name, S_IRWXU)  0 || chdir (dir_name)  0)
+{
+  if (! (errno == ERANGE || errno == ENAMETOOLONG
+ || errno == ENOENT))
+fail = 3; /* Unable to construct deep hierarchy.  */
+  break;
+}
 }
-}
 
-  /* If libc has the bug in question, this invocation of getcwd
- results in a failed assertion.  */
-  cwd = getcwd (NULL, 0);
-  if (cwd == NULL)
-fail = 4; /* getcwd failed: it refuses to return a string longer
- than PATH_MAX.  */
-  free (cwd);
+  /* If libc has the bug in question, this invocation of getcwd
+ results in a failed assertion.  */
+  cwd = getcwd (NULL, 0);
+  if (cwd == NULL)
+fail = 4; /* getcwd didn't assert, but it failed for a long name
+ where the answer could have been learned.  */
+  free (cwd);
 
-  /* Call rmdir first, in case the above chdir failed.  */
-  rmdir (dir_name);
-  while (0  d--)
-{
-  if (chdir (..)  0)
+  /* Call rmdir first, in case the above chdir failed.  */
+  rmdir (dir_name);
+  while (0  d--)
 {
-  fail = 5;
-  break;
+  if (chdir (..)  0)
+{
+  fail = 5;
+  break;
+}
+  rmdir (dir_name);
 }
-  rmdir (dir_name);
 }
 
   return fail;
diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c
index 4b951e0..810b476 100644
--- a/tests/test-getcwd.c
+++ b/tests/test-getcwd.c
@@ -38,23 +38,29 @@
trigger a bug in glibc's getcwd implementation before 2.4.90-10.  */
 #define TARGET_LEN (5 * 1024)
 
+#if defined 

bug#13582: [PATCH] stat: add ext4 to the ext2/ext3 list

2013-01-28 Thread Mike Frysinger
Since ext4 returns the same info as ext2/ext3, add it to the list.
This fixes the output of running `stat -f / -c %T` on my system that
has an ext4 rootfs.

* src/stat.c (human_fstype): Add ext4 to the S_MAGIC_EXT2 and
FSTYPE_EXT2FS cases.
---
 src/stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/stat.c b/src/stat.c
index dd210d1..d3d7190 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -293,7 +293,7 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
 case S_MAGIC_EXT: /* 0x137D local */
   return ext;
 case S_MAGIC_EXT2: /* 0xEF53 local */
-  return ext2/ext3;
+  return ext2/ext3/ext4;
 case S_MAGIC_EXT2_OLD: /* 0xEF51 local */
   return ext2;
 case S_MAGIC_FAT: /* 0x4006 local */
@@ -480,7 +480,7 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
 case FSTYPE_MISC:
   return misc;
 case FSTYPE_EXT2FS:
-  return ext2/ext3;
+  return ext2/ext3/ext4;
 case FSTYPE_HTTP:
   return http;
 case FSTYPE_MEMFS:
-- 
1.8.0.2






bug#13582: [PATCH] stat: add ext4 to the ext2/ext3 list

2013-01-28 Thread Bob Proulx
Mike Frysinger wrote:
 Since ext4 returns the same info as ext2/ext3, add it to the list.
 This fixes the output of running `stat -f / -c %T` on my system that
 has an ext4 rootfs.
 
 * src/stat.c (human_fstype): Add ext4 to the S_MAGIC_EXT2 and
 FSTYPE_EXT2FS cases.

Previous discussion (wow, three years ago now):

  http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00160.html

Bob





bug#13582: [PATCH] stat: add ext4 to the ext2/ext3 list

2013-01-28 Thread Bernhard Voelker
tag 13582 + notabug
close 13582
stop

On 01/29/2013 07:13 AM, Mike Frysinger wrote:
 Since ext4 returns the same info as ext2/ext3, add it to the list.
 This fixes the output of running `stat -f / -c %T` on my system that
 has an ext4 rootfs.

Thanks for the patch, however, you submitted it to the bug-coreutils
mailing list which automatically opened a new ticket. Therefore, I'm
closing the bug (not intending to stop the discussion). Please use the
general discussion list coreut...@gnu.org next time.


Re. EXT4:
this has been discussed recently:
http://lists.gnu.org/archive/html/coreutils/2012-12/msg00068.html

Have a nice day,
Berny