[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] changes imported from coreutils
From: |
Paul Eggert |
Subject: |
[bug-gnulib] changes imported from coreutils |
Date: |
Mon, 21 Mar 2005 12:51:33 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
I installed these minor fixes/changes from coreutils into gnulib:
2005-03-21 Jim Meyering <address@hidden>
* lib/cycle-check.c: Don't include xalloc.h.
* lib/path-concat.c: Don't include assert.h.
(path_concat): Remove assertion that would have triggered
for ABASE starting with more than one slash.
Reported by Andreas Schwab.
* lib/path-concat.c (path_concat): Set *BASE_IN_RESULT
properly when ABASE is an absolute file name.
Correct the description of this function.
Include <assert.h>.
Add an assertion and a test driver.
This fixes a bug introduced on 2004-07-02.
Andreas Schwab reported the resulting failure of cp --parents:
http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00130.html
* m4/chdir-long.m4 (gl_PREREQ_CHDIR_LONG): Invoke gl_FUNC_MEMRCHR.
* m4/memrchr.m4 (gl_FUNC_MEMRCHR): Check for memrchr decl.
2005-03-21 Paul Eggert <address@hidden>
* modules/chdir-long (Depends-on): Add mempcpy.
Index: lib/cycle-check.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/cycle-check.c,v
retrieving revision 1.1
diff -p -u -r1.1 cycle-check.c
--- lib/cycle-check.c 5 Aug 2004 23:52:18 -0000 1.1
+++ lib/cycle-check.c 21 Mar 2005 20:42:43 -0000
@@ -1,6 +1,6 @@
/* help detect directory cycles efficiently
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 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
@@ -32,7 +32,6 @@
#include <stdbool.h>
#include "cycle-check.h"
-#include "xalloc.h"
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
Index: lib/path-concat.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/path-concat.c,v
retrieving revision 1.19
diff -p -u -r1.19 path-concat.c
--- lib/path-concat.c 6 Aug 2004 04:48:31 -0000 1.19
+++ lib/path-concat.c 21 Mar 2005 20:42:43 -0000
@@ -1,6 +1,6 @@
/* path-concat.c -- concatenate two arbitrary pathnames
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -54,8 +54,10 @@ longest_relative_suffix (char const *f)
Arrange for a directory separator if necessary between DIR and BASE
in the result, removing any redundant separators.
In any case, if BASE_IN_RESULT is non-NULL, set
- *BASE_IN_RESULT to point to the copy of BASE in the returned
- concatenation.
+ *BASE_IN_RESULT to point to the copy of ABASE in the returned
+ concatenation. However, if ABASE begins with more than one slash,
+ set *BASE_IN_RESULT to point to the sole corresponding slash that
+ is copied into the result buffer.
Report an error if memory is exhausted. */
@@ -78,10 +80,47 @@ path_concat (char const *dir, char const
p += needs_separator;
if (base_in_result)
- *base_in_result = p;
+ *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase);
p = mempcpy (p, base, baselen);
*p = '\0';
return p_concat;
}
+
+#ifdef TEST_PATH_CONCAT
+#include <stdlib.h>
+#include <stdio.h>
+int
+main ()
+{
+ static char const *const tests[][3] =
+ {
+ {"a", "b", "a/b"},
+ {"a/", "b", "a/b"},
+ {"a/", "/b", "a/b"},
+ {"a", "/b", "a/b"},
+
+ {"/", "b", "/b"},
+ {"/", "/b", "/b"},
+ {"/", "/", "/"},
+ {"a", "/", "a/"}, /* this might deserve a diagnostic */
+ {"/a", "/", "/a/"}, /* this might deserve a diagnostic */
+ {"a", "//b", "a/b"},
+ };
+ size_t i;
+ bool fail = false;
+ for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
+ {
+ char *base_in_result;
+ char const *const *t = tests[i];
+ char *res = path_concat (t[0], t[1], &base_in_result);
+ if (strcmp (res, t[2]) != 0)
+ {
+ printf ("got %s, expected %s\n", res, t[2]);
+ fail = true;
+ }
+ }
+ exit (fail ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+#endif
Index: m4/chdir-long.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/chdir-long.m4,v
retrieving revision 1.1
diff -p -u -r1.1 chdir-long.m4
--- m4/chdir-long.m4 18 Jan 2005 21:58:11 -0000 1.1
+++ m4/chdir-long.m4 21 Mar 2005 20:42:43 -0000
@@ -1,4 +1,4 @@
-#serial 4
+#serial 5
# Use Gnulib's robust chdir function.
# It can handle arbitrarily long directory names, which means
@@ -6,7 +6,7 @@
# never fails with ENAMETOOLONG.
# Arrange to compile chdir-long.c only on systems that define PATH_MAX.
-dnl Copyright (C) 2004 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -38,4 +38,5 @@ AC_DEFUN([gl_PREREQ_CHDIR_LONG],
AM_STDBOOL_H
gl_FUNC_MEMPCPY
gl_FUNC_OPENAT
+ gl_FUNC_MEMRCHR
])
Index: m4/memrchr.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/memrchr.m4,v
retrieving revision 1.4
diff -p -u -r1.4 memrchr.m4
--- m4/memrchr.m4 3 Feb 2005 20:38:14 -0000 1.4
+++ m4/memrchr.m4 21 Mar 2005 20:42:44 -0000
@@ -11,6 +11,8 @@ AC_DEFUN([gl_FUNC_MEMRCHR],
dnl Persuade glibc <string.h> to declare memrchr().
AC_REQUIRE([AC_GNU_SOURCE])
+ AC_CHECK_DECLS_ONCE([memrchr])
+
AC_REPLACE_FUNCS(memrchr)
if test $ac_cv_func_memrchr = no; then
gl_PREREQ_MEMRCHR
Index: modules/chdir-long
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/chdir-long,v
retrieving revision 1.3
diff -p -u -r1.3 chdir-long
--- modules/chdir-long 3 Feb 2005 20:38:14 -0000 1.3
+++ modules/chdir-long 21 Mar 2005 20:42:44 -0000
@@ -8,6 +8,7 @@ m4/chdir-long.m4
Depends-on:
openat
+mempcpy
memrchr
configure.ac:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gnulib] changes imported from coreutils,
Paul Eggert <=