aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2025-08-02 10:47:03 -0700
committerPaul Eggert2025-08-02 11:19:24 -0700
commit687d3cb03bddd7eebf6384001fc54ca2c7e80037 (patch)
tree664dbb5dbf966c72df4cd8dcc0567b501183f773
parent84f1080f67c0960cca2d456c68e2d7866c19462c (diff)
downloademacs-687d3cb03bddd7eebf6384001fc54ca2c7e80037.tar.gz
emacs-687d3cb03bddd7eebf6384001fc54ca2c7e80037.zip
Update from Gnulib by running admin/merge-gnulib
* lib/sys-limits.h: New file.
-rw-r--r--doc/misc/texinfo.tex31
-rw-r--r--lib/copy-file-range.c72
-rw-r--r--lib/gnulib.mk.in2
-rw-r--r--lib/sys-limits.h42
-rw-r--r--m4/copy-file-range.m45
-rw-r--r--m4/gnulib-comp.m41
6 files changed, 119 insertions, 34 deletions
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 42e686ce705..64dddad8290 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2025-07-15.21} 6\def\texinfoversion{2025-07-31.19}
7% 7%
8% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. 8% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
9% 9%
@@ -9634,7 +9634,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9634% Auto-number footnotes. Otherwise like plain. 9634% Auto-number footnotes. Otherwise like plain.
9635\gdef\footnote{% 9635\gdef\footnote{%
9636 \global\advance\footnoteno by \@ne 9636 \global\advance\footnoteno by \@ne
9637 \edef\thisfootno{$^{\the\footnoteno}$}% 9637 %
9638 % Output for the footnote marker. If we are immediately after another
9639 % footnote, output a comma and small space first.
9640 \edef\thisfootno{$^{\ifnum\lastpenalty=3 ,\mskip 1mu \fi\the\footnoteno}$}%
9638 % 9641 %
9639 % In case the footnote comes at the end of a sentence, preserve the 9642 % In case the footnote comes at the end of a sentence, preserve the
9640 % extra spacing after we do the footnote number. 9643 % extra spacing after we do the footnote number.
@@ -9643,19 +9646,25 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9643 % 9646 %
9644 % Remove inadvertent blank space before typesetting the footnote number. 9647 % Remove inadvertent blank space before typesetting the footnote number.
9645 \unskip 9648 \unskip
9646 \thisfootno\@sf 9649 %
9650 % \scriptspace is 0.5pt by default and gives excessive space before the
9651 % comma if we have multiple footnote markers in a row.
9652 \bgroup\scriptspace=0pt
9653 \thisfootno\@sf
9654 \egroup
9647 \dofootnote 9655 \dofootnote
9648}% 9656}%
9649 9657
9650% Don't bother with the trickery in plain.tex to not require the 9658% marker for immediately after a footnote marker
9651% footnote text as a parameter. Our footnotes don't need to be so general. 9659\gdef\footnoteendmarker{\penalty3 }
9652% 9660
9653% Oh yes, they do; otherwise, @ifset (and anything else that uses 9661% Do not require the footnote text as a parameter; otherwise, @ifset
9654% \parseargline) fails inside footnotes because the tokens are fixed when 9662% (and anything else that uses \parseargline) fails inside footnotes
9655% the footnote is read. --karl, 16nov96. 9663% because the tokens are fixed when the footnote is read.
9656% 9664%
9657\gdef\dofootnote{% 9665\gdef\dofootnote{%
9658 \insert\footins\bgroup 9666 \insert\footins\bgroup
9667 \aftergroup\footnoteendmarker
9659 % 9668 %
9660 % Nested footnotes are not supported in TeX, that would take a lot 9669 % Nested footnotes are not supported in TeX, that would take a lot
9661 % more work. (\startsavinginserts does not suffice.) 9670 % more work. (\startsavinginserts does not suffice.)
@@ -9686,14 +9695,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
9686 % Hang the footnote text off the number. Use \everypar in case the 9695 % Hang the footnote text off the number. Use \everypar in case the
9687 % footnote extends for more than one paragraph. 9696 % footnote extends for more than one paragraph.
9688 \everypar = {\hang}% 9697 \everypar = {\hang}%
9689 \textindent{\thisfootno}% 9698 \textindent{$^{\the\footnoteno}$}%
9690 % 9699 %
9691 % Don't crash into the line above the footnote text. Since this 9700 % Don't crash into the line above the footnote text. Since this
9692 % expands into a box, it must come within the paragraph, lest it 9701 % expands into a box, it must come within the paragraph, lest it
9693 % provide a place where TeX can split the footnote. 9702 % provide a place where TeX can split the footnote.
9694 \footstrut 9703 \footstrut
9695 % 9704 %
9696 % Invoke rest of plain TeX footnote routine. 9705 % Eat opening brace and invoke rest of plain TeX footnote routine.
9697 \futurelet\next\fo@t 9706 \futurelet\next\fo@t
9698} 9707}
9699}%end \catcode `\@=11 9708}%end \catcode `\@=11
diff --git a/lib/copy-file-range.c b/lib/copy-file-range.c
index 8e0c644c086..2465a558028 100644
--- a/lib/copy-file-range.c
+++ b/lib/copy-file-range.c
@@ -21,9 +21,22 @@
21#include <errno.h> 21#include <errno.h>
22 22
23#if defined __linux__ && HAVE_COPY_FILE_RANGE 23#if defined __linux__ && HAVE_COPY_FILE_RANGE
24# include <linux/version.h>
24# include <sys/utsname.h> 25# include <sys/utsname.h>
26/* Although it can be dicey to use static checks for Linux kernel versions,
27 due to the dubious practice of building on newer kernels for older ones,
28 do it here anyway as the buggy kernels are rare (they are all EOLed)
29 and builders for them are unlikely to use the dubious practice.
30 Circa 2029 we should remove the old-kernel workarounds entirely. */
31# if LINUX_VERSION_CODE < KERNEL_VERSION (5, 3, 0)
32# define CHECK_LINUX_KERNEL_VERSION true
33# else
34# define CHECK_LINUX_KERNEL_VERSION false
35# endif
25#endif 36#endif
26 37
38#include "sys-limits.h"
39
27ssize_t 40ssize_t
28copy_file_range (int infd, off_t *pinoff, 41copy_file_range (int infd, off_t *pinoff,
29 int outfd, off_t *poutoff, 42 int outfd, off_t *poutoff,
@@ -31,32 +44,51 @@ copy_file_range (int infd, off_t *pinoff,
31{ 44{
32#undef copy_file_range 45#undef copy_file_range
33 46
34#if defined __linux__ && HAVE_COPY_FILE_RANGE 47#if HAVE_COPY_FILE_RANGE
48 bool ok = true;
49
50# if CHECK_LINUX_KERNEL_VERSION
35 /* The implementation of copy_file_range (which first appeared in 51 /* The implementation of copy_file_range (which first appeared in
36 Linux kernel release 4.5) had many issues before release 5.3 52 Linux kernel release 4.5) had many issues before release 5.3
37 <https://lwn.net/Articles/789527/>, so fail with ENOSYS for Linux 53 <https://lwn.net/Articles/789527/>, so fail with ENOSYS for Linux
38 kernels 5.2 and earlier. 54 kernels 5.2 and earlier.
39 55
40 This workaround, and the configure-time check for Linux, can be 56 This workaround can be removed when such kernels (released March
41 removed when such kernels (released March 2016 through September 57 2016 through September 2019) are no longer a consideration.
42 2019) are no longer a consideration. As of January 2021, the 58 Although all such kernels have reached EOL, some distros use
43 furthest-future planned kernel EOL is December 2024 for kernel 59 older kernels. For example, RHEL 8 uses kernel 4.18 and has an
44 release 4.19. */ 60 EOL of 2029. */
45 61
46 static signed char ok; 62 static signed char kernel_ok;
47 63 if (! kernel_ok)
48 if (! ok) 64 {
49 { 65 struct utsname name;
50 struct utsname name; 66 uname (&name);
51 uname (&name); 67 char *p = name.release;
52 char *p = name.release; 68 kernel_ok = ((p[1] != '.' || '5' < p[0]
53 ok = ((p[1] != '.' || '5' < p[0] 69 || (p[0] == '5' && (p[3] != '.' || '2' < p[2])))
54 || (p[0] == '5' && (p[3] != '.' || '2' < p[2]))) 70 ? 1 : -1);
55 ? 1 : -1); 71 }
56 } 72
57 73 if (kernel_ok < 0)
58 if (0 < ok) 74 ok = false;
75# endif
76
77 if (ok)
78 {
79# if defined __GLIBC__ && ! (2 < __GLIBC__ + (43 <= __GLIBC_MINOR__))
80 /* Work around glibc bug 33245
81 <https://sourceware.org/bugzilla/show_bug.cgi?id=33245>.
82 This bug is present in glibc 2.42 (2025) and fixed in 2.43,
83 so this workaround, and the configure-time check for glibc,
84 can be removed once glibc 2.42 and earlier is no longer a
85 consideration. Perhaps in 2040. */
86 if (SYS_BUFSIZE_MAX < length)
87 length = SYS_BUFSIZE_MAX;
88# endif
89
59 return copy_file_range (infd, pinoff, outfd, poutoff, length, flags); 90 return copy_file_range (infd, pinoff, outfd, poutoff, length, flags);
91 }
60#endif 92#endif
61 93
62 /* There is little need to emulate copy_file_range with read+write, 94 /* There is little need to emulate copy_file_range with read+write,
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index b3774a648b8..fa800300a42 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1799,6 +1799,8 @@ ifneq (,$(GL_COND_OBJ_COPY_FILE_RANGE_CONDITION))
1799libgnu_a_SOURCES += copy-file-range.c 1799libgnu_a_SOURCES += copy-file-range.c
1800endif 1800endif
1801 1801
1802EXTRA_DIST += sys-limits.h
1803
1802endif 1804endif
1803## end gnulib module copy-file-range 1805## end gnulib module copy-file-range
1804 1806
diff --git a/lib/sys-limits.h b/lib/sys-limits.h
new file mode 100644
index 00000000000..a556dfeb6d5
--- /dev/null
+++ b/lib/sys-limits.h
@@ -0,0 +1,42 @@
1/* System call limits
2
3 Copyright 2018-2025 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _GL_SYS_LIMITS_H
19#define _GL_SYS_LIMITS_H
20
21#include <limits.h>
22
23/* Maximum number of bytes to read or write in a single system call.
24 This can be useful for system calls like sendfile on GNU/Linux,
25 which do not handle more than MAX_RW_COUNT bytes correctly.
26 The Linux kernel MAX_RW_COUNT is at least INT_MAX >> 20 << 20,
27 where the 20 comes from the Hexagon port with 1 MiB pages; use that
28 as an approximation, as the exact value may not be available to us.
29
30 Using this also works around a serious Linux bug before 2.6.16; see
31 <https://bugzilla.redhat.com/show_bug.cgi?id=612839>.
32
33 Using this also works around a Tru64 5.1 bug, where attempting
34 to read INT_MAX bytes fails with errno == EINVAL. See
35 <https://lists.gnu.org/r/bug-gnu-utils/2002-04/msg00010.html>.
36
37 Using this is likely to work around similar bugs in other operating
38 systems. */
39
40enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 };
41
42#endif
diff --git a/m4/copy-file-range.m4 b/m4/copy-file-range.m4
index 13081d9b11c..85cfef71f44 100644
--- a/m4/copy-file-range.m4
+++ b/m4/copy-file-range.m4
@@ -51,9 +51,8 @@ AC_DEFUN([gl_FUNC_COPY_FILE_RANGE],
51 [Define to 1 if the function copy_file_range exists.]) 51 [Define to 1 if the function copy_file_range exists.])
52 52
53 case $host_os in 53 case $host_os in
54 linux*) 54 *-gnu* | gnu* | linux*)
55 # See copy-file-range.c comment re pre-5.3 Linux kernel bugs. 55 # See copy-file-range.c comment re glibc and Linux kernel bugs.
56 # We should be able to remove this hack in 2025.
57 REPLACE_COPY_FILE_RANGE=1;; 56 REPLACE_COPY_FILE_RANGE=1;;
58 esac 57 esac
59 fi 58 fi
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 83d5f1bfa0f..107b1493617 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -1420,6 +1420,7 @@ AC_DEFUN([gl_FILE_LIST], [
1420 lib/strtol.c 1420 lib/strtol.c
1421 lib/strtoll.c 1421 lib/strtoll.c
1422 lib/symlink.c 1422 lib/symlink.c
1423 lib/sys-limits.h
1423 lib/sys_random.in.h 1424 lib/sys_random.in.h
1424 lib/sys_select.in.h 1425 lib/sys_select.in.h
1425 lib/sys_stat.in.h 1426 lib/sys_stat.in.h