gnulib.git
14 years agoopenat: declare in POSIX headers
Eric Blake [Wed, 2 Sep 2009 23:14:26 +0000 (17:14 -0600)]
openat: declare in POSIX headers

* NEWS: Mention this.
* modules/openat (configure.ac): Declare witnesses.
(Depends-on): Add fcntl-h, sys_stat, unistd.
(Include): Mention correct headers.
* modules/fcntl-h (Depends-on): Add link-warning.
(Files): Add openat.m4.
(Makefile.am): Substitute witnesses.
* modules/sys_stat (Files, Makefile.am): Likewise.
* modules/unistd (Files, Makefile.am): Likewise.
* m4/openat.m4 (gl_FUNC_OPENAT, gl_FUNC_FCHOWNAT): Set witnesses.
(gl_OPENAT_DEFAULTS): New macro.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Use it.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Likewise.
(SYS_STAT_H): Remove unused variable.
* doc/posix-headers/fcntl.texi (fcntl.h): Update content.
* lib/fcntl--.h (includes): Remove unneeded header.
* lib/openat-safer.c (includes): Likewise.
* lib/openat.h (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR)
(openat, fstatat, unlinkat, mkdirat, fchmodat, fchownat): Move to
appropriate headers.
(__OPENAT_PREFIX): Delete.
* lib/fcntl.in.h (openat): Provide declaration.
(AT_FDCWD): Fix Solaris bug.
(AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR): Provide macros.
* lib/sys_stat.in.h (fstatat, mkdirat): Provide declaration.
* lib/fchmodat.c (includes):  Adjust to find declaration.
* lib/fchownat.c (includes): Likewise.
* lib/mkdirat.c (includes): Likewise.
* lib/fstatat.c (includes): Likewise.  Ensure original fstatat is
still visible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoerrno: use consistently
Eric Blake [Wed, 2 Sep 2009 23:06:43 +0000 (17:06 -0600)]
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>
14 years agofts: avoid leaking fds
Eric Blake [Wed, 2 Sep 2009 20:44:51 +0000 (14:44 -0600)]
fts: avoid leaking fds

* modules/fts (Depends-on): Add cloexec.
* lib/fts.c (opendirat, diropen, fts_build): Set close-on-exec
flag.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofts: make directory fds more robust
Eric Blake [Tue, 1 Sep 2009 20:06:37 +0000 (14:06 -0600)]
fts: make directory fds more robust

* lib/fts.c (O_DIRECTORY): Let <fcntl.h> take care of this.
(opendirat): Specify O_DIRECTORY, and add fallbacks for safety.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agobackupfile, chdir-long, fts, savedir: make safer
Eric Blake [Tue, 1 Sep 2009 18:25:01 +0000 (12:25 -0600)]
backupfile, chdir-long, fts, savedir: make safer

* lib/backupfile.c (includes): Use "dirent--.h", since
numbered_backup can write to stderr during readdir.
* lib/savedir.c (includes): Likewise.
* lib/chdir-long.c (includes): Use "fcntl--.h", since openat
emulation can write to stderr on failure.
* lib/fts.c (includes) [!_LIBC]: Likewise for opendir and openat.
* lib/getcwd.c: Document why opendir_safer is unused.
* lib/glob.c: Likewise.
* lib/scandir.c: Likewise.
* lib/openat-proc.c: Likewise, for open_safer.
* modules/backupfile (Depends-on): Add dirent-safer.
* modules/savedir (Depends-on): Likewise.
* modules/fts (Depends-on): Add dirent-safer and openat-safer.
* modules/chdir-long (Depends-on): Add openat-safer.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat-safer: new module
Eric Blake [Wed, 2 Sep 2009 12:07:54 +0000 (06:07 -0600)]
openat-safer: new module

* modules/openat-safer: New file.
* lib/openat-safer.c: Likewise.
* m4/fcntl-safer.m4 (gl_OPENAT_SAFER): New macro.
* lib/fcntl-safer.h (openat_safer): Declare.
* lib/fcntl--.h (openat): Override.
* MODULES.html.sh (File descriptor based I/O): Mention it.
* lib/openat.h: Add double-inclusion guards.
* lib/openat.c (includes): Only include "fcntl-safer.h", not
"fcntl--.h", so we can implement openat.
* modules/openat-safer-tests: New test.
* tests/test-openat-safer.c: New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodirent-safer: new module
Eric Blake [Tue, 1 Sep 2009 13:41:28 +0000 (07:41 -0600)]
dirent-safer: new module

* modules/dirent-safer: New file.
* lib/dirent--.h: Likewise.
* lib/dirent-safer.h: Likewise.
* lib/opendir-safer.c: Likewise.
* m4/dirent-safer.m4: Likewise.
* MODULES.html.sh (Enhancements for POSIX:2008): Mention it.
* modules/dirent-safer-tests: New test.
* tests/test-dirent-safer.c: New file.
* lib/fdopendir.c (includes): Ensure fdopendir is also safe.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofdopendir: optimize on mingw
Eric Blake [Tue, 1 Sep 2009 16:05:44 +0000 (10:05 -0600)]
fdopendir: optimize on mingw

* lib/unistd.in.h (_gl_directory_name): New prototype.
* lib/fchdir.c (_gl_directory_name): Implement it.
(fchdir): Use it to simplify implementation.
* lib/fdopendir.c (fdopendir) [REPLACE_FCHDIR]: Use metadata from
fchdir, when available, to avoid calling [f]chdir().

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofdopendir: split into its own module
Eric Blake [Tue, 1 Sep 2009 02:37:59 +0000 (20:37 -0600)]
fdopendir: split into its own module

* lib/openat.c (fdopendir): Move...
* lib/fdopendir.c: ...into new file.
* modules/fdopendir: New module.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): New file.
* modules/openat (Depends-on): Add fdopendir.
* m4/openat.m4 (gl_FUNC_OPENAT): No longer need to check for
fdopendir here.
* modules/savedir (Depends-on): Only need fdopendir, not full
openat.
* lib/savedir.c (include): Use <dirent.h>, not "openat.h".
* lib/openat.h (fdopendir): Drop prototype.
* lib/dirent.in.h (fdopendir): Provide prototype.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): Add replacements.
* modules/dirent (Makefile.am): Substitute them.
* MODULES.html.sh (File system functions): Mention it.
* doc/posix-functions/fdopendir.texi (fdopendir): Likewise.
* modules/fdopendir-tests: New file.
* tests/test-fdopendir.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofchdir: use more consistent macro convention
Eric Blake [Tue, 1 Sep 2009 15:18:16 +0000 (09:18 -0600)]
fchdir: use more consistent macro convention

* lib/fcntl.in.h (_gl_register_fd): Move declaration to unistd.
* lib/sys_stat.in.h (rpl_fstat): Declare via make-time
REPLACE_FCHDIR, rather than relying on config.h macros.
* lib/unistd.in.h (fchdir): Move all fchdir internal declarations
inside a single make-time REPLACE_FCHDIR block, rather than using
the config.h FCHDIR_REPLACEMENT.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): REPLACE_FCHDIR was already
AC_SUBST'd, also AC_DEFINE it.  Don't define FCHDIR_REPLACEMENT.
Manage fstat replacement.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Pick up
REPLACE_FCHDIR.
* modules/sys_stat (Files): Add m4/unistd_h.m4.
(Makefile.am): Substitute REPLACE_FCHDIR.
* lib/close.c (rpl_close): Use REPLACE_FCHDIR, not
FCHDIR_REPLACEMENT.
* lib/dup-safer.c (dup_safer): Likewise.
* lib/dup2.c (rpl_dup2): Likewise.
* lib/dup3.c (rpl_dup3): Likewise.
* lib/open.c (rpl_open): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofchdir: simplify error handling, and support dup3
Eric Blake [Mon, 31 Aug 2009 20:20:03 +0000 (14:20 -0600)]
fchdir: simplify error handling, and support dup3

* modules/fchdir (Depends-on): Use strdup-posix, not strdup.  Add
stdbool, malloc-posix, realloc-posix.
* lib/fchdir.c (struct dir_info_t): Delete saved_errno.
(ensure_dirs_slot): Return false on allocation failure.
(rpl_dup2): Delete.
(_gl_register_dup): New function.
(_gl_unregister_fd, rpl_opendir, rpl_dup): Update callers.
(_gl_register_fd): Close fd on allocation failure.
* lib/fcntl.in.h (_gl_register_fd): Update signature.
* lib/unistd.in.h (_gl_register_dup) [FCHDIR_REPLACEMENT]: New
prototype.
(rpl_dup2_fchdir): Delete prototype.
* lib/open.c (open): Update caller.
* lib/dup2.c (dup2): Track fchdir metadata.
* lib/dup3.c (dup3): Likewise.
* m4/dup2.m4 (gl_REPLACE_DUP2): New macro.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Use it.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoReplace uses of obsolete Autoconf macros with modern counterparts.
Ralf Wildenhues [Wed, 2 Sep 2009 22:10:41 +0000 (00:10 +0200)]
Replace uses of obsolete Autoconf macros with modern counterparts.

14 years agoRelicense mkdtemp under LGPLv2+.
Bruno Haible [Wed, 2 Sep 2009 20:43:05 +0000 (22:43 +0200)]
Relicense mkdtemp under LGPLv2+.

14 years agoReplace uses of obsolete autoconf macros in Jim's modules.
Ralf Wildenhues [Wed, 2 Sep 2009 18:07:33 +0000 (20:07 +0200)]
Replace uses of obsolete autoconf macros in Jim's modules.

The Autoconf macros AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK and
AC_TRY_RUN have been obsolete since Autoconf 2.55, and each use
can evoke a warning from autoconf when run with -Wobsolete
enabled.  They were declared obsolete for good reasons (see
the `AC_FOO_IFELSE vs AC_TRY_FOO' node in the Autoconf manual,
recently renamed to `AC_ACT_IFELSE vs AC_TRY_ACT'), and we
should not continue using the deprecated macros.

* m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Replace
obsolete Autoconf macros with modern counterparts.
* m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise.
* m4/dos.m4 (gl_AC_DOS): Likewise.
* m4/fpending.m4 (gl_FUNC_FPENDING): Likewise.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise.
* m4/getloadavg.m4 (gl_PREREQ_GETLOADAVG): Likewise.
* m4/jm-winsz1.m4 (gl_WINSIZE_IN_PTEM): Likewise.
* m4/link-follow.m4 (gl_AC_FUNC_LINK_FOLLOWS_SYMLINK): Likewise.
* m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Likewise.
* m4/mkdir-slash.m4 (gl_FUNC_MKDIR_TRAILING_SLASH): Likewise.
* m4/mode_t.m4 (gl_PROMOTED_TYPE_MODE_T): Likewise.
* m4/rename-dest-slash.m4 (gl_FUNC_RENAME_TRAILING_DEST_SLASH):
Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
* m4/rpmatch.m4 (gl_PREREQ_RPMATCH): Likewise.
* m4/st_dm_mode.m4 (AC_STRUCT_ST_DM_MODE): Likewise.
* m4/stat-time.m4 (gl_STAT_TIME): Likewise.
* m4/utimes-null.m4 (gl_FUNC_UTIMES_NULL): Likewise.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14 years agofchdir: fix off-by-one bug in previous patch
Eric Blake [Tue, 1 Sep 2009 16:06:44 +0000 (10:06 -0600)]
fchdir: fix off-by-one bug in previous patch

* lib/fchdir.c (rpl_fstat): Use correct bounds.
(_gl_unregister_fd): Delete useless if.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint.mk: sort the list of syntax-check rules
Daniel P. Berrange [Tue, 1 Sep 2009 14:39:43 +0000 (16:39 +0200)]
maint.mk: sort the list of syntax-check rules

* top/maint.mk (syntax-check-rules): Sort syntax-check rules, so it's
easier to get a sense of progress when the rules are run sequentially
and take a long time.

14 years agoUse $(MKDIR_P) instead of @MKDIR_P@.
Simon Josefsson [Tue, 1 Sep 2009 12:25:07 +0000 (14:25 +0200)]
Use $(MKDIR_P) instead of @MKDIR_P@.

14 years agofts: help ensure that return values are not ignored
Jim Meyering [Tue, 1 Sep 2009 09:20:41 +0000 (11:20 +0200)]
fts: help ensure that return values are not ignored

* lib/fts_.h (__GNUC_PREREQ): Define.
(__attribute_warn_unused_result__): Define.
(fts_children, fts_close, fts_open, fts_read): Declare with
__attribute_warn_unused_result__.

14 years agofts: fts_close now fails also when closing a dir file descriptor fails
Jim Meyering [Tue, 1 Sep 2009 09:18:07 +0000 (11:18 +0200)]
fts: fts_close now fails also when closing a dir file descriptor fails

* lib/fts.c (fts_close): Detect close failure, not just fchdir failure,
and propagate to caller, along with errno.

14 years agoannounce-gen: correct formatting in --help output
Jim Meyering [Tue, 1 Sep 2009 06:49:27 +0000 (08:49 +0200)]
announce-gen: correct formatting in --help output

* build-aux/announce-gen (usage): Move the one-line description in
--help output "up", to where it belongs, just after Usage:.

14 years agofchdir: port to mingw
Eric Blake [Mon, 31 Aug 2009 12:09:08 +0000 (06:09 -0600)]
fchdir: port to mingw

* m4/fchdir.m4 (gl_FUNC_FCHDIR): Check for mingw bug.
* lib/open.c (open) [FCHDIR_REPLACEMENT]: If directories can't be
opened, then use a substitute.
* lib/sys_stat.in.h (fstat) [REPLACE_OPEN_DIRECTORY]: Declare
replacement.
* lib/fchdir.c (fstat) [REPLACE_OPEN_DIRECTORY]: Implement it.
(_gl_register_fd): No need to check stat if open already filters
all directories.
(fchdir): Fix error condition to match POSIX.
* modules/fchdir (Depends-on): Add sys_stat.
* doc/posix-functions/open.texi (open): Document the limitation.
* modules/fchdir-tests: New file.
* tests/test-fchdir.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize: allow cross-testing from cygwin to mingw
Eric Blake [Mon, 31 Aug 2009 15:12:30 +0000 (09:12 -0600)]
canonicalize: allow cross-testing from cygwin to mingw

* modules/canonicalize-tests (configure.ac): Define HAVE_SYMLINK.
(Makefile.am): Pass it through TESTS_ENVIRONMENT.
* modules/canonicalize-lgpl-tests (configure.ac, Makefile.am):
Likewise.
* tests/test-canonicalize.sh: Also skip test if 'ln -s' works, but
target does not support symlinks.
* tests/test-canonicalize-lgpl.sh: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agochown: avoid compilation warning on mingw
Eric Blake [Mon, 31 Aug 2009 15:00:45 +0000 (09:00 -0600)]
chown: avoid compilation warning on mingw

* m4/chown.m4 (gl_FUNC_CHOWN): Recognize missing chown.
* lib/chown.c (rpl_chown) [!HAVE_CHOWN]: Always return failure on
mingw.
* lib/lchown.c (lchown) [!HAVE_CHOWN]: Likewise.
* modules/chown (Depends-on): Add errno.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoFix test whether $CONFIG_SHELL has a working 'echo' command.
Stefano Lattarini [Mon, 31 Aug 2009 21:01:55 +0000 (23:01 +0200)]
Fix test whether $CONFIG_SHELL has a working 'echo' command.

14 years agocanonicalize: remove useless initialization
Jim Meyering [Mon, 31 Aug 2009 14:32:40 +0000 (16:32 +0200)]
canonicalize: remove useless initialization

* lib/canonicalize.c (canonicalize_filename_mode): Remove useless
initialization of local, "end".

14 years agoFix an unnecessary error on Solaris 10 on NFSv3 file systems.
Bruno Haible [Sun, 30 Aug 2009 22:53:46 +0000 (00:53 +0200)]
Fix an unnecessary error on Solaris 10 on NFSv3 file systems.

14 years agoUse /usr/xpg6/bin/tr when it exists.
Bruno Haible [Sun, 30 Aug 2009 21:43:52 +0000 (23:43 +0200)]
Use /usr/xpg6/bin/tr when it exists.

14 years agoFix today's commit.
Bruno Haible [Sun, 30 Aug 2009 16:19:49 +0000 (18:19 +0200)]
Fix today's commit.

14 years agoWork around deficient /usr/bin/id program on Solaris.
Bruno Haible [Sun, 30 Aug 2009 15:36:32 +0000 (17:36 +0200)]
Work around deficient /usr/bin/id program on Solaris.

14 years agoNew module 'xstriconveh'.
Bruno Haible [Sun, 30 Aug 2009 14:27:11 +0000 (16:27 +0200)]
New module 'xstriconveh'.

14 years agoMake the striconveh API easier to use.
Bruno Haible [Sun, 30 Aug 2009 14:24:51 +0000 (16:24 +0200)]
Make the striconveh API easier to use.

14 years agoMention indirect conversion problem.
Bruno Haible [Sun, 30 Aug 2009 14:24:02 +0000 (16:24 +0200)]
Mention indirect conversion problem.

14 years agoWork around iconv_open problem on Solaris.
Bruno Haible [Sun, 30 Aug 2009 12:29:34 +0000 (14:29 +0200)]
Work around iconv_open problem on Solaris.

14 years agomaint.mk: remove more coreutils-specific targets; XZ_OPT=-9ev
Jim Meyering [Sat, 29 Aug 2009 15:24:03 +0000 (17:24 +0200)]
maint.mk: remove more coreutils-specific targets; XZ_OPT=-9ev

* top/maint.mk (cvs-check): Remove target; it was just an alias
to the better-named vc-diff-check.
(maintainer-distcheck): Remove rule.  It was used only from
the (alpha/beta/major) target, and all of its commands but one
were coreutils-specific.
(vc-dist): Remove rule.
(alpha beta major): Run "$(MAKE) distcheck" explicitly.
Run vc-diff-check, not vc-dist.
Run $(MAKE) dist with XZ_OPT=-9ev.  Note spelling, with "-".

14 years ago-m(dup2): Texinfo typo
Karl Berry [Thu, 27 Aug 2009 23:21:38 +0000 (16:21 -0700)]
-m(dup2): Texinfo typo

14 years agoRemove test that is outside the specification.
Bruno Haible [Thu, 27 Aug 2009 21:31:13 +0000 (23:31 +0200)]
Remove test that is outside the specification.

14 years agoAvoid sizeof __func__ == 0 pitfall.
Bruno Haible [Thu, 27 Aug 2009 21:30:11 +0000 (23:30 +0200)]
Avoid sizeof __func__ == 0 pitfall.

14 years agoFix link error on Solaris.
Bruno Haible [Thu, 27 Aug 2009 07:08:17 +0000 (09:08 +0200)]
Fix link error on Solaris.

14 years agoignore-value: handle pointer types, too
Pádraig Brady [Wed, 12 Aug 2009 08:37:56 +0000 (09:37 +0100)]
ignore-value: handle pointer types, too

* lib/ignore-value.h (__attribute__): Remove definition.
(ignore_value): Remove use of "__attribute__ ((unused))" in favor
of a more concise and more-often effective "(void) i" statement.
(ignore_ptr): New function to suppress warnings from functions that
return pointers, and to make it explicit that one function doesn't
handle all cases.

14 years agoClarify affected Linux versioins in last commit.
Bruno Haible [Tue, 25 Aug 2009 23:46:26 +0000 (01:46 +0200)]
Clarify affected Linux versioins in last commit.

14 years agodup2: work around a Linux bug.
Bruno Haible [Tue, 25 Aug 2009 08:52:51 +0000 (10:52 +0200)]
dup2: work around a Linux bug.

14 years agolibguestfs uses gnulib
Jim Meyering [Tue, 25 Aug 2009 05:53:06 +0000 (07:53 +0200)]
libguestfs uses gnulib

* users.txt: Add libguestfs.

14 years agodup2, pipe2: fix some recent test failures on cygwin 1.5.x
Eric Blake [Mon, 24 Aug 2009 22:00:44 +0000 (16:00 -0600)]
dup2, pipe2: fix some recent test failures on cygwin 1.5.x

* lib/pipe2.c (includes): Add binary-io.h.
* lib/dup2.c (rpl_dup2): Correct buggy errno value.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoTolerate declared but missing accept4 syscall.
Bruno Haible [Tue, 25 Aug 2009 00:26:18 +0000 (02:26 +0200)]
Tolerate declared but missing accept4 syscall.

14 years agoNew module 'accept4'.
Bruno Haible [Tue, 25 Aug 2009 00:17:09 +0000 (02:17 +0200)]
New module 'accept4'.

14 years agoprogname: also set global program_invocation_name, when possible.
Jim Meyering [Mon, 24 Aug 2009 23:02:32 +0000 (01:02 +0200)]
progname: also set global program_invocation_name, when possible.

Before this change, a libtool-enabled program that calls glibc's
error function would report the program name as
"/abs/dir/.libs/lt-program_name" rather than the desired program_name.
* modules/progname (configure.ac): Check for a declaration of
program_invocation_name.
* lib/progname.c:  Include <errno.h>.
(set_program_name) [HAVE_DECL_PROGRAM_INVOCATION_NAME]:
Set program_invocation_name.

14 years agoInclude string.h, for memset.
Bruno Haible [Mon, 24 Aug 2009 08:41:48 +0000 (10:41 +0200)]
Include string.h, for memset.

14 years agoAvoid running into nonexistent system calls repeatedly.
Bruno Haible [Mon, 24 Aug 2009 00:18:15 +0000 (02:18 +0200)]
Avoid running into nonexistent system calls repeatedly.

14 years agoTolerate declared but missing dup3 syscall.
Bruno Haible [Sun, 23 Aug 2009 22:56:31 +0000 (00:56 +0200)]
Tolerate declared but missing dup3 syscall.

14 years agoTolerate declared but missing pipe2 syscall.
Bruno Haible [Sun, 23 Aug 2009 22:42:22 +0000 (00:42 +0200)]
Tolerate declared but missing pipe2 syscall.

14 years agoMove #ifs inside function.
Bruno Haible [Sun, 23 Aug 2009 22:34:04 +0000 (00:34 +0200)]
Move #ifs inside function.

14 years agoquotearg: document limitations of quote_these_too
Joel E. Denny [Sun, 23 Aug 2009 00:55:17 +0000 (20:55 -0400)]
quotearg: document limitations of quote_these_too

* lib/quotearg.c (quotearg_buffer_restyled): Add comments where
those limitations are created.
* lib/quotearg.h (set_char_quoting): Document that digits and
letters that are special after backslash are not permitted.
(quotearg_char): Cross-reference set_char_quoting documentation.

14 years agoquotearg: implement custom_quoting_style
Joel E. Denny [Sun, 23 Aug 2009 22:24:53 +0000 (18:24 -0400)]
quotearg: implement custom_quoting_style

* lib/quotearg.c: (struct quoting_options): Add left_quote and
right_quote fields.
(set_custom_quoting): New public function.
(quotearg_buffer_restyled): Add left_quote and right_quote
arguments, handle them very much like locale quoting, and update
all uses.
(quotearg_n_custom): New public function.
(quotearg_n_custom_mem): New public function.
(quotearg_custom): New public function.
(quotearg_custom_mem): New public function.
* lib/quotearg.h: Prototype and document new public functions.
(enum quoting_style): For escape_quoting_style and
clocale_quoting_style, comment that QA_SPLIT_TRIGRAPHS is
ignored even though they're otherwise like c_quoting_style.
Add custom_quoting_style member and document with comparison to
clocale_quoting_style.
* tests/test-quotearg.c (custom_quotes): New array.
(custom_results): New array.
(main): Extend to test custom quoting.

14 years agoquotearg: fix right quote escaping when it's in quote_these_too
Joel E. Denny [Sun, 23 Aug 2009 00:26:46 +0000 (20:26 -0400)]
quotearg: fix right quote escaping when it's in quote_these_too

* lib/quotearg.c (quotearg_buffer_restyled): Upon seeing a right
quote, be sure to prepend only one backslash.
* tests/test-quotearg.c (use_quote_double_quotes): New function.
(main): Test it.

14 years agoquotearg-tests: test escaping of embedded locale quotes
Joel E. Denny [Sat, 22 Aug 2009 21:55:15 +0000 (17:55 -0400)]
quotearg-tests: test escaping of embedded locale quotes

* tests/test-quotearg.c (struct result_strings): Add member for
new input.
(LQ_ENC, RQ_ENC, RQ_ESC): New macros.
(inputs): Add new input.
(results_g): Add expected results.
(flag_results): Likewise.
(locale_results): Likewise.
(compare_strings): Check those.

14 years agoTests for module 'dup3'.
Bruno Haible [Sun, 23 Aug 2009 22:19:10 +0000 (00:19 +0200)]
Tests for module 'dup3'.

14 years agoNew module 'dup3'.
Bruno Haible [Sun, 23 Aug 2009 22:17:47 +0000 (00:17 +0200)]
New module 'dup3'.

14 years agoTweak the dup2 test.
Bruno Haible [Sun, 23 Aug 2009 21:47:02 +0000 (23:47 +0200)]
Tweak the dup2 test.

14 years agoAvoid test link errors when the modules getopt-gnu, gettext are used.
Bruno Haible [Sun, 23 Aug 2009 21:00:36 +0000 (23:00 +0200)]
Avoid test link errors when the modules getopt-gnu, gettext are used.

14 years agoFix getdtablesize() on mingw.
Bruno Haible [Sun, 23 Aug 2009 19:55:26 +0000 (21:55 +0200)]
Fix getdtablesize() on mingw.

14 years agoNew module 'mkostemp'.
Bruno Haible [Sun, 23 Aug 2009 12:11:27 +0000 (14:11 +0200)]
New module 'mkostemp'.

14 years agoOops, fix last commit.
Bruno Haible [Sun, 23 Aug 2009 11:10:40 +0000 (13:10 +0200)]
Oops, fix last commit.

14 years agoSupport O_TEXT, O_BINARY on all platforms.
Bruno Haible [Sun, 23 Aug 2009 08:46:39 +0000 (10:46 +0200)]
Support O_TEXT, O_BINARY on all platforms.

14 years agoFix test of fcntl's return value.
Bruno Haible [Sun, 23 Aug 2009 08:20:54 +0000 (10:20 +0200)]
Fix test of fcntl's return value.

14 years agoUpdate module dependencies.
Bruno Haible [Sun, 23 Aug 2009 08:18:14 +0000 (10:18 +0200)]
Update module dependencies.

14 years agofcntl-h: add O_TTY_INIT support
Eric Blake [Sun, 23 Aug 2009 03:24:37 +0000 (21:24 -0600)]
fcntl-h: add O_TTY_INIT support

* lib/fcntl.in.h (O_TTY_INIT): Support another POSIX macro.
* tests/test-fcntl-h.c (o): Test it.
* doc/posix-headers/fcntl.texi (fcntl.h): Update documentation.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofcntl-h: rename from fcntl, in preparation for fcntl(2)
Eric Blake [Fri, 21 Aug 2009 14:26:40 +0000 (08:26 -0600)]
fcntl-h: rename from fcntl, in preparation for fcntl(2)

* modules/fcntl: Move <fcntl.h> header replacement...
* modules/fcntl-h: ...to new name, so as not to collide with
like-named function.
* tests/test-fcntl.c: Rename...
* tests/test-fcntl-h.c: ...to this.  Test FD_CLOEXEC.
* modules/fcntl-tests: Rename...
* modules/fcntl-h-tests: ...to this.  Update test file name.
* modules/chdir-long (Depends-on): Update clients.
* modules/chdir-safer (Depends-on): Likewise.
* modules/fcntl-safer (Depends-on): Likewise.
* modules/fts (Depends-on): Likewise.
* modules/mkancesdirs (Depends-on): Likewise.
* modules/mkdir-p (Depends-on): Likewise.
* modules/open (Depends-on): Likewise.
* modules/savewd (Depends-on): Likewise.
* MODULES.html.sh (systems lacking POSIX:2008): Update name.
* doc/posix-headers/fcntl.texi (fcntl.h): Update documentation.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoRelicense under LGPL.
Bruno Haible [Sun, 23 Aug 2009 00:43:53 +0000 (02:43 +0200)]
Relicense under LGPL.

14 years agoImprove comment about pipe2.
Bruno Haible [Sun, 23 Aug 2009 00:39:38 +0000 (02:39 +0200)]
Improve comment about pipe2.

14 years agoFix test of fcntl's return value.
Bruno Haible [Sat, 22 Aug 2009 23:37:15 +0000 (01:37 +0200)]
Fix test of fcntl's return value.

14 years agoUse module pipe2.
Bruno Haible [Sat, 22 Aug 2009 16:58:09 +0000 (18:58 +0200)]
Use module pipe2.

14 years agoTests for module 'pipe2'.
Bruno Haible [Sat, 22 Aug 2009 16:48:19 +0000 (18:48 +0200)]
Tests for module 'pipe2'.

14 years agoNew module 'pipe2'.
Bruno Haible [Sat, 22 Aug 2009 16:46:44 +0000 (18:46 +0200)]
New module 'pipe2'.

14 years agoReference some new glibc functions.
Bruno Haible [Sat, 22 Aug 2009 13:25:51 +0000 (15:25 +0200)]
Reference some new glibc functions.

14 years agoannotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering [Sat, 22 Aug 2009 09:28:08 +0000 (11:28 +0200)]
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)

This makes it so packages using automake-1.11's silent-rules option
can print e.g., a single "GEN    configmake.h" line, rather than
the 30+ statements that perform the job.  If you want to see the
actual commands, you can still run "make V=1".

Improved-by: Bruno Haible <bruno@clisp.org>
* modules/alloca-opt: Add $(AM_V_GEN) and $(AM_V_at) prefixes
so that make output is abbreviated when those variables are defined
appropriately.
* modules/argz: Likewise.
* modules/arpa_inet: Likewise.
* modules/byteswap: Likewise.
* modules/configmake: Likewise.
* modules/dirent: Likewise.
* modules/errno: Likewise.
* modules/fcntl: Likewise.
* modules/float: Likewise.
* modules/fnmatch: Likewise.
* modules/getopt-posix: Likewise.
* modules/glob: Likewise.
* modules/iconv_open: Likewise.
* modules/inttypes: Likewise.
* modules/localcharset: Likewise.
* modules/locale: Likewise.
* modules/math: Likewise.
* modules/netdb: Likewise.
* modules/netinet_in: Likewise.
* modules/poll: Likewise.
* modules/posix_spawnp-tests: Likewise.
* modules/sched: Likewise.
* modules/search: Likewise.
* modules/selinux-h: Likewise.
* modules/signal: Likewise.
* modules/spawn: Likewise.
* modules/stdarg: Likewise.
* modules/stdbool: Likewise.
* modules/stddef: Likewise.
* modules/stdint: Likewise.
* modules/stdio: Likewise.
* modules/stdlib: Likewise.
* modules/string: Likewise.
* modules/strings: Likewise.
* modules/sys_file: Likewise.
* modules/sys_ioctl: Likewise.
* modules/sys_select: Likewise.
* modules/sys_socket: Likewise.
* modules/sys_stat: Likewise.
* modules/sys_time: Likewise.
* modules/sys_times: Likewise.
* modules/sys_utsname: Likewise.
* modules/sys_wait: Likewise.
* modules/sysexits: Likewise.
* modules/time: Likewise.
* modules/unistd: Likewise.
* modules/wchar: Likewise.
* modules/wctype: Likewise.

14 years agoannounce-gen: remove now-duplicate code at top
Jim Meyering [Sat, 22 Aug 2009 08:07:00 +0000 (10:07 +0200)]
announce-gen: remove now-duplicate code at top

* build-aux/announce-gen: Remove equivalent-but-more-verbose block.

14 years agoannounce-gen: detect write failure
Jim Meyering [Sat, 22 Aug 2009 08:02:19 +0000 (10:02 +0200)]
announce-gen: detect write failure

* build-aux/announce-gen: Add Coda.

14 years agocheck-module: revive
Jim Meyering [Fri, 21 Aug 2009 21:12:35 +0000 (23:12 +0200)]
check-module: revive

* check-module: Ignore legit, duplicate-inclusion violations.

14 years agobootstrap: --help to stdout.
Akim Demaille [Wed, 19 Aug 2009 13:40:08 +0000 (15:40 +0200)]
bootstrap: --help to stdout.

* bootstrap (usage): Don't send --help to stderr.
Use a here doc instead of a long string.

14 years agotest-popen-safer: split from test-popen
Eric Blake [Fri, 21 Aug 2009 13:22:12 +0000 (07:22 -0600)]
test-popen-safer: split from test-popen

* tests/test-popen.c (main): Move...
* tests/test-popen.h: ...into new file.
* tests/test-popen-safer2.c: New file.
* modules/popen-tests (Files): Add test-popen.h.
* modules/popen-safer-tests (Files): Add test-popen-safer2.c.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-fcntl-safer: split from test-open
Eric Blake [Fri, 21 Aug 2009 13:18:10 +0000 (07:18 -0600)]
test-fcntl-safer: split from test-open

* tests/test-open.c (main): Move...
* tests/test-open.h: ...into new file.
* tests/test-fcntl-safer.c: New file.
* modules/open-tests (Files): Add test-open.h.
* modules/fcntl-safer-tests: New file.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-fopen-safer: split from test-fopen
Eric Blake [Fri, 21 Aug 2009 05:19:20 +0000 (23:19 -0600)]
test-fopen-safer: split from test-fopen

* tests/test-fopen.c (main): Move...
* tests/test-fopen.h: ...into new file.
* tests/test-fopen-safer.c: New file.
* modules/fopen-tests (Files): Add test-fopen.h.
* modules/fopen-safer-tests: New file.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agopopen-safer: test O_CLOEXEC at run-time.
Paolo Bonzini [Fri, 21 Aug 2009 07:36:14 +0000 (09:36 +0200)]
popen-safer: test O_CLOEXEC at run-time.

* lib/popen-safer.c: Test O_CLOEXEC at run-time.

14 years agoMove more flags to lib/fcntl.in.h.
Paolo Bonzini [Thu, 20 Aug 2009 08:24:19 +0000 (10:24 +0200)]
Move more flags to lib/fcntl.in.h.

* lib/cloexec.c: Do not define FD_CLOEXEC here.
* lib/popen-safer.c: Do not alias O_NOINHERIT to O_CLOEXEC here.
* lib/fcntl.in.h: Do both things here.

14 years agoconsistently remove $@-t before redirecting to it
Jim Meyering [Fri, 21 Aug 2009 08:56:58 +0000 (10:56 +0200)]
consistently remove $@-t before redirecting to it

* modules/argz: Remove $@-t and $@ before redirecting to the former.
* modules/alloca-opt: Likewise.
* modules/byteswap: Likewise.
* modules/fnmatch: Likewise.
* modules/getopt-posix: Likewise.
* modules/glob: Likewise.
* modules/poll: Likewise.
* modules/posix_spawnp-tests: Likewise.
* modules/sys_socket: Likewise.
* modules/sysexits: Likewise.

14 years agopopen: simplify access to original popen
Eric Blake [Fri, 21 Aug 2009 00:14:41 +0000 (18:14 -0600)]
popen: simplify access to original popen

* lib/popen.c (rpl_popen): No need to worry about popen being a
macro.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agobuild: avoid some compiler warnings
Eric Blake [Thu, 20 Aug 2009 14:21:46 +0000 (08:21 -0600)]
build: avoid some compiler warnings

* lib/selinux-at.h: Use dir_fd, not dirfd, to avoid shadowing.
* lib/exclude.c (fnmatch_pattern_has_wildcards): Use correct
type.
(new_exclude_segment, excluded_file_pattern_p)
(excluded_file_name_p): Reduce scope.
* lib/vasnprintf.c (decimal_point_char): Avoid warning on
old-style declaration.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoexclude-tests: Handle Windows EOL.
Simon Josefsson [Thu, 20 Aug 2009 13:21:27 +0000 (15:21 +0200)]
exclude-tests: Handle Windows EOL.

14 years agobootstrap: find sha1sum when named gsha1sum.
Akim Demaille [Wed, 19 Aug 2009 13:37:23 +0000 (15:37 +0200)]
bootstrap: find sha1sum when named gsha1sum.

* bootstrap (find_tool): New.
($SHA1SUM): New.
Use it.

14 years agomaint.mk: _header_without_use: fix a quoting bug and remove a bash'ism
Jim Meyering [Thu, 20 Aug 2009 09:04:20 +0000 (11:04 +0200)]
maint.mk: _header_without_use: fix a quoting bug and remove a bash'ism

* top/maint.mk (_header_without_use): Use "\\\\", not "\\" in the sed
expression that converts "." in a file name to "\." in the resulting
regexp.  Start with a dummy statement, so that prior shell variable
definitions are expanded portably.  Reported by Simon Josefsson.

14 years agoFix polling for writeability of a screen buffer.
Paolo Bonzini [Tue, 4 Aug 2009 16:06:07 +0000 (18:06 +0200)]
Fix polling for writeability of a screen buffer.

* lib/poll.c: Distinguish input and screen buffers for the
Win32 implementation.
* lib/select.c: Likewise.

14 years agoautoupdate
Karl Berry [Wed, 19 Aug 2009 20:04:16 +0000 (13:04 -0700)]
autoupdate

14 years agopopen-safer: prevent popen from clobbering std descriptors
Eric Blake [Wed, 19 Aug 2009 16:02:19 +0000 (10:02 -0600)]
popen-safer: prevent popen from clobbering std descriptors

* modules/popen-safer: New file.
* lib/popen-safer.c: Likewise.
* m4/stdio-safer.m4 (gl_POPEN_SAFER): New macro.
* lib/stdio--.h (popen): Provide override.
* lib/stdio-safer.h (popen_safer): Provide declaration.
* tests/test-popen.c (includes): Partially test this.
* modules/popen-safer-tests: New file, for more tests.
* tests/test-popen-safer.c: Likewise.
* MODULES.html.sh (file stream based Input/Output): Mention it.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotests: test some of the *-safer modules
Eric Blake [Wed, 19 Aug 2009 15:54:54 +0000 (09:54 -0600)]
tests: test some of the *-safer modules

* modules/fopen-safer (Depends-on): Add fopen.
* modules/fcntl-safer (Depends-on): Add fcntl.
* modules/stdlib-safer (Depends-on): Add stdlib.
(configure.ac): Set indicator.
* modules/unistd-safer (configure.ac): Likewise.
* modules/tmpfile-safer (configure.ac): Likewise.
(Depends-on): Add tmpfile.
* lib/stdio--.h (fopen, tmpfile): Don't override unless module is
active.
* tests/test-fopen.c (includes): Test safer versions when they are
in use.
* tests/test-open.c (includes): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agopopen: fix cygwin 1.5 bug when stdin closed
Eric Blake [Wed, 19 Aug 2009 13:15:54 +0000 (07:15 -0600)]
popen: fix cygwin 1.5 bug when stdin closed

* doc/posix-functions/popen.texi (popen): Document cygwin bugs.
* modules/popen: New file.
* modules/popen-tests: Likewise.
* tests/test-popen.c: Likewise.
* m4/popen.m4: Likewise.
* lib/popen.c: Likewise.
* lib/stdio.in.h (popen): New declaration.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Add popen.
* modules/stdio (Makefile.am): Likewise.
* MODULES.html.sh (systems lacking POSIX:2008): Mention it.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint.mk: give full control over update-copyright exclusions
Joel E. Denny [Tue, 18 Aug 2009 01:41:57 +0000 (21:41 -0400)]
maint.mk: give full control over update-copyright exclusions

* top/maint.mk (VC_LIST_EXCEPT): Instead of ChangeLog, use
${VC_LIST_EXCEPT_DEFAULT-ChangeLog} as the default exclusion.
(update-copyright): Don't force inclusion of top-level
ChangeLog.  Don't force exclusion of all COPYING files, but make
them the default exclusion instead.

14 years agoautoupdate
Karl Berry [Mon, 17 Aug 2009 13:51:21 +0000 (06:51 -0700)]
autoupdate

14 years agoAvoid test failures on Solaris 10.
Bruno Haible [Sun, 16 Aug 2009 21:00:33 +0000 (23:00 +0200)]
Avoid test failures on Solaris 10.

14 years agoFix test failures on Solaris 10.
Bruno Haible [Sun, 16 Aug 2009 20:40:51 +0000 (22:40 +0200)]
Fix test failures on Solaris 10.

14 years agoupdate from texinfo
Karl Berry [Sun, 16 Aug 2009 16:20:30 +0000 (09:20 -0700)]
update from texinfo