Mercurial > hg > octave-lyh > gnulib-hg
changeset 5933:35504bd557fa
Remove stat module & update lstat.
* MODULES.html.sh (stat): Remove.
* MODULES.html: Regenerated.
* config/srclist.txt (GLIBC sources): Remove stat.
* lib/stat.c: Remove this file...
(slash_aware_lstat): ...moving this content and its support...
* lib/lstat.c (rpl_lstat): ...into here.
* lib/lstat.h: New file.
* m4/lstat.m4 (gl_FUNC_LSTAT): Drop AC_FUNC_LSTAT in favor of
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
* m4/stat.m4: Remove this file.
* modules/lstat (Description): Correct function name.
(Files): Add "lstat.h".
(Depends-on): Remove stat, add xalloc, stat-macros.
* modules/stat: Remove this file.
(Include): Add "lstat.h", remove <sys/stat.h>.
author | Derek R. Price <derek@ximbiot.com> |
---|---|
date | Fri, 24 Jun 2005 14:53:03 +0000 |
parents | 8ef7d6084536 |
children | fe449ec53f0d |
files | ChangeLog MODULES.html MODULES.html.sh config/ChangeLog config/srclist.txt lib/ChangeLog lib/lstat.c lib/lstat.h lib/stat.c m4/ChangeLog m4/lstat.m4 m4/stat.m4 modules/lstat modules/stat |
diffstat | 14 files changed, 130 insertions(+), 198 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-06-24 Derek Price <derek@ximbiot.com> + and Bruno Haible <bruno@clisp.org> + + Remove stat module & update lstat. + * MODULES.html.sh (stat): Remove. + * MODULES.html: Regenerated. + * modules/lstat (Description): Correct function name. + (Files): Add "lstat.h". + (Depends-on): Remove stat, add xalloc, stat-macros. + * modules/stat: Remove this file. + (Include): Add "lstat.h", remove <sys/stat.h>. + 2005-06-08 Bruno Haible <bruno@clisp.org> * modules/csharpcomp: New file.
--- a/MODULES.html +++ b/MODULES.html @@ -2,7 +2,7 @@ <HTML> <HEAD> <TITLE>Gnulib Module List</TITLE> - <META NAME="keywords" CONTENT="acl, alloca, alloca-opt, allocsa, argmatch, argp, argz, assert, atexit, backupfile, base64, bcopy, binary-io, byteswap, c-bs-a, c-ctype, c-stack, c-strtod, c-strtold, calloc, canon-host, canonicalize, chdir-long, chown, classpath, cloexec, closeout, copy-file, csharpcomp, csharpexec, cycle-check, diacrit, dirfd, dirname, dummy, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal-signal, file-type, fileblocks, filemode, filenamecat, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, fts, fts-lgpl, full-read, full-write, fwriteerror, gcd, getaddrinfo, getcwd, getdate, getdomainname, getgroups, gethostname, gethrxtime, getline, getloadavg, getlogin_r, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, getsubopt, gettext, gettime, gettimeofday, getugroups, getusershell, glob, group-member, hard-locale, hash, hash-pjw, human, iconv, iconvme, idcache, inet_ntop, inttostr, isdir, javacomp, javaexec, lchown, linebreak, linebuffer, localcharset, long-options, lstat, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmem, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdir-p, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, openat, pagealign_alloc, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, raise, readlink, readtokens, readtokens0, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sh-quote, sha1, sig2str, snprintf, stat, stat-macros, stdbool, stdint, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strsep, strstr, strtod, strtoimax, strtok_r, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, time_r, timegm, timespec, tzset, ucs4-utf16, ucs4-utf8, ullong_max, unicodeio, unistd-safer, unlinkdir, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, utimecmp, utimens, vasnprintf, vasprintf, version-etc, version-etc-fsf, vsnprintf, wait-process, xalloc, xalloc-die, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xnanosleep, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, xvasprintf, yesno"> + <META NAME="keywords" CONTENT="acl, alloca, alloca-opt, allocsa, argmatch, argp, argz, assert, atexit, backupfile, base64, bcopy, binary-io, byteswap, calloc, canon-host, canonicalize, c-bs-a, c-ctype, chdir-long, chown, classpath, cloexec, closeout, copy-file, csharpcomp, csharpexec, c-stack, c-strtod, c-strtold, cycle-check, diacrit, dirfd, dirname, dummy, dup2, eealloc, error, euidaccess, exclude, execute, exit, exitfail, extensions, fatal-signal, fileblocks, filemode, filenamecat, file-type, findprog, fnmatch, fnmatch-gnu, fnmatch-posix, fpending, free, fsusage, ftruncate, fts, fts-lgpl, full-read, full-write, fwriteerror, gcd, getaddrinfo, getcwd, getdate, getdomainname, getgroups, gethostname, gethrxtime, getline, getloadavg, getlogin_r, getndelim2, getnline, getopt, getpagesize, getpass, getpass-gnu, getsubopt, gettext, gettime, gettimeofday, getugroups, getusershell, glob, group-member, hard-locale, hash, hash-pjw, human, iconv, iconvme, idcache, inet_ntop, inttostr, isdir, javacomp, javaexec, lchown, linebreak, linebuffer, localcharset, long-options, lstat, malloc, mathl, mbswidth, md5, memcasecmp, memchr, memcmp, memcoll, memcpy, memmem, memmove, mempcpy, memrchr, memset, minmax, mkdir, mkdir-p, mkdtemp, mkstemp, mktime, modechange, mountlist, nanosleep, obstack, openat, pagealign_alloc, pathmax, pathname, physmem, pipe, poll, posixtm, posixver, progname, putenv, quote, quotearg, raise, readlink, readtokens, readtokens0, readutmp, realloc, regex, rename, restrict, rmdir, rpmatch, safe-read, safe-write, same, save-cwd, savedir, setenv, settime, sha1, sh-quote, sig2str, snprintf, stat-macros, stdbool, stdint, stdio-safer, stpcpy, stpncpy, strcase, strchrnul, strcspn, strdup, strerror, strftime, strndup, strnlen, strpbrk, strsep, strstr, strtod, strtoimax, strtok_r, strtol, strtoll, strtoul, strtoull, strtoumax, strverscmp, sysexits, timegm, time_r, timespec, tzset, ucs4-utf16, ucs4-utf8, ullong_max, unicodeio, unistd-safer, unlinkdir, unlocked-io, userspec, utf16-ucs4, utf8-ucs4, utime, utimecmp, utimens, vasnprintf, vasprintf, version-etc, version-etc-fsf, vsnprintf, wait-process, xalloc, xalloc-die, xallocsa, xgetcwd, xgetdomainname, xgethostname, xmemcoll, xnanosleep, xreadlink, xsetenv, xsize, xstrndup, xstrtod, xstrtoimax, xstrtol, xstrtoumax, xvasprintf, yesno"> </HEAD> <BODY> <H1>Gnulib Module List</H1> @@ -551,12 +551,8 @@ <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/readlink.html">readlink</A>() function: read the value of a symbolic link. </TR> <TR WIDTH="100%"> - <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=stat">stat</A> - <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/stat.html">stat</A>() function: return information about a file, following symbolic links. - </TR> - <TR WIDTH="100%"> <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=lstat">lstat</A> - <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/stat.html">stat</A>() function: return information about a file or symbolic link. + <TD ALIGN=LEFT VALIGN=TOP WIDTH="80%"><A HREF="http://www.opengroup.org/onlinepubs/007904975/functions/lstat.html">lstat</A>() function: return information about a file or symbolic link. </TR> <TR WIDTH="100%"> <TD ALIGN=LEFT VALIGN=TOP WIDTH="20%"><A HREF="#module=time_r">time_r</A> @@ -2303,18 +2299,11 @@ <TD ALIGN=LEFT VALIGN=TOP>--- </TR> <TR> - <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=stat"></A><A HREF="modules/stat">stat</A> - <TD ALIGN=LEFT VALIGN=TOP>#include <<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/stat.h.html">sys/stat.h</A>> - <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/stat.c">stat.c</A> - <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/stat.m4">stat.m4</A><BR>gl_FUNC_STAT - <TD ALIGN=LEFT VALIGN=TOP>xalloc<BR>stat-macros - </TR> - <TR> <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=lstat"></A><A HREF="modules/lstat">lstat</A> - <TD ALIGN=LEFT VALIGN=TOP>#include <<A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/stat.h.html">sys/stat.h</A>> + <TD ALIGN=LEFT VALIGN=TOP>#include "<A HREF="lib/lstat.h">lstat.h</A>" <TD ALIGN=LEFT VALIGN=TOP><A HREF="lib/lstat.c">lstat.c</A> <TD ALIGN=LEFT VALIGN=TOP><A HREF="m4/lstat.m4">lstat.m4</A><BR>gl_FUNC_LSTAT - <TD ALIGN=LEFT VALIGN=TOP>stat + <TD ALIGN=LEFT VALIGN=TOP>xalloc<BR>stat-macros </TR> <TR> <TD ALIGN=LEFT VALIGN=TOP><A NAME="module=time_r"></A><A HREF="modules/time_r">time_r</A> @@ -3411,6 +3400,6 @@ <LI>A testsuite </UL> <HR> - Generated from <CODE>MODULES.html.sh</CODE> on 9 June 2005. + Generated from <CODE>MODULES.html.sh</CODE> on 24 June 2005. </BODY> </HTML>
--- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -1063,7 +1063,6 @@ srand48 srandom sscanf -stat statvfs stdin strcasecmp @@ -1756,7 +1755,6 @@ func_module mkdtemp func_module poll func_module readlink - func_module stat func_module lstat func_module time_r func_module timespec
--- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,9 @@ +2005-06-24 Derek Price <derek@ximbiot.com> + and Bruno Haible <bruno@clisp.org> + + Remove stat module & update lstat. + * srclist.txt (libc sources): Remove stat. + 2005-05-29 Derek Price <derek@ximbiot.com> * srclist.txt (glob_.h, glob.c): Add these files.
--- a/config/srclist.txt +++ b/config/srclist.txt @@ -1,4 +1,4 @@ -# $Id: srclist.txt,v 1.63 2005-05-29 16:56:02 dprice Exp $ +# $Id: srclist.txt,v 1.64 2005-06-24 14:53:03 dprice Exp $ # Files for which we are not the source. See ./srclistvars.sh for the # variable definitions. @@ -143,7 +143,6 @@ # # These implementations are quite different. #$LIBCSRC/io/lstat.c lib gpl -#$LIBCSRC/io/stat.c lib gpl #$LIBCSRC/libio/__fpending.c lib gpl #$LIBCSRC/malloc/malloc.c lib gpl #$LIBCSRC/misc/dirname.c lib gpl
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,12 @@ +2005-06-24 Derek Price <derek@ximbiot.com> + and Bruno Haible <bruno@clisp.org> + + Remove stat module & update lstat. + * stat.c: Remove this file... + (slash_aware_lstat): ...moving this content and its support... + * lstat.c (rpl_lstat): ...into here. + * lstat.h: New file. + 2005-06-23 Paul Eggert <eggert@cs.ucla.edu> * mktime.c: Include <string.h> even if !DEBUG. (From glibc.)
--- a/lib/lstat.c +++ b/lib/lstat.c @@ -1,8 +1,6 @@ -/* Work around the bug in some systems whereby lstat succeeds when - given the zero-length file name argument. The lstat from SunOS 4.1.4 - has this bug. +/* Work around a bug of lstat on some systems - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free + Copyright (C) 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 @@ -19,5 +17,59 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define LSTAT -#include "stat.c" +/* written by Jim Meyering */ + +#include <config.h> + +/* The specification of these functions is in sys_stat.h. But we cannot + include this include file here, because on some systems, a + "#define lstat lstat64" is being used, and sys_stat.h deletes this + definition. */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <string.h> + +#include "stat-macros.h" +#include "xalloc.h" + +/* lstat works differently on Linux and Solaris systems. POSIX (see + `pathname resolution' in the glossary) requires that programs like `ls' + take into consideration the fact that FILE has a trailing slash when + FILE is a symbolic link. On Linux systems, the lstat function already + has the desired semantics (in treating `lstat("symlink/",sbuf)' just like + `lstat("symlink/.",sbuf)', but on Solaris it does not. + + If FILE has a trailing slash and specifies a symbolic link, + then append a `.' to FILE and call lstat a second time. */ + +int +rpl_lstat (const char *file, struct stat *sbuf) +{ + size_t len; + char *new_file; + + int lstat_result = lstat (file, sbuf); + + if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode)) + return lstat_result; + + len = strlen (file); + if (len == 0 || file[len - 1] != '/') + return lstat_result; + + /* FILE refers to a symbolic link and the name ends with a slash. + Append a `.' to FILE and repeat the lstat call. */ + + /* Add one for the `.' we'll append, and one more for the trailing NUL. */ + new_file = xmalloc (len + 1 + 1); + memcpy (new_file, file, len); + new_file[len] = '.'; + new_file[len + 1] = 0; + + lstat_result = lstat (new_file, sbuf); + free (new_file); + + return lstat_result; +}
new file mode 100644 --- /dev/null +++ b/lib/lstat.h @@ -0,0 +1,24 @@ +/* Retrieving information about files. + Copyright (C) 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include <sys/stat.h> + +#if !LSTAT_FOLLOWS_SLASHED_SYMLINK +extern int rpl_lstat (const char *name, struct stat *buf); +# undef lstat +# define lstat rpl_lstat +#endif
deleted file mode 100644 --- a/lib/stat.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Work around the bug in some systems whereby stat/lstat succeeds when - given the zero-length file name argument. The stat/lstat from SunOS 4.1.4 - has this bug. Also work around a deficiency in Solaris systems (up to at - least Solaris 9) regarding the semantics of `lstat ("symlink/", sbuf).' - - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* written by Jim Meyering */ - -#include <config.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#if defined LSTAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK -# include <stdlib.h> -# include <string.h> - -# include "stat-macros.h" -# include "xalloc.h" - -/* lstat works differently on Linux and Solaris systems. POSIX (see - `pathname resolution' in the glossary) requires that programs like `ls' - take into consideration the fact that FILE has a trailing slash when - FILE is a symbolic link. On Linux systems, the lstat function already - has the desired semantics (in treating `lstat("symlink/",sbuf)' just like - `lstat("symlink/.",sbuf)', but on Solaris it does not. - - If FILE has a trailing slash and specifies a symbolic link, - then append a `.' to FILE and call lstat a second time. */ - -static int -slash_aware_lstat (const char *file, struct stat *sbuf) -{ - size_t len; - char *new_file; - - int lstat_result = lstat (file, sbuf); - - if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode)) - return lstat_result; - - len = strlen (file); - if (file[len - 1] != '/') - return lstat_result; - - /* FILE refers to a symbolic link and the name ends with a slash. - Append a `.' to FILE and repeat the lstat call. */ - - /* Add one for the `.' we'll append, and one more for the trailing NUL. */ - new_file = xmalloc (len + 1 + 1); - memcpy (new_file, file, len); - new_file[len] = '.'; - new_file[len + 1] = 0; - - lstat_result = lstat (new_file, sbuf); - free (new_file); - - return lstat_result; -} -#endif /* LSTAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK */ - -/* This is a wrapper for stat/lstat. - If FILE is the empty string, fail with errno == ENOENT. - Otherwise, return the result of calling the real stat/lstat. - - This works around the bug in some systems whereby stat/lstat succeeds when - given the zero-length file name argument. The stat/lstat from SunOS 4.1.4 - has this bug. */ - -/* This function also provides a version of lstat with consistent semantics - when FILE specifies a symbolic link and has a trailing slash. */ - -#ifdef LSTAT -# define rpl_xstat rpl_lstat -# if ! LSTAT_FOLLOWS_SLASHED_SYMLINK -# define xstat_return_val(F, S) slash_aware_lstat (F, S) -# else -# define xstat_return_val(F, S) lstat (F, S) -# endif -#else -# define rpl_xstat rpl_stat -# define xstat_return_val(F, S) stat (F, S) -#endif - -int -rpl_xstat (const char *file, struct stat *sbuf) -{ - if (file && *file == 0) - { - errno = ENOENT; - return -1; - } - - return xstat_return_val (file, sbuf); -}
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2005-06-24 Derek Price <derek@ximbiot.com> + and Bruno Haible <bruno@clisp.org> + + Remove stat module & update lstat. + * lstat.m4 (gl_FUNC_LSTAT): Drop AC_FUNC_LSTAT in favor of + AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK. + * stat.m4: Remove this file. + 2005-06-20 Derek Price <derek@ximbiot.com> * bison.m4: Note that precious decls of YACC & YFLAGS will be
--- a/m4/lstat.m4 +++ b/m4/lstat.m4 @@ -18,7 +18,7 @@ AC_DEFUN([gl_FUNC_LSTAT], [ - AC_REQUIRE([AC_FUNC_LSTAT]) - dnl Note: AC_FUNC_LSTAT does AC_LIBOBJ(lstat). + AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) + dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat). : ])
deleted file mode 100644 --- a/m4/stat.m4 +++ /dev/null @@ -1,32 +0,0 @@ -#serial 11 - -# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -dnl From Jim Meyering. -dnl Determine whether stat has the bug that it succeeds when given the -dnl zero-length file name argument. The stat from SunOS 4.1.4 and the Hurd -dnl (as of 1998-11-01) do this. -dnl -dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to -dnl compile the wrapper function. -dnl - -AC_DEFUN([gl_FUNC_STAT], -[ - AC_FUNC_STAT - dnl Note: AC_FUNC_STAT does AC_LIBOBJ(stat). - if test $ac_cv_func_stat_empty_string_bug = yes; then - gl_PREREQ_STAT - fi -]) - -# Prerequisites of lib/stat.c. -AC_DEFUN([gl_PREREQ_STAT], -[ - : -])
--- a/modules/lstat +++ b/modules/lstat @@ -1,12 +1,14 @@ Description: -stat() function: return information about a file or symbolic link. +lstat() function: return information about a file or symbolic link. Files: lib/lstat.c +lib/lstat.h m4/lstat.m4 Depends-on: -stat +xalloc +stat-macros configure.ac: gl_FUNC_LSTAT @@ -14,7 +16,7 @@ Makefile.am: Include: -<sys/stat.h> +"lstat.h" License: GPL
deleted file mode 100644 --- a/modules/stat +++ /dev/null @@ -1,24 +0,0 @@ -Description: -stat() function: return information about a file, following symbolic links. - -Files: -lib/stat.c -m4/stat.m4 - -Depends-on: -xalloc -stat-macros - -configure.ac: -gl_FUNC_STAT - -Makefile.am: - -Include: -<sys/stat.h> - -License: -GPL - -Maintainer: -Jim Meyering