[packages/glibc] Up to 2.35. static-pie configure option is gone
arekm
arekm at pld-linux.org
Thu Feb 3 15:48:19 CET 2022
commit 91078412c65c94e8f032e2c09eb6aca5eb315e43
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Feb 3 15:47:11 2022 +0100
Up to 2.35. static-pie configure option is gone
branch.sh | 4 +-
glibc-arm-alignment-fix.patch | 28 --
glibc-c-utf8-locale.patch | 270 ------------------
glibc-cmsg-time64-fix.patch | 15 -
glibc-new-charsets.patch | 2 +-
glibc-no-bash-nls.patch | 8 +-
glibc-regex-bug11053.patch | 629 ------------------------------------------
glibc.spec | 32 +--
8 files changed, 15 insertions(+), 973 deletions(-)
---
diff --git a/glibc.spec b/glibc.spec
index 3a6f9a9..9bd9da1 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -19,7 +19,6 @@
%bcond_with bash_nls # use bash NLS in shell scripts (ldd, sotruss); restores /bin/bash dep
%bcond_without cet # Intel Control-flow Enforcement Technology (CET)
%bcond_with crypt # don't build obsolete libcrypt
-%bcond_without static_pie # disable static PIE support
#
%ifarch %{ix86} %{x8664}
%{!?min_kernel:%global min_kernel 3.2.0}
@@ -33,11 +32,8 @@
%ifnarch i686 %{x8664} x32
%undefine with_cet
%endif
-%ifarch %{arm}
-%undefine with_static_pie
-%endif
-%define core_version 2.34
+%define core_version 2.35
%define llh_version 7:2.6.32.1-1
Summary: GNU libc
@@ -51,12 +47,12 @@ Summary(tr.UTF-8): GNU libc
Summary(uk.UTF-8): GNU libc версії
Name: glibc
Version: %{core_version}
-Release: 11
+Release: 1
Epoch: 6
License: LGPL v2.1+
Group: Libraries
Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz
-# Source0-md5: 31998b53fb39cb946e96abc310af1c89
+# Source0-md5: dd571c67d85d89d7f60b854a4e207423
Source2: nscd.init
Source3: nscd.sysconfig
Source4: nscd.logrotate
@@ -68,15 +64,14 @@ Source7: %{name}-LD-path.c
Source9: nscd.tmpfiles
# use branch.sh to update glibc-git.patch
Patch0: glibc-git.patch
-# Patch0-md5: 0f273932f5b4a7c6efd0984f5f3176a4
+# Patch0-md5: 514da08d86b396f7931841c0cd86a660
# against GNU TP (libc domain)
#Patch1: %{name}-pl.po-update.patch
Patch2: %{name}-pld.patch
Patch3: %{name}-crypt-blowfish.patch
Patch4: %{name}-no-bash-nls.patch
-Patch5: %{name}-regex-bug11053.patch
+
Patch6: %{name}-paths.patch
-Patch7: %{name}-cmsg-time64-fix.patch
Patch10: %{name}-info.patch
Patch11: %{name}-autoconf.patch
@@ -92,10 +87,6 @@ Patch19: %{name}-ZA_collate.patch
Patch23: %{name}-pt_pax.patch
-# http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-c-utf8-locale.patch
-Patch27: %{name}-c-utf8-locale.patch
-
-Patch29: %{name}-arm-alignment-fix.patch
Patch30: glibc-rh1124987.patch
URL: http://www.gnu.org/software/libc/
%{?with_selinux:BuildRequires: audit-libs-devel}
@@ -955,9 +946,8 @@ exit 1
%patch2 -p1
%patch3 -p1
%{!?with_bash_nls:%patch4 -p1}
-%patch5 -p1
+
%patch6 -p1
-%patch7 -p1
%patch10 -p1
%patch11 -p1
@@ -971,9 +961,6 @@ exit 1
%patch23 -p0
-%patch27 -p1
-
-%patch29 -p1
%patch30 -p1
# cleanup backups after patching
@@ -1017,7 +1004,6 @@ AWK="gawk" \
--enable-profile \
--enable-stack-protector=strong \
--enable-stackguard-randomization \
- %{?with_static_pie:--enable-static-pie} \
--enable-tunables \
--with-binutils=$(pwd)/alt-tools \
--with-bugurl=http://bugs.pld-linux.org/ \
@@ -1456,7 +1442,6 @@ fi
%else
%attr(755,root,root) /%{_lib}/libBrokenLocale.so.1
%endif
-%attr(755,root,root) /%{_lib}/libSegFault.so
%attr(755,root,root) /%{_lib}/libanl.so.1
%ifarch alpha ia64
%attr(755,root,root) /%{_lib}/libc.so.6.1
@@ -1518,6 +1503,7 @@ fi
%attr(755,root,root) %{_bindir}/getconf
%attr(755,root,root) %{_bindir}/getent
%attr(755,root,root) %{_bindir}/iconv
+%attr(755,root,root) %{_bindir}/ld.so
%attr(755,root,root) %{_bindir}/locale
%attr(755,root,root) %{_bindir}/zdump
%attr(755,root,root) %{_sbindir}/zic
@@ -1770,7 +1756,6 @@ fi
%files misc
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/catchsegv
%attr(755,root,root) %{_bindir}/ldd
%attr(755,root,root) %{_bindir}/pldd
%ifarch %{ix86} m68k sparc sparcv9
@@ -1780,7 +1765,6 @@ fi
%dir %{_libdir}/audit
%attr(755,root,root) %{_libdir}/audit/sotruss-lib.so
-%{_mandir}/man1/catchsegv.1*
%{_mandir}/man1/ldd.1*
%{_mandir}/man1/pldd.1*
%lang(cs) %{_mandir}/cs/man1/ldd.1*
@@ -1873,7 +1857,7 @@ fi
%{_libdir}/libutil.a
%{_libdir}/crt[1in].o
%{_libdir}/[MSgr]crt1.o
-%{?with_static_pie:%{_libdir}/grcrt1.o}
+%{_libdir}/grcrt1.o
# ld scripts
%{_libdir}/libc.so
# static-only libs
diff --git a/branch.sh b/branch.sh
index ef57bb8..275c2d6 100755
--- a/branch.sh
+++ b/branch.sh
@@ -2,8 +2,8 @@
set -e
url=git://sourceware.org/git/glibc.git
package=glibc
-tag=glibc-2.34
-branch=release/2.34/master
+tag=glibc-2.35
+branch=release/2.35/master
out=$package-git.patch
repo=$package.git
diff --git a/glibc-arm-alignment-fix.patch b/glibc-arm-alignment-fix.patch
deleted file mode 100644
index 53a38ed..0000000
--- a/glibc-arm-alignment-fix.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -dur glibc-2.11.backup/sysdeps/arm/dl-machine.h glibc-2.11/sysdeps/arm/dl-machine.h
---- glibc-2.11.backup/sysdeps/arm/dl-machine.h 2009-11-10 08:12:18.000000000 +0100
-+++ glibc-2.11/sysdeps/arm/dl-machine.h 2009-11-11 10:07:48.030872826 +0100
-@@ -585,13 +585,22 @@
- }
- # endif
-
-+union arm_unaligned_data {
-+ Elf32_Addr l_addr;
-+} __attribute__ ((packed));
-+
- auto inline void
- __attribute__ ((always_inline))
- elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
- void *const reloc_addr_arg)
- {
-- Elf32_Addr *const reloc_addr = reloc_addr_arg;
-- *reloc_addr += l_addr;
-+ if (((long)reloc_addr_arg) & 0x3) {
-+ union arm_unaligned_data *const lpdata = reloc_addr_arg;
-+ lpdata->l_addr += l_addr;
-+ } else {
-+ Elf32_Addr *const reloc_addr = reloc_addr_arg;
-+ *reloc_addr += l_addr;
-+ }
- }
-
- # ifndef RTLD_BOOTSTRAP
diff --git a/glibc-c-utf8-locale.patch b/glibc-c-utf8-locale.patch
deleted file mode 100644
index 7fabf30..0000000
--- a/glibc-c-utf8-locale.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001
-From: Mike FABIAN <mfabian at redhat.com>
-Date: Mon, 10 Aug 2015 15:58:12 +0200
-Subject: [PATCH] Add a C.UTF-8 locale
-
----
- localedata/SUPPORTED | 1 +
- localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 239 insertions(+)
- create mode 100644 localedata/locales/C
-
-diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
-index 8ca023e..2a78391 100644
---- a/localedata/SUPPORTED
-+++ b/localedata/SUPPORTED
-@@ -1,6 +1,7 @@
- # This file names the currently supported and somewhat tested locales.
- # If you have any additions please file a glibc bug report.
- SUPPORTED-LOCALES=\
-+C.UTF-8/UTF-8 \
- aa_DJ.UTF-8/UTF-8 \
- aa_DJ/ISO-8859-1 \
- aa_ER/UTF-8 \
-diff --git a/localedata/locales/C b/localedata/locales/C
-new file mode 100644
-index 0000000..fdf460e
---- /dev/null
-+++ b/localedata/locales/C
-@@ -0,0 +1,238 @@
-+escape_char /
-+comment_char %
-+% Locale for C locale in UTF-8
-+
-+LC_IDENTIFICATION
-+title "C locale"
-+source ""
-+address ""
-+contact ""
-+email "mfabian at redhat.com"
-+tel ""
-+fax ""
-+language "C"
-+territory ""
-+revision "1.0"
-+date "2015-08-10"
-+%
-+category "i18n:2012";LC_IDENTIFICATION
-+category "i18n:2012";LC_CTYPE
-+category "i18n:2012";LC_COLLATE
-+category "i18n:2012";LC_TIME
-+category "i18n:2012";LC_NUMERIC
-+category "i18n:2012";LC_MONETARY
-+category "i18n:2012";LC_MESSAGES
-+category "i18n:2012";LC_PAPER
-+category "i18n:2012";LC_NAME
-+category "i18n:2012";LC_ADDRESS
-+category "i18n:2012";LC_TELEPHONE
-+category "i18n:2012";LC_MEASUREMENT
-+END LC_IDENTIFICATION
-+
-+LC_CTYPE
-+copy "i18n"
-+
-+translit_start
-+include "translit_combining";""
-+translit_end
-+
-+END LC_CTYPE
-+
-+LC_COLLATE
-+order_start forward
-+<U0000>
-+..
-+<UFFFF>
-+<U10000>
-+..
-+<U1FFFF>
-+<U20000>
-+..
-+<U2FFFF>
-+<UE0000>
-+..
-+<UEFFFF>
-+<UF0000>
-+..
-+<UFFFFF>
-+<U100000>
-+..
-+<U10FFFF>
-+UNDEFINED
-+order_end
-+END LC_COLLATE
-+
-+LC_MONETARY
-+% This is the 14652 i18n fdcc-set definition for
-+% the LC_MONETARY category
-+% (except for the int_curr_symbol and currency_symbol, they are empty in
-+% the 14652 i18n fdcc-set definition and also empty in
-+% glibc/locale/C-monetary.c. But localedef complains in that case).
-+%
-+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
-+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
-+int_curr_symbol "<U0055><U0053><U0044><U0020>"
-+% Using "$" for currency_symbol. But maybe <U00A4> would be better?
-+% U+00A4 is the "generic currency symbol"
-+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
-+currency_symbol "<U0024>"
-+mon_decimal_point "<U002E>"
-+mon_thousands_sep ""
-+mon_grouping -1
-+positive_sign ""
-+negative_sign "<U002D>"
-+int_frac_digits -1
-+frac_digits -1
-+p_cs_precedes -1
-+int_p_sep_by_space -1
-+p_sep_by_space -1
-+n_cs_precedes -1
-+int_n_sep_by_space -1
-+n_sep_by_space -1
-+p_sign_posn -1
-+n_sign_posn -1
-+%
-+END LC_MONETARY
-+
-+LC_NUMERIC
-+% This is the POSIX Locale definition for
-+% the LC_NUMERIC category.
-+%
-+decimal_point "<U002E>"
-+thousands_sep ""
-+grouping -1
-+END LC_NUMERIC
-+
-+LC_TIME
-+% This is the POSIX Locale definition for
-+% the LC_TIME category.
-+%
-+% Abbreviated weekday names (%a)
-+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
-+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
-+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
-+ "<U0053><U0061><U0074>"
-+
-+% Full weekday names (%A)
-+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
-+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
-+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
-+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
-+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
-+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
-+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
-+
-+% Abbreviated month names (%b)
-+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
-+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
-+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
-+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
-+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
-+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
-+
-+% Full month names (%B)
-+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
-+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
-+ "<U004D><U0061><U0072><U0063><U0068>";/
-+ "<U0041><U0070><U0072><U0069><U006C>";/
-+ "<U004D><U0061><U0079>";/
-+ "<U004A><U0075><U006E><U0065>";/
-+ "<U004A><U0075><U006C><U0079>";/
-+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
-+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
-+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
-+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
-+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
-+
-+% Week description, consists of three fields:
-+% 1. Number of days in a week.
-+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
-+% 3. The weekday number to be contained in the first week of the year.
-+%
-+% ISO 8601 conforming applications should use the values 7, 19971201 (a
-+% Monday), and 4 (Thursday), respectively.
-+week 7;19971201;4
-+first_weekday 1
-+first_workday 1
-+
-+% Appropriate date and time representation (%c)
-+% "%a %b %e %H:%M:%S %Y"
-+d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
-+
-+% Appropriate date representation (%x)
-+% "%m/%d/%y"
-+d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
-+
-+% Appropriate time representation (%X)
-+% "%H:%M:%S"
-+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
-+
-+% Appropriate AM/PM time representation (%r)
-+% "%I:%M:%S %p"
-+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
-+
-+% Equivalent of AM/PM (%p) "AM"/"PM"
-+%
-+am_pm "<U0041><U004D>";"<U0050><U004D>"
-+
-+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
-+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
-+END LC_TIME
-+
-+LC_MESSAGES
-+% This is the POSIX Locale definition for
-+% the LC_NUMERIC category.
-+%
-+yesexpr "<U005E><U005B><U0079><U0059><U005D>"
-+noexpr "<U005E><U005B><U006E><U004E><U005D>"
-+yesstr "<U0059><U0065><U0073>"
-+nostr "<U004E><U006F>"
-+END LC_MESSAGES
-+
-+LC_PAPER
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_PAPER category.
-+% (A4 paper, this is also used in the built in C/POSIX
-+% locale in glibc/locale/C-paper.c)
-+height 297
-+width 210
-+END LC_PAPER
-+
-+LC_NAME
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_NAME category.
-+% "%p%t%g%t%m%t%f"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
-+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
-+<U0025><U006D><U0025><U0074><U0025><U0066>"
-+END LC_NAME
-+
-+LC_ADDRESS
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_ADDRESS category.
-+% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
-+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
-+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
-+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
-+<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
-+<U004E><U0025><U0063><U0025><U004E>"
-+END LC_ADDRESS
-+
-+LC_TELEPHONE
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_TELEPHONE category.
-+% "+%c %a %l"
-+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
-+<U006C>"
-+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
-+END LC_TELEPHONE
-+
-+LC_MEASUREMENT
-+% This is the ISO/IEC 14652 "i18n" definition for
-+% the LC_MEASUREMENT category.
-+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
-+%metric
-+measurement 1
-+END LC_MEASUREMENT
-+
---
-2.4.3
-
diff --git a/glibc-cmsg-time64-fix.patch b/glibc-cmsg-time64-fix.patch
deleted file mode 100644
index e9c97d5..0000000
--- a/glibc-cmsg-time64-fix.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-https://sourceware.org/bugzilla/show_bug.cgi?id=28350
---- glibc-2.34/sysdeps/unix/sysv/linux/convert_scm_timestamps.c.orig 2021-08-02 03:33:43.000000000 +0200
-+++ glibc-2.34/sysdeps/unix/sysv/linux/convert_scm_timestamps.c 2021-12-14 06:27:02.255687500 +0100
-@@ -55,7 +55,10 @@ __convert_scm_timestamps (struct msghdr
- cmsg = CMSG_NXTHDR (msg, cmsg))
- {
- if (cmsg->cmsg_level != SOL_SOCKET)
-- continue;
-+ {
-+ last = cmsg;
-+ continue;
-+ }
-
- switch (cmsg->cmsg_type)
- {
diff --git a/glibc-new-charsets.patch b/glibc-new-charsets.patch
index f041922..0377d22 100644
--- a/glibc-new-charsets.patch
+++ b/glibc-new-charsets.patch
@@ -27,7 +27,7 @@ diff -urNp -x '*.orig' glibc-2.33.org/iconvdata/Makefile glibc-2.33/iconvdata/Ma
- hp-thai8 hp-greek8 cp770 cp771 cp772 cp773 cp774
+ hp-thai8 hp-greek8 cp770 cp771 cp772 cp773 cp774 \
+ iscii-dev khmer-ns mulelao-1 tatar-cyr \
-+ koi8-k koi8-ru iso8859-7-euro
++ koi8-k iso8859-7-euro
gen-special-modules := iso8859-7jp
diff --git a/glibc-no-bash-nls.patch b/glibc-no-bash-nls.patch
index f5d8a2a..40ecb7e 100644
--- a/glibc-no-bash-nls.patch
+++ b/glibc-no-bash-nls.patch
@@ -3,7 +3,7 @@
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
- # Copyright (C) 1996-2021 Free Software Foundation, Inc.
+ # Copyright (C) 1996-2022 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -35,16 +35,16 @@
@@ -14,7 +14,7 @@
+ printf "Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- " "2021"
+ " "2022"
- printf $"Written by %s and %s.
+ printf "Written by %s and %s.
" "Roland McGrath" "Ulrich Drepper"
@@ -111,7 +111,7 @@
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
- # Copyright (C) 2011-2021 Free Software Foundation, Inc.
+ # Copyright (C) 2011-2022 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -29,7 +29,7 @@
@@ -166,7 +166,7 @@
+ printf "Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- " "2021"
+ " "2022"
- printf $"Written by %s.\n" "Ulrich Drepper"
+ printf "Written by %s.\n" "Ulrich Drepper"
exit 0
diff --git a/glibc-regex-bug11053.patch b/glibc-regex-bug11053.patch
deleted file mode 100644
index 28d8fb3..0000000
--- a/glibc-regex-bug11053.patch
+++ /dev/null
@@ -1,629 +0,0 @@
-From: Paul Eggert <eggert at cs.ucla.edu>
-Date: Tue, 21 Sep 2021 14:47:45 +0000 (-0700)
-Subject: regex: copy back from Gnulib
-X-Git-Url: https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=0b5ca7c3e551e5502f3be3b06453324fe8604e82;hp=f3e664563361dc17530113b3205998d1f19dc4d9
-
-regex: copy back from Gnulib
-
-Copy regex-related files back from Gnulib, to fix a problem with
-static checking of regex calls noted by Martin Sebor. This merges the
-following changes:
-
-* New macro __attribute_nonnull__ in misc/sys/cdefs.h, for use later
-when copying other files back from Gnulib.
-
-* Use __GNULIB_CDEFS instead of __GLIBC__ when deciding
-whether to include bits/wordsize.h etc.
-
-* Avoid duplicate entries in epsilon closure table.
-
-* New regex.h macro _REGEX_NELTS to let regexec say that its pmatch
-arg should contain nmatch elts. Use that for regexec, instead of
-__attr_access (which is incorrect).
-
-* New regex.h macro _Attr_access_ which is like __attr_access except
-portable to non-glibc platforms.
-
-* Add some DEBUG_ASSERTs to pacify gcc -fanalyzer and to catch
-recently-fixed performance bugs if they recur.
-
-* Add Gnulib-specific stuff to port the dynarray- and lock-using parts
-of regex code to non-glibc platforms.
-
-* Fix glibc bug 11053.
-
-* Avoid some undefined behavior when popping an empty fail stack.
----
-
-diff --git a/include/intprops.h b/include/intprops.h
-index 2b6e5e93ed..3fe64e82e9 100644
---- a/include/intprops.h
-+++ b/include/intprops.h
-@@ -132,7 +132,8 @@
- operators might not yield numerically correct answers due to
- arithmetic overflow. They do not rely on undefined or
- implementation-defined behavior. Their implementations are simple
-- and straightforward, but they are a bit harder to use than the
-+ and straightforward, but they are harder to use and may be less
-+ efficient than the INT_<op>_WRAPV, INT_<op>_OK, and
- INT_<op>_OVERFLOW macros described below.
-
- Example usage:
-@@ -157,6 +158,9 @@
- must have minimum value MIN and maximum MAX. Unsigned types should
- use a zero MIN of the proper type.
-
-+ Because all arguments are subject to integer promotions, these
-+ macros typically do not work on types narrower than 'int'.
-+
- These macros are tuned for constant MIN and MAX. For commutative
- operations such as A + B, they are also tuned for constant B. */
-
-@@ -338,9 +342,15 @@
- arguments should not have side effects.
-
- The WRAPV macros are not constant expressions. They support only
-- +, binary -, and *. Because the WRAPV macros convert the result,
-- they report overflow in different circumstances than the OVERFLOW
-- macros do.
-+ +, binary -, and *.
-+
-+ Because the WRAPV macros convert the result, they report overflow
-+ in different circumstances than the OVERFLOW macros do. For
-+ example, in the typical case with 16-bit 'short' and 32-bit 'int',
-+ if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B)
-+ returns false because the addition cannot overflow after A and B
-+ are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns
-+ true or false depending on whether the sum fits into 'short'.
-
- These macros are tuned for their last input argument being a constant.
-
-diff --git a/include/regex.h b/include/regex.h
-index 24eca2c297..34fb67d855 100644
---- a/include/regex.h
-+++ b/include/regex.h
-@@ -37,7 +37,8 @@ extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags);
- libc_hidden_proto (__regcomp)
-
- extern int __regexec (const regex_t *__preg, const char *__string,
-- size_t __nmatch, regmatch_t __pmatch[], int __eflags);
-+ size_t __nmatch, regmatch_t __pmatch[__nmatch],
-+ int __eflags);
- libc_hidden_proto (__regexec)
-
- extern size_t __regerror (int __errcode, const regex_t *__preg,
-diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
-index e490fc1aeb..4dac9d264d 100644
---- a/misc/sys/cdefs.h
-+++ b/misc/sys/cdefs.h
-@@ -318,16 +318,18 @@
- #endif
-
- /* The nonnull function attribute marks pointer parameters that
-- must not be NULL. */
--#ifndef __nonnull
-+ must not be NULL. This has the name __nonnull in glibc,
-+ and __attribute_nonnull__ in files shared with Gnulib to avoid
-+ collision with a different __nonnull in DragonFlyBSD 5.9. */
-+#ifndef __attribute_nonnull__
- # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
--# define __nonnull(params) __attribute__ ((__nonnull__ params))
-+# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
- # else
--# define __nonnull(params)
-+# define __attribute_nonnull__(params)
- # endif
--#elif !defined __GLIBC__
--# undef __nonnull
--# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
-+#endif
-+#ifndef __nonnull
-+# define __nonnull(params) __attribute_nonnull__ (params)
- #endif
-
- /* The returns_nonnull function attribute marks the return type of the function
-@@ -493,9 +495,9 @@
- [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
- #endif
-
--/* The #ifndef lets Gnulib avoid including these on non-glibc
-- platforms, where the includes typically do not exist. */
--#ifdef __GLIBC__
-+/* Gnulib avoids including these, as they don't work on non-glibc or
-+ older glibc platforms. */
-+#ifndef __GNULIB_CDEFS
- # include <bits/wordsize.h>
- # include <bits/long-double.h>
- #endif
-diff --git a/posix/regcomp.c b/posix/regcomp.c
-index d93698ae78..887e5b5068 100644
---- a/posix/regcomp.c
-+++ b/posix/regcomp.c
-@@ -1695,12 +1695,14 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
- reg_errcode_t err;
- Idx i;
- re_node_set eclosure;
-- bool ok;
- bool incomplete = false;
- err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
- if (__glibc_unlikely (err != REG_NOERROR))
- return err;
-
-+ /* An epsilon closure includes itself. */
-+ eclosure.elems[eclosure.nelem++] = node;
-+
- /* This indicates that we are calculating this node now.
- We reference this value to avoid infinite loop. */
- dfa->eclosures[node].nelem = -1;
-@@ -1753,10 +1755,6 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
- }
- }
-
-- /* An epsilon closure includes itself. */
-- ok = re_node_set_insert (&eclosure, node);
-- if (__glibc_unlikely (! ok))
-- return REG_ESPACE;
- if (incomplete && !root)
- dfa->eclosures[node].nelem = 0;
- else
-diff --git a/posix/regex.c b/posix/regex.c
-index 7296be0f08..d32863972c 100644
---- a/posix/regex.c
-+++ b/posix/regex.c
-@@ -24,6 +24,7 @@
-
- # if __GNUC_PREREQ (4, 6)
- # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-+# pragma GCC diagnostic ignored "-Wvla"
- # endif
- # if __GNUC_PREREQ (4, 3)
- # pragma GCC diagnostic ignored "-Wold-style-definition"
-diff --git a/posix/regex.h b/posix/regex.h
-index 14fb1d8364..adb69768ee 100644
---- a/posix/regex.h
-+++ b/posix/regex.h
-@@ -522,6 +522,30 @@ typedef struct
-
- /* Declarations for routines. */
-
-+#ifndef _REGEX_NELTS
-+# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
-+ && !defined __STDC_NO_VLA__)
-+# define _REGEX_NELTS(n) n
-+# else
-+# define _REGEX_NELTS(n)
-+# endif
-+#endif
-+
-+#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-+# pragma GCC diagnostic push
-+# pragma GCC diagnostic ignored "-Wvla"
-+#endif
-+
-+#ifndef _Attr_access_
-+# ifdef __attr_access
-+# define _Attr_access_(arg) __attr_access (arg)
-+# elif defined __GNUC__ && 10 <= __GNUC__
-+# define _Attr_access_(x) __attribute__ ((__access__ x))
-+# else
-+# define _Attr_access_(x)
-+# endif
-+#endif
-+
- #ifdef __USE_GNU
- /* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the 're_syntax_options' variable. */
-@@ -537,7 +561,7 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
- 'regfree'. */
- extern const char *re_compile_pattern (const char *__pattern, size_t __length,
- struct re_pattern_buffer *__buffer)
-- __attr_access ((__read_only__, 1, 2));
-+ _Attr_access_ ((__read_only__, 1, 2));
-
-
- /* Compile a fastmap for the compiled pattern in BUFFER; used to
-@@ -555,7 +579,7 @@ extern regoff_t re_search (struct re_pattern_buffer *__buffer,
- const char *__String, regoff_t __length,
- regoff_t __start, regoff_t __range,
- struct re_registers *__regs)
-- __attr_access ((__read_only__, 2, 3));
-+ _Attr_access_ ((__read_only__, 2, 3));
-
-
- /* Like 're_search', but search in the concatenation of STRING1 and
-@@ -566,8 +590,8 @@ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
- regoff_t __start, regoff_t __range,
- struct re_registers *__regs,
- regoff_t __stop)
-- __attr_access ((__read_only__, 2, 3))
-- __attr_access ((__read_only__, 4, 5));
-+ _Attr_access_ ((__read_only__, 2, 3))
-+ _Attr_access_ ((__read_only__, 4, 5));
-
-
- /* Like 're_search', but return how many characters in STRING the regexp
-@@ -575,7 +599,7 @@ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
- extern regoff_t re_match (struct re_pattern_buffer *__buffer,
- const char *__String, regoff_t __length,
- regoff_t __start, struct re_registers *__regs)
-- __attr_access ((__read_only__, 2, 3));
-+ _Attr_access_ ((__read_only__, 2, 3));
-
-
- /* Relates to 're_match' as 're_search_2' relates to 're_search'. */
-@@ -584,8 +608,8 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
- const char *__string2, regoff_t __length2,
- regoff_t __start, struct re_registers *__regs,
- regoff_t __stop)
-- __attr_access ((__read_only__, 2, 3))
-- __attr_access ((__read_only__, 4, 5));
-+ _Attr_access_ ((__read_only__, 2, 3))
-+ _Attr_access_ ((__read_only__, 4, 5));
-
-
- /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
-@@ -654,16 +678,19 @@ extern int regcomp (regex_t *_Restrict_ __preg,
-
- extern int regexec (const regex_t *_Restrict_ __preg,
- const char *_Restrict_ __String, size_t __nmatch,
-- regmatch_t __pmatch[_Restrict_arr_],
-- int __eflags)
-- __attr_access ((__write_only__, 4, 3));
-+ regmatch_t __pmatch[_Restrict_arr_
-+ _REGEX_NELTS (__nmatch)],
-+ int __eflags);
-
- extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
- char *_Restrict_ __errbuf, size_t __errbuf_size)
-- __attr_access ((__write_only__, 3, 4));
-+ _Attr_access_ ((__write_only__, 3, 4));
-
- extern void regfree (regex_t *__preg);
-
-+#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-+# pragma GCC diagnostic pop
-+#endif
-
- #ifdef __cplusplus
- }
-diff --git a/posix/regex_internal.c b/posix/regex_internal.c
-index 9dd387ef85..aefcfa2f52 100644
---- a/posix/regex_internal.c
-+++ b/posix/regex_internal.c
-@@ -1211,6 +1211,10 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
-
- if (__glibc_unlikely (dest->nelem == 0))
- {
-+ /* Although we already guaranteed above that dest->alloc != 0 and
-+ therefore dest->elems != NULL, add a debug assertion to pacify
-+ GCC 11.2.1's -fanalyzer. */
-+ DEBUG_ASSERT (dest->elems);
- dest->nelem = src->nelem;
- memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
- return REG_NOERROR;
-@@ -1286,7 +1290,10 @@ re_node_set_insert (re_node_set *set, Idx elem)
-
- if (__glibc_unlikely (set->nelem) == 0)
- {
-- /* We already guaranteed above that set->alloc != 0. */
-+ /* Although we already guaranteed above that set->alloc != 0 and
-+ therefore set->elems != NULL, add a debug assertion to pacify
-+ GCC 11.2 -fanalyzer. */
-+ DEBUG_ASSERT (set->elems);
- set->elems[0] = elem;
- ++set->nelem;
- return true;
-@@ -1314,6 +1321,7 @@ re_node_set_insert (re_node_set *set, Idx elem)
- {
- for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
- set->elems[idx] = set->elems[idx - 1];
-+ DEBUG_ASSERT (set->elems[idx - 1] < elem);
- }
-
- /* Insert the new element. */
-diff --git a/posix/regex_internal.h b/posix/regex_internal.h
-index edcdc07e99..1245e782ff 100644
---- a/posix/regex_internal.h
-+++ b/posix/regex_internal.h
-@@ -32,6 +32,10 @@
- #include <stdbool.h>
- #include <stdint.h>
-
-+#ifndef _LIBC
-+# include <dynarray.h>
-+#endif
-+
- #include <intprops.h>
- #include <verify.h>
-
-@@ -49,14 +53,14 @@
- # define lock_fini(lock) ((void) 0)
- # define lock_lock(lock) __libc_lock_lock (lock)
- # define lock_unlock(lock) __libc_lock_unlock (lock)
--#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO
-+#elif defined GNULIB_LOCK && !defined GNULIB_REGEX_SINGLE_THREAD
- # include "glthread/lock.h"
- # define lock_define(name) gl_lock_define (, name)
- # define lock_init(lock) glthread_lock_init (&(lock))
- # define lock_fini(lock) glthread_lock_destroy (&(lock))
- # define lock_lock(lock) glthread_lock_lock (&(lock))
- # define lock_unlock(lock) glthread_lock_unlock (&(lock))
--#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO
-+#elif defined GNULIB_PTHREAD && !defined GNULIB_REGEX_SINGLE_THREAD
- # include <pthread.h>
- # define lock_define(name) pthread_mutex_t name;
- # define lock_init(lock) pthread_mutex_init (&(lock), 0)
-diff --git a/posix/regexec.c b/posix/regexec.c
-index f7b4f9cfc3..83e9aaf8ca 100644
---- a/posix/regexec.c
-+++ b/posix/regexec.c
-@@ -59,7 +59,7 @@ static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
- Idx cur_idx, Idx nmatch);
- static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs,
- Idx str_idx, Idx dest_node, Idx nregs,
-- regmatch_t *regs,
-+ regmatch_t *regs, regmatch_t *prevregs,
- re_node_set *eps_via_nodes);
- static reg_errcode_t set_regs (const regex_t *preg,
- const re_match_context_t *mctx,
-@@ -186,11 +186,12 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
- REG_NOTBOL is set, then ^ does not match at the beginning of the
- string; if REG_NOTEOL is set, then $ does not match at the end.
-
-- We return 0 if we find a match and REG_NOMATCH if not. */
-+ Return 0 if a match is found, REG_NOMATCH if not, REG_BADPAT if
-+ EFLAGS is invalid. */
-
- int
- regexec (const regex_t *__restrict preg, const char *__restrict string,
-- size_t nmatch, regmatch_t pmatch[], int eflags)
-+ size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
- {
- reg_errcode_t err;
- Idx start, length;
-@@ -234,7 +235,7 @@ int
- attribute_compat_text_section
- __compat_regexec (const regex_t *__restrict preg,
- const char *__restrict string, size_t nmatch,
-- regmatch_t pmatch[], int eflags)
-+ regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
- {
- return regexec (preg, string, nmatch, pmatch,
- eflags & (REG_NOTBOL | REG_NOTEOL));
-@@ -269,8 +270,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
- strings.)
-
- On success, re_match* functions return the length of the match, re_search*
-- return the position of the start of the match. Return value -1 means no
-- match was found and -2 indicates an internal error. */
-+ return the position of the start of the match. They return -1 on
-+ match failure, -2 on error. */
-
- regoff_t
- re_match (struct re_pattern_buffer *bufp, const char *string, Idx length,
-@@ -1206,27 +1207,30 @@ check_halt_state_context (const re_match_context_t *mctx,
- /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA
- corresponding to the DFA).
- Return the destination node, and update EPS_VIA_NODES;
-- return -1 in case of errors. */
-+ return -1 on match failure, -2 on error. */
-
- static Idx
- proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
-+ regmatch_t *prevregs,
- Idx *pidx, Idx node, re_node_set *eps_via_nodes,
- struct re_fail_stack_t *fs)
- {
- const re_dfa_t *const dfa = mctx->dfa;
-- Idx i;
-- bool ok;
- if (IS_EPSILON_NODE (dfa->nodes[node].type))
- {
- re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes;
- re_node_set *edests = &dfa->edests[node];
-- Idx dest_node;
-- ok = re_node_set_insert (eps_via_nodes, node);
-- if (__glibc_unlikely (! ok))
-- return -2;
-- /* Pick up a valid destination, or return -1 if none
-- is found. */
-- for (dest_node = -1, i = 0; i < edests->nelem; ++i)
-+
-+ if (! re_node_set_contains (eps_via_nodes, node))
-+ {
-+ bool ok = re_node_set_insert (eps_via_nodes, node);
-+ if (__glibc_unlikely (! ok))
-+ return -2;
-+ }
-+
-+ /* Pick a valid destination, or return -1 if none is found. */
-+ Idx dest_node = -1;
-+ for (Idx i = 0; i < edests->nelem; i++)
- {
- Idx candidate = edests->elems[i];
- if (!re_node_set_contains (cur_nodes, candidate))
-@@ -1244,7 +1248,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
- /* Otherwise, push the second epsilon-transition on the fail stack. */
- else if (fs != NULL
- && push_fail_stack (fs, *pidx, candidate, nregs, regs,
-- eps_via_nodes))
-+ prevregs, eps_via_nodes))
- return -2;
-
- /* We know we are going to exit. */
-@@ -1288,7 +1292,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
- if (naccepted == 0)
- {
- Idx dest_node;
-- ok = re_node_set_insert (eps_via_nodes, node);
-+ bool ok = re_node_set_insert (eps_via_nodes, node);
- if (__glibc_unlikely (! ok))
- return -2;
- dest_node = dfa->edests[node].elems[0];
-@@ -1317,7 +1321,8 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
- static reg_errcode_t
- __attribute_warn_unused_result__
- push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
-- Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
-+ Idx nregs, regmatch_t *regs, regmatch_t *prevregs,
-+ re_node_set *eps_via_nodes)
- {
- reg_errcode_t err;
- Idx num = fs->num++;
-@@ -1333,25 +1338,30 @@ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
- }
- fs->stack[num].idx = str_idx;
- fs->stack[num].node = dest_node;
-- fs->stack[num].regs = re_malloc (regmatch_t, nregs);
-+ fs->stack[num].regs = re_malloc (regmatch_t, 2 * nregs);
- if (fs->stack[num].regs == NULL)
- return REG_ESPACE;
- memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs);
-+ memcpy (fs->stack[num].regs + nregs, prevregs, sizeof (regmatch_t) * nregs);
- err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes);
- return err;
- }
-
- static Idx
- pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs,
-- regmatch_t *regs, re_node_set *eps_via_nodes)
-+ regmatch_t *regs, regmatch_t *prevregs,
-+ re_node_set *eps_via_nodes)
- {
-+ if (fs == NULL || fs->num == 0)
-+ return -1;
- Idx num = --fs->num;
-- DEBUG_ASSERT (num >= 0);
- *pidx = fs->stack[num].idx;
- memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs);
-+ memcpy (prevregs, fs->stack[num].regs + nregs, sizeof (regmatch_t) * nregs);
- re_node_set_free (eps_via_nodes);
- re_free (fs->stack[num].regs);
- *eps_via_nodes = fs->stack[num].eps_via_nodes;
-+ DEBUG_ASSERT (0 <= fs->stack[num].node);
- return fs->stack[num].node;
- }
-
-@@ -1407,33 +1417,32 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
- {
- update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
-
-- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
-+ if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
-+ || (fs && re_node_set_contains (&eps_via_nodes, cur_node)))
- {
- Idx reg_idx;
-+ cur_node = -1;
- if (fs)
- {
- for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
- if (pmatch[reg_idx].rm_so > -1 && pmatch[reg_idx].rm_eo == -1)
-- break;
-- if (reg_idx == nmatch)
-- {
-- re_node_set_free (&eps_via_nodes);
-- regmatch_list_free (&prev_match);
-- return free_fail_stack_return (fs);
-- }
-- cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-- &eps_via_nodes);
-+ {
-+ cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-+ prev_idx_match, &eps_via_nodes);
-+ break;
-+ }
- }
-- else
-+ if (cur_node < 0)
- {
- re_node_set_free (&eps_via_nodes);
- regmatch_list_free (&prev_match);
-- return REG_NOERROR;
-+ return free_fail_stack_return (fs);
- }
- }
-
- /* Proceed to next node. */
-- cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node,
-+ cur_node = proceed_next_node (mctx, nmatch, pmatch, prev_idx_match,
-+ &idx, cur_node,
- &eps_via_nodes, fs);
-
- if (__glibc_unlikely (cur_node < 0))
-@@ -1445,13 +1454,13 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
- free_fail_stack_return (fs);
- return REG_ESPACE;
- }
-- if (fs)
-- cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-- &eps_via_nodes);
-- else
-+ cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
-+ prev_idx_match, &eps_via_nodes);
-+ if (cur_node < 0)
- {
- re_node_set_free (&eps_via_nodes);
- regmatch_list_free (&prev_match);
-+ free_fail_stack_return (fs);
- return REG_NOMATCH;
- }
- }
-@@ -1495,10 +1504,10 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch,
- }
- else if (type == OP_CLOSE_SUBEXP)
- {
-+ /* We are at the last node of this sub expression. */
- Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
- if (reg_num < nmatch)
- {
-- /* We are at the last node of this sub expression. */
- if (pmatch[reg_num].rm_so < cur_idx)
- {
- pmatch[reg_num].rm_eo = cur_idx;
-@@ -2195,6 +2204,7 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx,
-
- /* Return the next state to which the current state STATE will transit by
- accepting the current input byte, and update STATE_LOG if necessary.
-+ Return NULL on failure.
- If STATE can accept a multibyte char/collating element/back reference
- update the destination of STATE_LOG. */
-
-@@ -2395,7 +2405,7 @@ check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes,
-
- #if 0
- /* Return the next state to which the current state STATE will transit by
-- accepting the current input byte. */
-+ accepting the current input byte. Return NULL on failure. */
-
- static re_dfastate_t *
- transit_state_sb (reg_errcode_t *err, re_match_context_t *mctx,
-@@ -2817,7 +2827,8 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
- /* Check whether the node TOP_NODE at TOP_STR can arrive to the node
- LAST_NODE at LAST_STR. We record the path onto PATH since it will be
- heavily reused.
-- Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */
-+ Return REG_NOERROR if it can arrive, REG_NOMATCH if it cannot,
-+ REG_ESPACE if memory is exhausted. */
-
- static reg_errcode_t
- __attribute_warn_unused_result__
-@@ -3433,7 +3444,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
- /* Group all nodes belonging to STATE into several destinations.
- Then for all destinations, set the nodes belonging to the destination
- to DESTS_NODE[i] and set the characters accepted by the destination
-- to DEST_CH[i]. This function return the number of destinations. */
-+ to DEST_CH[i]. Return the number of destinations if successful,
-+ -1 on internal error. */
-
- static Idx
- group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
-@@ -4211,7 +4223,8 @@ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
- }
-
- /* Register the node NODE, whose type is OP_CLOSE_SUBEXP, and which matches
-- at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP. */
-+ at STR_IDX, whose corresponding OP_OPEN_SUBEXP is SUB_TOP.
-+ Return the new entry if successful, NULL if memory is exhausted. */
-
- static re_sub_match_last_t *
- match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/glibc.git/commitdiff/91078412c65c94e8f032e2c09eb6aca5eb315e43
More information about the pld-cvs-commit
mailing list