lib/canonicalize-lgpl.c


Log

Author Commit Date CI Message
Paul Eggert b2a1529e 2017-07-30T15:38:56 canonicalize: fix EOVERFLOW commentary Problem reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00147.html * lib/canonicalize.c (canonicalize_filename_mode): * lib/canonicalize-lgpl.c (__realpath): Fix comments.
Paul Eggert 1dc82a77 2017-07-30T13:06:41 Don't interpret EOVERFLOW to mean nonexistence * lib/fts.c (fts_stat): If lstat fails, report its errno, which may be EOVERFLOW; this is likely more useful than reporting the stat errno. * lib/glob.c (link_stat): Rename from link_exists2_p and return -1/0 instead of 0/1. Caller changed. * lib/glob.c (link_exists_p): * lib/renameat2.c (rename_noreplace, renameat2): * lib/tempname.c (try_nocreate): If errno == EOVERFLOW then the directory entry exists, so do not act as if it does not exist.
Bruno Haible b55a085b 2017-06-07T15:23:38 canonicalize-lgpl: Avoid conflict with gnulib 'getcwd' module on VMS. Reported by John E. Malmberg <wb8tyw@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00029.html>. * lib/canonicalize-lgpl.c (__getcwd): On VMS, when using gnulib's getcwd override, pass 2 arguments to getcwd, not 3.
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Pádraig Brady b5393eae 2016-10-20T11:28:07 canonicalize-lgpl: fix for missing SIZE_MAX on older systems * lib/canonicalize-lgpl.c [SIZE_MAX]: Define if needed. Needed on Centos <= 4.
Bruno Haible 794b3480 2016-10-14T02:49:05 canonicalize-lgpl: Support the case path_max > INT_MAX. * lib/canonicalize-lgpl.c (__realpath): Declare n as ssize_t, not int.
Paul Eggert 5155e7c0 2016-08-18T11:56:07 canonicalize-lgpl: fix errno after malloca fails This fixes a typo I recently introduced. Suggested by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00039.html * lib/canonicalize-lgpl.c (__realpath): Don't assume malloca sets errno on failure.
Paul Eggert 52b63a0f 2016-08-17T15:01:50 getdelim: remove dependency on realloc-posix * lib/canonicalize-lgpl.c (alloc_failed) [!FUNC_REALPATH_WORKS || defined _LIBC]: New function, (__realpath) [!FUNC_REALPATH_WORKS || defined _LIBC]: Use it. Use __set_errno where needed, for consistency. * lib/getdelim.c (alloc_failed): New function. (getdelim): Use it. * modules/getdelim (Depends-on): Remove realloc-posix.
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert b9bfe784 2015-01-01T01:38:23 version-etc: new year * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
Eric Blake 1276a2c5 2014-01-01T00:04:40 maint: update copyright I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 49adc728 2013-02-11T14:58:56 unsetenv etc.: port to Solaris 11 + GNU Emacs * lib/canonicalize-lgpl.c, lib/getaddrinfo.c, lib/getdelim.c: * lib/glob.c, lib/random_r.c, lib/setenv.c, lib/tsearch.c: * lib/unsetenv.c (_GL_ARG_NONNULL): Define before including <config.h>. GNU Emacs's <config.h> includes <stdlib.h> (which is not a great idea but is too painful to fix right now), and without this gnulib change <stdlib.h> was defining _GL_ARG_NONNULL incorrectly when compiling unsetenv.c on Solaris 11. Fix the problem for unsetenv.c, and fix other similar occurrences.
Eric Blake 9fc81090 2013-01-01T00:50:58 maint: update all copyright year number ranges Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
Eli Zaretskii b15e506d 2012-12-10T14:52:22 canonicalize, canonicalize-lgpl: Microsoft Windows prefix fixes * lib/canonicalize.c (canonicalize_filename_mode): * lib/canonicalize-lgpl.c (__realpath): Recompute prefix_len after fetching the current directory. Don't overrun the beginning of rpath if there's no slashes after the MS-Windows drive letter.
Eli Zaretskii 86627bb1 2012-11-20T13:47:22 canonicalize, canonicalize-lgpl: support MS-Windows file names See <http://lists.gnu.org/archive/html/bug-gnulib/2012-11/msg00074.html> for test cases, which it'd be nice to add at some point. * lib/canonicalize.c, lib/canonicalize-lgpl.c: Include dosname.h. * lib/canonicalize.c (canonicalize_filename_mode): * lib/canonicalize-lgpl.c (__realpath): Use FILE_SYSTEM_PREFIX_LEN instead of assuming that the first slash is at the beginning of the file name. Use ISSLASH, instead of a literal '/'. Use IS_ABSOLUTE_FILE_NAME instead of comparing the first character with '/'. Test for DOUBLE_SLASH_IS_DISTINCT_ROOT only if the file name does not begin with a drive letter. * lib/canonicalize.c (SLASHES): New macro. (canonicalize_filename_mode): Use SLASHES instead of a literal "/".
Eric Blake 04b6c2e5 2012-02-04T11:11:40 canonicalize: avoid uninitialized memory use When DOUBLE_SLASH_IS_DISTINCT_ROOT is non-zero, then we were reading the contents of rpath[1] even when we had never written anything there, which meant that "///" would usually canonicalize to "/" but sometimes to "//" if a '/' was leftover in the heap. This condition could also occur via 'ln -s / //some/path' and canonicalizing //some/path, where we rewind rpath but do not clear out the previous round. Platforms where "//" and "/" are equivalent do not suffer from this read-beyond-written bounds. * lib/canonicalize-lgpl.c (__realpath): Avoid possibility of random '/' left in dest. * lib/canonicalize.c (canonicalize_filename_mode): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 306a127c 2012-02-04T10:03:29 canonicalize-lgpl: fix // handling Same as the previous patch, for the lgpl version. * lib/canonicalize-lgpl.c (__realpath): Don't convert /// to //. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 51e801f2 2012-01-05T23:53:49 In commentary, do not use ` to quote.
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Bruno Haible ff4fa73a 2011-08-05T03:04:06 canonicalize-lgpl: Support larger filenames on the Hurd. * lib/canonicalize-lgpl.c (__realpath): Bump path_max fallback to 8192. Reported by Paul Eggert.
Paul Eggert bb9960c4 2011-04-08T11:34:08 * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Bruno Haible 63d392e0 2010-08-28T11:12:58 Avoid relocwrapper link errors due to gnulib replacement functions.
Bruno Haible fc06be3f 2010-06-09T12:47:59 Avoid relocwrapper link errors due to gnulib replacement functions.
Eric Blake 2b08ed06 2010-04-28T10:13:24 canonicalize-lgpl: avoid compiler warning * lib/canonicalize-lgpl.c (versioned_symbol): Avoid an 'empty declaration' / 'extraneous semicolon' warning with some compilers. Reported by Andreas Gruenbacher. Signed-off-by: Eric Blake <eblake@redhat.com>
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Bruno Haible 69482508 2009-12-11T01:15:28 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
Eric Blake 35bd2ff7 2009-09-10T17:21:09 canonicalize, canonicalize-lgpl: honor // if distinct from / * modules/canonicalize (Files): Add double-slash-root.m4. * modules/canonicalize-lgpl (Files): Likewise. * m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE) (gl_CANONICALIZE_LGPL_SEPARATE): Add dependency. * lib/canonicalize.c (DOUBLE_SLASH_IS_DISTINCT_ROOT): Provide fallback definition. (canonicalize_filename_mode): Use it to protect //. * lib/canonicalize-lgpl.c (DOUBLE_SLASH_IS_DISTINCT_ROOT) (__realpath): Likewise. * tests/test-canonicalize.c (main): Test this. * tests/test-canonicalize-lgpl.c (main): Likewise. * modules/canonicalize-tests (Depends-on): Add same-inode. * modules/canonicalize-lgpl-tests (Depends-on): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 4e793c35 2009-09-11T13:57:55 canonicalize-lgpl: fix glibc bug with trailing slash Consolidate the m4 macros into a single file, since both modules now have to worry about replacing canonicalize_file_name on buggy glibc. * m4/canonicalize-lgpl.m4: Move contents... * m4/canonicalize.m4: ...here. (gl_CANONICALIZE_LGPL): Factor realpath check... (gl_FUNC_REALPATH_WORKS): ...into new macro. Enhance to catch glibc 2.3.5 bug, fixed 2005-04-27. (gl_FUNC_CANONICALIZE_FILENAME_MODE): Use it. (gl_PREREQ_CANONICALIZE_LGPL): Inline... (gl_CANONICALIZE_LGPL_SEPARATE): ...into this macro. * modules/canonicalize-lgpl (Files): Manage file rename. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide default. * modules/stdlib (Makefile.am): Substitute witness. * lib/stdlib.in.h (canonicalize_file_name): Declare if replacement is needed. * lib/canonicalize-lgpl.c: Also compile if canonicalize_file_name replacement is required. * lib/canonicalize.c (canonicalize_file_name): Likewise. * doc/glibc-functions/canonicalize_file_name.texi (canonicalize_file_name): Document this. * doc/posix-functions/realpath.texi (realpath): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 1d43c4ae 2009-09-11T13:31:06 canonicalize-lgpl: reject non-directory with trailing slash This synchronizes glibc to gnulib. For gnulib to glibc, see: http://sources.redhat.com/bugzilla/show_bug.cgi?id=10635 * lib/canonicalize-lgpl.c (__realpath): Synchronize with glibc. * tests/test-canonicalize-lgpl.c (main): Enhance test. This catches failures in glibc 2.3.5. * tests/test-canonicalize.c (main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 240faa59 2009-09-10T15:44:15 canonicalize-lgpl: use native realpath if it works Forward-looking to when more platforms comply with POSIX 2008, but don't provide glibc extensions. For example, this could fix // handling in cygwin 1.7 (well, if cygwin didn't have bugs in .. handling). canonicalize can't use native realpath, for the same reason that it does not use resolvepath. * lib/canonicalize-lgpl.c (realpath): Guard with FUNC_REALPATH_WORKS. * lib/stdlib.in.h (realpath): Make declaration optional based on HAVE_REALPATH. * m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL): Check whether native realpath works. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide default. * modules/stdlib (Makefile.am): Substitute witness. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 99ad8ac7 2009-09-11T12:18:10 canonicalize, canonicalize-lgpl: use <stdlib.h> Match current gnulib conventions of glibc functions being declared in the same header as glibc. This makes it easier to replace broken canonicalize_file_name. canonicalize still requires "canonicalize.h" because canonicalize_filename_mode is not in glibc. With this patch, canonicalize-lgpl always provides realpath and canonicalize_file_name, while canonicalize can provide canonicalize_file_name but not realpath; if both modules are in use, canonicalize_file_name comes from the LGPLv2+ sources, but the testing comes from canonicalize. * modules/canonicalize-lgpl (Files): Drop canonicalize.h. (Include): Mention <stdlib.h>. (configure.ac): Mention functions we provide. * modules/canonicalize (configure.ac): Likewise. * m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL): Always replace realpath if canonicalize_file_name is missing. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide defaults. * modules/stdlib (Makefile.am): Substitute witnesses. * lib/stdlib.in.h (canonicalize_file_name, realpath): Declare. * lib/canonicalize-lgpl.c (includes): Adjust accordingly. * lib/canonicalize.h (canonicalize_file_name): Drop declaration. * NEWS: Document this. * doc/glibc-functions/canonicalize_file_name.texi (canonicalize_file_name): Likewise. * doc/posix-functions/realpath.texi (realpath): Likewise. * tests/test-canonicalize-lgpl.c (includes): Use <stdlib.h>. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 6cdf6086 2009-09-11T08:34:37 canonicalize, canonicalize-lgpl: update module dependencies The m4 files were checking whether canonicalize_file_name was declared, but without enabling extensions, this would never succeed. Also, mingw failed to compile the module combination of canonicalize-lgpl and sys_stat, due to a link error on lstat. * modules/canonicalize (Depends-on): Add extensions, lstat, pathmax, stdlib. (Files): Drop pathmax.h. (configure.ac): Adjust macro name. * modules/canonicalize-lgpl (Depends-on): Add errno, extensions, lstat, stdlib, sys_stat. * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME): Rename... (gl_FUNC_CANONICALIZE_FILENAME_MODE): ...to this, and require extensions. * m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL) (gl_CANONICALIZE_LGPL_SEPARATE): Require extensions. (gl_PREREQ_CANONICALIZE_LGPL): Assume unistd.h. * lib/canonicalize.h (canonicalize_file_name): Use <stdlib.h> declaration, if available. * lib/canonicalize-lgpl.c [HAVE_READLINK]: Delete this condition; we can rely on the readlink module. (MAXSYMLINKS): Also consult SYMLOOP_MAX. (includes): Use <unistd.h> unconditionally. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 9de26050 2009-09-02T17:06:43 errno: use consistently * lib/c-stack.c (ENOTSUP): <errno.h> guarantees a definition. * lib/canonicalize-lgpl.c (ENAMETOOLONG): Likewise. * lib/canonicalize.c (ELOOP): Likewise. * lib/inet_ntop.c (EAFNOSUPPORT): Likewise. * lib/inet_pton.c (EAFNOSUPPORT): Likewise. * lib/lchown.c (EOPNOTSUPP): Likewise. * lib/openat-priv.h (ENOSYS, EOPNOTSUPP): Likewise. * lib/savewd.c (ESTALE): Likewise. * lib/settime.c (ENOSYS): Likewise. * lib/utimens.c (ENOSYS): Likewise. * lib/xgethostname.c (ENAMETOOLONG): Likewise. * lib/chdir-safer.c (ELOOP): Likewise. (chdir_no_follow): Use HAVE_READLINK, not ELOOP, as witness. * modules/c-stack (Depends-on): Add errno. * modules/canonicalize (Depends-on): Likewise. * modules/chdir-safer (Depends-on): Likewise. * modules/fdopendir (Depends-on): Likewise. * modules/inet_ntop (Depends-on): Likewise. * modules/inet_pton (Depends-on): Likewise. * modules/lchown (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * modules/settime (Depends-on): Likewise. * m4/chdir-safer.m4 (gl_CHDIR_SAFER): Check for readlink. Signed-off-by: Eric Blake <ebb9@byu.net>
Ulrich Drepper 0eff0635 2008-07-23T10:24:43 * lib/canonicalize-lgpl.c (__realpath): readlink can write too much into the buffer on platforms without PATH_MAX.
Bruno Haible 56feeb13 2008-04-22T00:01:17 Fix conflict between modules 'canonicalize' and 'canonicalize-lgpl' differently.
Bruno Haible 6a157512 2008-04-13T22:39:41 Fix conflict between modules 'canonicalize' and 'canonicalize-lgpl'.
Bruno Haible 7ba813f0 2008-01-10T10:56:41 Update copyright year.
Colin Watson 13abf457 2008-01-10T10:16:08 * lib/canonicalize-lgpl.c [!_LIBC]: Fix typo in #if directive: s/S_ISNLK/S_ISLNK/.
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible 9c3b84f6 2007-09-09T14:32:21 Set errno to ENOMEM when malloc/realloc fails. Needed on mingw.
Bruno Haible 90988ede 2007-06-09T11:11:14 Update after allocsa -> malloca renaming.
Bruno Haible 39d80bf8 2006-12-23T15:43:03 Test HAVE_READLINK instead of S_ISLNK.
Paul Eggert d5f7e64d 2006-11-06T18:21:34 * MODULES.html.sh (File system functions): New module canonicalize-lgpl. * lib/canonicalize.h: Add comments for canonicalize_filename_mode and canonicalize_file_name. * lib/canonicalize-lgpl.c, m4/canonicalize-lgpl.m4: * modules/canonicalize-lgpl: New files.