2022-01-01 18:54:23 +00:00
|
|
|
# Copyright (C) 1994-2022 Free Software Foundation, Inc.
|
1995-02-18 01:27:10 +00:00
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
# Lesser General Public License for more details.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Sub-makefile for resolv portion of the library.
|
|
|
|
#
|
|
|
|
subdir := resolv
|
|
|
|
|
2014-02-26 23:12:03 +00:00
|
|
|
include ../Makeconfig
|
|
|
|
|
2017-03-22 13:55:25 +00:00
|
|
|
headers := resolv.h bits/types/res_state.h \
|
2000-04-03 17:13:51 +00:00
|
|
|
netdb.h bits/netdb.h \
|
|
|
|
arpa/nameser.h arpa/nameser_compat.h \
|
2000-03-03 20:04:58 +00:00
|
|
|
sys/bitypes.h
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2021-07-15 06:28:50 +00:00
|
|
|
routines := \
|
2021-07-19 05:55:27 +00:00
|
|
|
dn_comp \
|
2021-07-19 05:55:27 +00:00
|
|
|
dn_expand \
|
2021-07-19 05:55:27 +00:00
|
|
|
dn_skipname \
|
2021-07-19 05:55:27 +00:00
|
|
|
dns-canon \
|
|
|
|
dns-host \
|
|
|
|
dns-network \
|
2021-07-15 06:28:50 +00:00
|
|
|
herror \
|
|
|
|
inet_addr \
|
|
|
|
inet_ntop \
|
|
|
|
inet_pton \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_makecanon \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_name_compress \
|
2021-07-15 06:28:50 +00:00
|
|
|
ns_name_ntop \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_name_pack \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_name_pton \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_name_skip \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_name_uncompress \
|
2021-07-15 06:28:50 +00:00
|
|
|
ns_name_unpack \
|
2021-07-19 05:55:27 +00:00
|
|
|
ns_samename \
|
2021-07-15 06:28:50 +00:00
|
|
|
nsap_addr \
|
2021-07-19 05:55:27 +00:00
|
|
|
nss_dns_functions \
|
2021-07-15 06:28:50 +00:00
|
|
|
res-close \
|
2021-07-19 05:55:27 +00:00
|
|
|
res-name-checking \
|
2021-07-15 06:28:50 +00:00
|
|
|
res-state \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_context_hostalias \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_enable_icmp \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_get_nsaddr \
|
2021-07-15 06:28:50 +00:00
|
|
|
res_hconf \
|
|
|
|
res_init \
|
|
|
|
res_libc \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_mkquery \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_nameinquery \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_queriesmatch \
|
resolv: Move res_query functions into libc
This switches to public symbols without __ prefixes, due to improved
namespace management in glibc.
The script was used with --no-new-version to move the symbols
__res_nquery, __res_nquerydomain, __res_nsearch, __res_query,
__res_querydomain, __res_search, res_query, res_querydomain,
res_search. The public symbols res_nquery, res_nquerydomain,
res_nsearch, res_ownok, res_query, res_querydomain, res_search
were added with make update-all-abi.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2021-07-19 05:55:27 +00:00
|
|
|
res_query \
|
2021-07-15 06:28:50 +00:00
|
|
|
res_randomid \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_send \
|
2021-07-15 06:28:50 +00:00
|
|
|
resolv_conf \
|
|
|
|
resolv_context \
|
|
|
|
# routines
|
1996-06-25 10:52:53 +00:00
|
|
|
|
2007-04-30 22:30:14 +00:00
|
|
|
tests = tst-aton tst-leaks tst-inet_ntop
|
2020-11-23 09:51:24 +00:00
|
|
|
tests-container = tst-leaks2
|
1998-04-29 17:14:29 +00:00
|
|
|
|
2019-01-21 20:26:03 +00:00
|
|
|
tests-internal += tst-inet_aton_exact
|
|
|
|
|
|
|
|
|
2014-03-07 03:29:23 +00:00
|
|
|
generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
|
2003-05-05 17:36:15 +00:00
|
|
|
|
2001-03-07 07:41:33 +00:00
|
|
|
extra-libs := libresolv libnss_dns
|
|
|
|
ifeq ($(have-thread-library),yes)
|
2001-03-07 13:52:14 +00:00
|
|
|
routines += gai_sigqueue
|
2016-12-31 13:06:16 +00:00
|
|
|
|
|
|
|
tests += \
|
|
|
|
tst-bug18665 \
|
|
|
|
tst-bug18665-tcp \
|
2017-04-04 12:09:56 +00:00
|
|
|
tst-ns_name \
|
2017-04-13 09:56:28 +00:00
|
|
|
tst-ns_name_compress \
|
2017-11-11 10:33:32 +00:00
|
|
|
tst-ns_name_pton \
|
2016-12-31 13:06:16 +00:00
|
|
|
tst-res_hconf_reorder \
|
2017-11-11 10:23:40 +00:00
|
|
|
tst-res_hnok \
|
2016-12-31 13:06:16 +00:00
|
|
|
tst-resolv-basic \
|
2018-01-08 13:33:17 +00:00
|
|
|
tst-resolv-binary \
|
2017-04-13 11:09:38 +00:00
|
|
|
tst-resolv-edns \
|
2016-12-31 13:06:16 +00:00
|
|
|
tst-resolv-network \
|
2019-01-21 20:26:03 +00:00
|
|
|
tst-resolv-nondecimal \
|
2017-07-04 09:18:34 +00:00
|
|
|
tst-resolv-res_init-multi \
|
2016-12-31 13:06:16 +00:00
|
|
|
tst-resolv-search \
|
2019-01-21 20:26:03 +00:00
|
|
|
tst-resolv-trailing \
|
2016-12-31 13:06:16 +00:00
|
|
|
|
2020-10-14 08:54:39 +00:00
|
|
|
# This test calls __res_context_send directly, which is not exported
|
|
|
|
# from libresolv.
|
|
|
|
tests-internal += tst-resolv-txnid-collision
|
|
|
|
tests-static += tst-resolv-txnid-collision
|
|
|
|
|
2017-04-04 15:31:52 +00:00
|
|
|
# These tests need libdl.
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
tests += \
|
2018-05-23 13:26:19 +00:00
|
|
|
tst-resolv-ai_idn \
|
|
|
|
tst-resolv-ai_idn-latin1 \
|
|
|
|
tst-resolv-ai_idn-nolibidn2 \
|
2017-04-04 15:31:52 +00:00
|
|
|
tst-resolv-canonname \
|
2019-10-30 16:26:58 +00:00
|
|
|
tst-resolv-trustad \
|
2017-04-04 15:31:52 +00:00
|
|
|
|
2019-04-08 08:40:31 +00:00
|
|
|
# Needs resolv_context.
|
2017-06-02 13:50:36 +00:00
|
|
|
tests-internal += \
|
|
|
|
tst-resolv-res_init \
|
|
|
|
tst-resolv-res_init-thread \
|
2017-07-05 15:39:33 +00:00
|
|
|
tst-resolv-res_ninit \
|
|
|
|
tst-resolv-threads \
|
2017-07-03 13:01:34 +00:00
|
|
|
|
2018-05-23 13:26:19 +00:00
|
|
|
# Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
|
|
|
|
# providing any functions in libidn2.so.0).
|
|
|
|
modules-names += tst-no-libidn2
|
|
|
|
extra-test-objs += tst-no-libidn2.os
|
|
|
|
LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
|
|
|
|
|
|
|
|
endif # $(build-shared)
|
2017-04-04 15:31:52 +00:00
|
|
|
|
2017-09-26 11:53:17 +00:00
|
|
|
# This test accesses __inet_ntop_length, an internal libc function.
|
2017-06-21 11:09:08 +00:00
|
|
|
tests-internal += tst-inet_pton
|
|
|
|
|
Obsolete p_secstodate.
This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html> (pending
review) applied, obsoletes p_secstodate, making the underlying
function __p_secstodate into a compat symbol not available for new
binaries or ports. The calls in ns_print.c (part of incomplete
handling of TKEY) are changed to use %lu to print times instead of
trying to pretty-print the times any more.
Tested for x86_64.
* resolv/res_debug.c (p_secstodate): Condition definition on
[SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]. Define
directly as __p_secstodate, and as a compat symbol. Do not use
libresolv_hidden_def.
* resolv/resolv.h (p_secstodate): Remove macro and function
declaration.
* resolv/ns_print.c (ns_sprintrrf): Print times with %lu, not
using p_secstodate.
* include/resolv.h (__p_secstodate): Do not use
libresolv_hidden_proto.
* resolv/Makefile (tests): Move tst-p_secstodate to ....
(tests-internal): ... here.
* resolv/tst-p_secstodate.c: Include <shlib-compat.h>. Condition
all contents on [TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]
and declare and use __p_secstodate and use compat_symbol_reference
in that case.
[!TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)] (do_test): Add
implementation returning 77.
2017-11-22 22:21:10 +00:00
|
|
|
# This test accesses the __p_secstodate compat symbol.
|
2021-03-09 20:07:24 +00:00
|
|
|
ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
|
|
|
|
tests += tst-p_secstodate
|
|
|
|
endif
|
Obsolete p_secstodate.
This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html> (pending
review) applied, obsoletes p_secstodate, making the underlying
function __p_secstodate into a compat symbol not available for new
binaries or ports. The calls in ns_print.c (part of incomplete
handling of TKEY) are changed to use %lu to print times instead of
trying to pretty-print the times any more.
Tested for x86_64.
* resolv/res_debug.c (p_secstodate): Condition definition on
[SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]. Define
directly as __p_secstodate, and as a compat symbol. Do not use
libresolv_hidden_def.
* resolv/resolv.h (p_secstodate): Remove macro and function
declaration.
* resolv/ns_print.c (ns_sprintrrf): Print times with %lu, not
using p_secstodate.
* include/resolv.h (__p_secstodate): Do not use
libresolv_hidden_proto.
* resolv/Makefile (tests): Move tst-p_secstodate to ....
(tests-internal): ... here.
* resolv/tst-p_secstodate.c: Include <shlib-compat.h>. Condition
all contents on [TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]
and declare and use __p_secstodate and use compat_symbol_reference
in that case.
[!TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)] (do_test): Add
implementation returning 77.
2017-11-22 22:21:10 +00:00
|
|
|
|
2016-12-31 19:22:09 +00:00
|
|
|
# This test sends millions of packets and is rather slow.
|
|
|
|
xtests += tst-resolv-qtypes
|
2017-06-30 08:43:33 +00:00
|
|
|
|
|
|
|
# This test has dropped packet tests and runs for a long time.
|
|
|
|
xtests += tst-resolv-rotate
|
2022-02-11 23:17:55 +00:00
|
|
|
endif # $(have-thread-library)
|
|
|
|
|
update from main archive 960911
Thu Sep 12 03:35:27 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/Dist: Remove init-first.h.
* sysdeps/unix/sysv/linux/m68k/Dist: Likewise.
* sysdeps/unix/sysv/linux/Dist: Add init-first.h.
1996-09-11 Paul Eggert <eggert@twinsun.com>
* strftime.c (strftime):
Handle E and O modifiers, required for POSIX.2 and XPG4.
Don't use sprintf to format numbers; this way, we can handle time_t
correctly regardless of whether it's signed.
Don't dump core if format ends in %.
In default %c format, use %e instead of %d, for POSIX.2 compatibility.
For %z:
Use tm_gmtoff if available.
Output nothing if tm_isdst is negative.
Output correct value even if arg is 1969-12-31 23:59:59 UTC.
Don't assume that UTC offset is less than 24 hours;
Posix requires support for 24 hours, and there's no point
limiting it at all.
(HAVE_TM_GMTOFF, TYPE_SIGNED, INT_STRLEN_BOUND): New macros.
(CHAR_BIT): Define if <limits.h> doesn't.
(tm_diff): New function.
(fmt, <stdio.h>): Remove; no longer used.
Thu Sep 12 02:21:44 1996 Ulrich Drepper <drepper@cygnus.com>
* db/Makefile: Add extra-libs-others variable so that shared
library is built in `others' pass.
* elf/Makefile: Likewise.
* math/Makefile: Likewise.
* resolv/Makefile: Likewise.
* Makefile (generated): Add version.info.h.
* time/checktab.awk: New file. From ADO 96k.
* time/iso3166.tab: Likewise.
* time/tzselect.ksh: Likewise.
* time/zone.tab: Likewise.
* stdio-common/vfprintf.c: Correct cleanup registration. We
cannot use a macro
1996-09-11 Paul Eggert <eggert@twinsun.com>
* time/time.h (tm_gmtoff, tm_zone): Prefix with `__' unless
__USE_BSD; this is required for ANSI C compatibility.
* manual/time.texi: Replace GMT by UTC, daylight savings by
daylight saving, timezone by time zone.
Rewrite description of %V to match ISO 8601.
Fix TZ Posix string example for US Eastern time.
Explain tzname[1] when DST isn't used.
Explain tzname when multiple abbreviations used (e.g. EST/EWT/EDT).
Explain that timezone's sign is opposite from tm_gmtoff, and that
timezone lacks DST adjustment whereas tm_gmtoff has it.
Deprecate tzname and timezone.
Tue Sep 10 14:46:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Implement Roland McGrath's idea of how to put an .interp into
shared libraries.
* interp.c: New file.
* Makerules (interp-obj): New object, linked into every shared
library.
(common-generated): Add interp.so.
(CFLAGS-interp.c): Pass name of interpreter.
Tue Sep 10 21:09:35 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* db/Makefile: Fix typo.
Tue Sep 10 19:29:53 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* nss/db-Makefile ($(VAR_DB)/passwd.db): Look for multiple
occurences of the same uid, and only generate a mapping for the
first one.
Tue Sep 10 03:14:59 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/system.c: New file, to override
sysdeps/unix/system.c.
Tue Sep 10 15:05:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (before-compile): Add version-info.h, needed to build
version.d.
Tue Sep 10 14:14:33 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/sysdep.S: Remove check for
EWOULDBLOCK, never true on Linux.
(__errno_location): New function.
[_LIBC_REENTRANT]: Set errno using __errno_location function.
* sysdeps/unix/sysv/linux/m68k/sysdep.h [PIC]: Add second
syscall_error handler for reentrant libc.
Tue Sep 10 13:27:49 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/Makefile (extra-objs): Add eval.so to get dependencies.
Wed Sep 11 04:40:57 1996 Ulrich Drepper <drepper@cygnus.com>
* time/tzset.c (__tzname_cur_max): Use type `size_t' to avoid
warning.
* time/tzfile.c (compute_tzname_max): Likewise.
1996-09-12 02:51:03 +00:00
|
|
|
extra-libs-others = $(extra-libs)
|
2021-07-15 06:28:50 +00:00
|
|
|
libresolv-routines := \
|
|
|
|
base64 \
|
|
|
|
compat-gethnamaddr \
|
|
|
|
compat-hooks \
|
|
|
|
inet_net_ntop \
|
|
|
|
inet_net_pton \
|
|
|
|
inet_neta \
|
|
|
|
ns_date \
|
|
|
|
ns_name \
|
|
|
|
ns_netint \
|
|
|
|
ns_parse \
|
|
|
|
ns_print \
|
|
|
|
ns_samedomain \
|
|
|
|
ns_ttl \
|
2021-07-19 05:55:27 +00:00
|
|
|
res-putget \
|
2021-07-15 06:28:50 +00:00
|
|
|
res_data \
|
|
|
|
res_debug \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_hostalias \
|
2021-07-19 05:55:27 +00:00
|
|
|
res_isourserver \
|
2021-07-19 05:55:27 +00:00
|
|
|
resolv-deprecated \
|
2021-07-15 06:28:50 +00:00
|
|
|
# libresolv-routines
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2022-02-11 23:17:55 +00:00
|
|
|
ifeq ($(have-GLIBC_2.34)$(have-thread-library),yesyes)
|
|
|
|
# Empty compatibility library for old binaries.
|
|
|
|
extra-libs += libanl
|
|
|
|
libanl-routines += libanl-compat
|
|
|
|
libanl-shared-only-routines += libanl-compat
|
|
|
|
endif
|
|
|
|
|
2021-07-02 09:45:00 +00:00
|
|
|
$(libanl-routines-var) += \
|
2021-07-15 06:28:50 +00:00
|
|
|
gai_cancel \
|
|
|
|
gai_error \
|
|
|
|
gai_misc \
|
|
|
|
gai_notify \
|
|
|
|
gai_suspend \
|
|
|
|
getaddrinfo_a \
|
|
|
|
# $(libanl-routines-var)
|
2021-07-02 09:45:00 +00:00
|
|
|
|
2021-12-30 12:00:41 +00:00
|
|
|
# Pretend that libanl.so is a linker script, so that the symbolic link
|
|
|
|
# is not installed.
|
|
|
|
install-lib-ldscripts = libanl.so
|
|
|
|
$(inst_libdir)/libanl.so:
|
|
|
|
|
1997-01-21 06:10:42 +00:00
|
|
|
subdir-dirs = nss_dns
|
1996-12-15 02:15:29 +00:00
|
|
|
vpath %.c nss_dns
|
|
|
|
|
2021-07-20 10:27:23 +00:00
|
|
|
# Build only an empty shared libnss_dns.
|
|
|
|
libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
|
|
|
|
|
|
|
|
# Pretend that libnss_dns.so is a linker script, so that the symbolic link
|
|
|
|
# is not installed.
|
|
|
|
install-lib-ldscripts = libnss_dns.so
|
|
|
|
$(inst_libdir)/libnss_dns.so:
|
|
|
|
|
Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.
In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.
Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that. Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present). Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.
For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration. Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets. This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.
Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before. We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.
It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable. The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.
The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out. If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.
Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(tests): Depend on $(tests-special).
* Makerules (check-abi-list): New variable.
(check-abi): Depend on $(check-abi-list).
[$(subdir) = elf] (tests-special): Add
$(objpfx)check-abi-libc.out.
[$(build-shared) = yes && subdir] (tests-special): Add
$(check-abi-list).
[$(build-shared) = yes && subdir] (tests): Do not depend on
check-abi.
* Rules (tests): Depend on $(tests-special).
(xtests): Depend on $(xtests-special).
* catgets/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* conform/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* elf/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* grp/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* iconv/Makefile (xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* iconvdata/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* intl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable. Also add
$(objpfx)tst-gettext.out.
* io/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* libio/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* malloc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* misc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl_db/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* posix/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* resolv/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* stdio-common/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
* stdlib/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* string/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* sysdeps/x86/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
localedata:
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
2014-03-06 22:35:33 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
ifneq (no,$(PERL))
|
2020-11-23 09:51:24 +00:00
|
|
|
tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
|
|
|
|
$(objpfx)mtrace-tst-resolv-res_ninit.out
|
Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.
In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.
Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that. Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present). Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.
For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration. Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets. This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.
Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before. We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.
It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable. The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.
The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out. If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.
Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(tests): Depend on $(tests-special).
* Makerules (check-abi-list): New variable.
(check-abi): Depend on $(check-abi-list).
[$(subdir) = elf] (tests-special): Add
$(objpfx)check-abi-libc.out.
[$(build-shared) = yes && subdir] (tests-special): Add
$(check-abi-list).
[$(build-shared) = yes && subdir] (tests): Do not depend on
check-abi.
* Rules (tests): Depend on $(tests-special).
(xtests): Depend on $(xtests-special).
* catgets/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* conform/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* elf/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* grp/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* iconv/Makefile (xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* iconvdata/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* intl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable. Also add
$(objpfx)tst-gettext.out.
* io/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* libio/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* malloc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* misc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl_db/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* posix/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* resolv/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* stdio-common/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
* stdlib/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* string/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* sysdeps/x86/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
localedata:
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
2014-03-06 22:35:33 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-03-07 03:29:23 +00:00
|
|
|
generated += mtrace-tst-leaks.out tst-leaks.mtrace \
|
2017-07-03 13:01:34 +00:00
|
|
|
mtrace-tst-leaks2.out tst-leaks2.mtrace \
|
|
|
|
mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
|
2004-01-01 11:54:51 +00:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
include ../Rules
|
Wed Jan 24 04:18:36 1996 Paul Eggert <eggert@twinsun.com>
* strftime.c (strftime):
When invoking self, check whether the subsidiary invocation failed.
Use "???" (not "") to denote unknown time zone information.
Make this source file portable to standalone contexts (e.g. GNU Emacs).
<config.h>: Include if HAVE_CONFIG_H is defined.
(HAVE_LIMITS_H, HAVE_MBLEN, HAVE_TM_ZONE, STDC_HEADERS): New symbols,
defined if _LIBC or if <config.h> defines them.
<ansidecl.h>, "../locale/localeinfo.h": Include only if _LIBC.
<sys/types.h>: New include; some hosts require it for `time_t'.
<ctype.h>: Include only if HAVE_MBLEN (since it's only needed then).
<limits.h>: Include only if HAVE_LIMITS_H.
<stddef.h, stdlib.h, string.h>: Include only if STDC_HEADERS.
(memcpy): Define in terms of bcopy if !STDC_HEADERS.
(__P, PTR): Define if not already defined.
(__tzname, __daylight, __timezone): Remove macros; no longer needed.
(add, strftime): Don't use NULL, for portability to some weird hosts.
(fmt): If !_LIBC, don't assume sprintf returns a count.
(week, strftime): Use old-style function declarations.
(weekday_name, month_name): New constants.
(strftime): Use traditional C values if locale support isn't available.
Use `const' instead of CONST. For time zones, use tm_zone if
possible, then fall back on tzname. Don't check for multibyte
characters unless mblen is supported. Use formats like %02d instead
of %.2d, for portability to older hosts.
Wed Jan 24 04:18:36 1996 Paul Eggert <eggert@twinsun.com>
* strftime.c (strftime):
When invoking self, check whether the subsidiary invocation failed.
Use "???" (not "") to denote unknown time zone information.
Make this source file portable to standalone contexts (e.g. GNU Emacs).
<config.h>: Include if HAVE_CONFIG_H is defined.
(HAVE_LIMITS_H, HAVE_MBLEN, HAVE_TM_ZONE, STDC_HEADERS): New symbols,
defined if _LIBC or if <config.h> defines them.
<ansidecl.h>, "../locale/localeinfo.h": Include only if _LIBC.
<sys/types.h>: New include; some hosts require it for `time_t'.
<ctype.h>: Include only if HAVE_MBLEN (since it's only needed then).
<limits.h>: Include only if HAVE_LIMITS_H.
<stddef.h, stdlib.h, string.h>: Include only if STDC_HEADERS.
(memcpy): Define in terms of bcopy if !STDC_HEADERS.
(__P, PTR): Define if not already defined.
(__tzname, __daylight, __timezone): Remove macros; no longer needed.
(add, strftime): Don't use NULL, for portability to some weird hosts.
(fmt): If !_LIBC, don't assume sprintf returns a count.
(week, strftime): Use old-style function declarations.
(weekday_name, month_name): New constants.
(strftime): Use traditional C values if locale support isn't available.
Use `const' instead of CONST. For time zones, use tm_zone if
possible, then fall back on tzname. Don't check for multibyte
characters unless mblen is supported. Use formats like %02d instead
of %.2d, for portability to older hosts.
Wed Jan 24 00:07:52 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* stdio-common/vfscanf.c (GROUP, MALLOC): New flag macros.
(__vfscanf): Eliminate flag vars that were redundant with FLAGS bits.
Fix bug in recognition of %ll flag for long long.
Fix overeager checks for conflicting type modifiers.
With ' flag, match thousands separators for decimal numbers.
Tue Jan 23 22:02:40 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/Makefile (CFLAGS-locfile-lex.c): New variable.
* resolv/Makefile (CFLAGS): Disable some warnings.
* sysdeps/generic/Makefile (elided-routines): Removed hypot.
(+gccwarn): Set with override.
* stdio-common/Makefile (CFLAGS-tst-printf.c): New variable.
* posix/Makefile (CFLAGS-regex.c): New variable.
* malloc/Makefile (CFLAGS-obstack.c): New variable.
* io/Makefile (CFLAGS-fts.c): New variable.
* io/fts.c (fts_open): Use prototypes for COMPAR decl.
Tue Jan 23 21:35:32 1996 Miles Bader <miles@gnu.ai.mit.edu>
* sysdeps/mach/hurd/bind.c (bind): Ensure NAME for the AF_LOCAL
case is '\0'-terminated.
Tue Jan 23 19:49:54 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* elf/rtld.c (dl_main): Support additional args in --list mode for
debugging: look them up as symbol names and print values.
* misc/getttyent.c (skip, value): Declare with prototypes in file
scope.
* csu/initfini.c (_init): Explicitly set a variable that is
pointer to volatile with the address of __gmon_start__, to avoid
the test being optimized out.
1996-01-24 06:03:37 +00:00
|
|
|
|
2018-05-23 13:26:19 +00:00
|
|
|
LOCALES := en_US.UTF-8 en_US.ISO-8859-1
|
|
|
|
include ../gen-locales.mk
|
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-res_hconf.c += -fexceptions
|
2003-08-30 18:51:25 +00:00
|
|
|
|
1996-12-15 02:15:29 +00:00
|
|
|
# The DNS NSS modules needs the resolver.
|
2013-05-31 16:16:33 +00:00
|
|
|
$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
|
2001-03-03 18:21:04 +00:00
|
|
|
|
|
|
|
# The asynchronous name lookup code needs the thread library.
|
2013-05-31 16:16:33 +00:00
|
|
|
$(objpfx)libanl.so: $(shared-thread-library)
|
2001-03-03 18:21:04 +00:00
|
|
|
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
|
2015-06-18 21:40:46 +00:00
|
|
|
tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
|
|
|
|
|
2003-02-23 03:35:39 +00:00
|
|
|
$(objpfx)tst-leaks: $(objpfx)libresolv.so
|
2021-07-22 13:07:59 +00:00
|
|
|
tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2014-03-07 03:29:23 +00:00
|
|
|
$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
|
2014-02-21 21:48:08 +00:00
|
|
|
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
|
|
|
|
$(evaluate-test)
|
2004-07-21 18:30:11 +00:00
|
|
|
|
2021-07-22 13:07:59 +00:00
|
|
|
tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2014-03-07 03:29:23 +00:00
|
|
|
$(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
|
2020-11-25 07:30:17 +00:00
|
|
|
{ test -r $(objpfx)tst-leaks2.mtrace \
|
|
|
|
|| ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
|
|
|
|
&& $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
|
2014-02-21 21:48:08 +00:00
|
|
|
$(evaluate-test)
|
2016-12-31 13:06:16 +00:00
|
|
|
|
2021-07-22 13:07:59 +00:00
|
|
|
tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2017-07-03 13:01:34 +00:00
|
|
|
$(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
|
|
|
|
$(common-objpfx)malloc/mtrace \
|
|
|
|
$(objpfx)tst-resolv-res_ninit.mtrace > $@; \
|
|
|
|
$(evaluate-test)
|
|
|
|
|
2016-12-31 13:06:16 +00:00
|
|
|
$(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
|
|
|
|
$(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
|
2018-05-23 13:26:19 +00:00
|
|
|
$(objpfx)tst-resolv-ai_idn-latin1: \
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)libresolv.so $(shared-thread-library)
|
2018-05-23 13:26:19 +00:00
|
|
|
$(objpfx)tst-resolv-ai_idn-nolibidn2: \
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)libresolv.so $(shared-thread-library)
|
2018-05-23 13:26:19 +00:00
|
|
|
$(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
|
|
|
|
$(gen-locales) $(objpfx)tst-no-libidn2.so
|
2016-12-31 13:06:16 +00:00
|
|
|
$(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
|
2018-01-08 13:33:17 +00:00
|
|
|
$(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
|
2017-04-13 11:09:38 +00:00
|
|
|
$(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
|
2016-12-31 13:06:16 +00:00
|
|
|
$(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
|
2017-07-04 09:18:34 +00:00
|
|
|
$(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
|
|
|
|
$(shared-thread-library)
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
|
2017-06-02 13:50:36 +00:00
|
|
|
$(shared-thread-library)
|
2019-01-21 20:26:03 +00:00
|
|
|
$(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
|
2016-12-31 19:22:09 +00:00
|
|
|
$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
|
2017-06-30 08:43:33 +00:00
|
|
|
$(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
|
2016-12-31 13:06:16 +00:00
|
|
|
$(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
|
2019-01-21 20:26:03 +00:00
|
|
|
$(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
|
2020-10-14 08:54:39 +00:00
|
|
|
$(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
|
|
|
|
$(static-thread-library)
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
|
2019-10-30 16:26:58 +00:00
|
|
|
$(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
|
2016-10-04 09:52:10 +00:00
|
|
|
|
2017-04-04 12:09:56 +00:00
|
|
|
$(objpfx)tst-ns_name: $(objpfx)libresolv.so
|
|
|
|
$(objpfx)tst-ns_name.out: tst-ns_name.data
|
2017-04-13 09:56:28 +00:00
|
|
|
$(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
|
2017-11-11 10:33:32 +00:00
|
|
|
$(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
|
2017-11-11 10:23:40 +00:00
|
|
|
$(objpfx)tst-res_hnok: $(objpfx)libresolv.so
|
Fix p_secstodate overflow handling (bug 22463).
The resolv/res_debug.c function p_secstodate (which is a public
function exported from libresolv, taking an unsigned long argument)
does:
struct tm timebuf;
time = __gmtime_r(&clock, &timebuf);
time->tm_year += 1900;
time->tm_mon += 1;
sprintf(output, "%04d%02d%02d%02d%02d%02d",
time->tm_year, time->tm_mon, time->tm_mday,
time->tm_hour, time->tm_min, time->tm_sec);
If __gmtime_r returns NULL (because the year overflows the range of
int), this will dereference a null pointer. Otherwise, if the
computed year does not fit in four characters, this will cause a
buffer overrun of the fixed-size 15-byte buffer. With current GCC
mainline, there is a compilation failure because of the possible
buffer overrun.
I couldn't find a specification for how this function is meant to
behave, but Paul pointed to RFC 4034 as relevant to the cases where
this function is called from within glibc. The function's interface
is inherently problematic when dates beyond Y2038 might be involved,
because of the ambiguity in how to interpret 32-bit timestamps as such
dates (the RFC suggests interpreting times as being within 68 years of
the present date, which would mean some kind of interface whose
behavior depends on the present date).
This patch works on the basis of making a minimal fix in preparation
for obsoleting the function. The function is made to handle times in
the interval [0, 0x7fffffff] only, on all platforms, with <overflow>
used as the output string in other cases (and errno set to EOVERFLOW
in such cases). This seems to be a reasonable state for the function
to be in when made a compat symbol by a future patch, being compatible
with any existing uses for existing timestamps without trying to work
for later timestamps. Results independent of the range of time_t also
simplify the testcase.
I couldn't persuade GCC to recognize the ranges of the struct tm
fields by adding explicit range checks with a call to
__builtin_unreachable if outside the range (this looks similar to
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80776>), so having added
a range check on the input, this patch then disables the
-Wformat-overflow= warning for the sprintf call (I prefer that to the
use of strftime, as being more transparently correct without knowing
what each of %m and %M etc. is).
I do not know why this build failure should be new with mainline GCC
(that is, I don't know what GCC change might have introduced it, when
the basic functionality for such warnings was already in GCC 7).
I do not know if this is a security issue (that is, if there are
plausible ways in which a date before -999 or after 9999 from an
untrusted source might end up in this function). The system clock is
arguably an untrusted source (in that e.g. NTP is insecure), but
probably not to that extent (NTP can't communicate such wild
timestamps), and uses from within glibc are limited to 32-bit inputs.
Tested with build-many-glibcs.py that this restores the build for arm
with yesterday's mainline GCC. Also tested for x86_64 and x86.
[BZ #22463]
* resolv/res_debug.c: Include <libc-diag.h>.
(p_secstodate): Assert time_t at least as wide as u_long. On
overflow, use integer seconds since the epoch as output, or use
"<overflow>" as output and set errno to EOVERFLOW if integer
seconds since the epoch would be 14 or more characters.
(p_secstodate) [__GNUC_PREREQ (7, 0)]: Disable -Wformat-overflow=
for sprintf call.
* resolv/tst-p_secstodate.c: New file.
* resolv/Makefile (tests): Add tst-p_secstodate.
($(objpfx)tst-p_secstodate): Depend on $(objpfx)libresolv.so.
2017-11-22 22:12:07 +00:00
|
|
|
$(objpfx)tst-p_secstodate: $(objpfx)libresolv.so
|