From 111408a0e9eb3a9492c4057ac7d6ddbb8b365aa9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 6 Jun 2019 08:56:03 -0700 Subject: [PATCH] Update from Gnulib This incorporates: 2019-06-04 copy-file-range: new module 2019-05-28 binaty-io: O_BINARY on consoles no longer fails * doc/misc/texinfo.tex, lib/binary-io.c, lib/binary-io.h: * lib/unistd.in.h, m4/unistd_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate. --- doc/misc/texinfo.tex | 7 +++---- lib/binary-io.c | 16 +++++++++------- lib/binary-io.h | 14 +++++--------- lib/gnulib.mk.in | 4 ++++ lib/unistd.in.h | 18 ++++++++++++++++++ m4/unistd_h.m4 | 4 +++- 6 files changed, 42 insertions(+), 21 deletions(-) diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 53f2fc4835b..ed3f0ee98f4 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-05-18.15} +\def\texinfoversion{2019-06-01.23} % % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. % @@ -5317,7 +5317,7 @@ end % the current value of \escapechar. \def\escapeisbackslash{\escapechar=`\\} -% Use \ in index files by default. texi2dvi didn't support @ as as the escape +% Use \ in index files by default. texi2dvi didn't support @ as the escape % character (as it checked for "\entry" in the files, and not "@entry"). When % the new version of texi2dvi has had a chance to become more prevalent, then % the escape character can change back to @ again. This should be an easy @@ -5546,7 +5546,6 @@ might help (with 'rm \jobname.?? \jobname.??s')% \enddoublecolumns \fi \else - \message{trying to print index \indexname}% \begindoublecolumns \catcode`\\=0\relax \catcode`\@=12\relax @@ -5867,7 +5866,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% } -% Finished with with double columns. +% Finished with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the diff --git a/lib/binary-io.c b/lib/binary-io.c index 01e0bf64765..77490e68e3b 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -20,18 +20,20 @@ #include "binary-io.h" #if defined __DJGPP__ || defined __EMX__ -# include # include int -__gl_setmode_check (int fd) +set_binary_mode (int fd, int mode) { if (isatty (fd)) - { - errno = EINVAL; - return -1; - } + /* If FD refers to a console (not a pipe, not a regular file), + O_TEXT is the only reasonable mode, both on input and on output. + Silently ignore the request. If we were to return -1 here, + all programs that use xset_binary_mode would fail when run + with console input or console output. */ + return O_TEXT; else - return 0; + return __gl_setmode (fd, mode); } + #endif diff --git a/lib/binary-io.h b/lib/binary-io.h index 720b08c7551..8d4133b0f38 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -53,25 +53,21 @@ __gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) } #endif -#if defined __DJGPP__ || defined __EMX__ -extern int __gl_setmode_check (int); -#else -BINARY_IO_INLINE int -__gl_setmode_check (int fd _GL_UNUSED) { return 0; } -#endif - /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. Return the old mode if successful, -1 (setting errno) on failure. Ordinarily this function would be called 'setmode', since that is its name on MS-Windows, but it is called 'set_binary_mode' here to avoid colliding with a BSD function of another name. */ +#if defined __DJGPP__ || defined __EMX__ +extern int set_binary_mode (int fd, int mode); +#else BINARY_IO_INLINE int set_binary_mode (int fd, int mode) { - int r = __gl_setmode_check (fd); - return r != 0 ? r : __gl_setmode (fd, mode); + return __gl_setmode (fd, mode); } +#endif /* This macro is obsolescent. */ #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 1cbbff212bb..403d83829cd 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -252,6 +252,7 @@ GNULIB_CHDIR = @GNULIB_CHDIR@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ GNULIB_CLOSEDIR = @GNULIB_CLOSEDIR@ +GNULIB_COPY_FILE_RANGE = @GNULIB_COPY_FILE_RANGE@ GNULIB_CTIME = @GNULIB_CTIME@ GNULIB_DIRFD = @GNULIB_DIRFD@ GNULIB_DPRINTF = @GNULIB_DPRINTF@ @@ -489,6 +490,7 @@ HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ +HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ HAVE_DECL_DIRFD = @HAVE_DECL_DIRFD@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ @@ -3115,6 +3117,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ @@ -3165,6 +3168,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ + -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 7778d25dc7e..94a8f383c99 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -331,6 +331,24 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " #endif +#if @GNULIB_COPY_FILE_RANGE@ +# if !@HAVE_COPY_FILE_RANGE@ +_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, + int ofd, off_t *opos, + size_t len, unsigned flags)); +_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, + int ofd, off_t *opos, + size_t len, unsigned flags)); +# endif +_GL_CXXALIASWARN (copy_file_range); +#elif defined GNULIB_POSIXCHECK +/* Assume copy_file_range is always declared. */ +_GL_WARN_ON_USE (copy_file_range, + "copy_file_range is unportable - " + "use gnulib module copy_file_range for portability"); +#endif + + #if @GNULIB_DUP@ # if @REPLACE_DUP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index a04055d2aa8..a3b3905f84e 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 74 +# unistd_h.m4 serial 75 dnl Copyright (C) 2006-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) + GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE]) GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) @@ -113,6 +114,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) + HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) -- 2.39.2