From 5c81be53407434ce22b849722a3d691295480016 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 9 Oct 2018 23:40:09 +0200 Subject: hurd: Fix race between calling RPC and handling a signal * sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make _hurd_intr_rpc_msg_about_to global point to start of controlled assembly snippet. Make it check canceled flag. * hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed the _hurd_intr_rpc_msg_about_to point. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation issue, remove cancel flag check. --- ChangeLog | 7 +++++++ hurd/hurdsig.c | 4 +++- hurd/intr-msg.c | 17 ++--------------- sysdeps/mach/hurd/i386/intr-msg.h | 23 ++++++++++++++++------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d23aa7..5709c3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ * hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not answer to interrupt_operation, return EIO instead of EINTR. + * sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make + _hurd_intr_rpc_msg_about_to global point to start of controlled + assembly snippet. Make it check canceled flag. + * hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed + the _hurd_intr_rpc_msg_about_to point. + * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation + issue, remove cancel flag check. 2018-10-26 Joseph Myers diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 48179b4..d105615 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -292,6 +292,7 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread, struct machine_thread_all_state *state, int *state_change, void (*reply) (void)) { + extern const void _hurd_intr_rpc_msg_about_to; extern const void _hurd_intr_rpc_msg_in_trap; mach_port_t rcv_port = MACH_PORT_NULL; mach_port_t intr_port; @@ -307,7 +308,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread, receive completes immediately or aborts. */ abort_thread (ss, state, reply); - if (state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap) + if (state->basic.PC >= (natural_t) &_hurd_intr_rpc_msg_about_to && + state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap) { /* The thread is about to do the RPC, but hasn't yet entered mach_msg. Mutate the thread's state so it knows not to try diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 1f7724e..7ace0a1 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -114,23 +114,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, message: - /* XXX - At all points here (once SS->intr_port is set), the signal thread - thinks we are "about to enter the syscall", and might mutate our - return-value register. This is bogus. - */ - - if (ss->cancel) - { - /* We have been cancelled. Don't do an RPC at all. */ - ss->intr_port = MACH_PORT_NULL; - ss->cancel = 0; - return EINTR; - } - /* Note that the signal trampoline code might modify our OPTION! */ err = INTR_MSG_TRAP (msg, option, send_size, - rcv_size, rcv_name, timeout, notify); + rcv_size, rcv_name, timeout, notify, + &ss->cancel, &ss->intr_port); switch (err) { diff --git a/sysdeps/mach/hurd/i386/intr-msg.h b/sysdeps/mach/hurd/i386/intr-msg.h index 64f05f8..7788c3b 100644 --- a/sysdeps/mach/hurd/i386/intr-msg.h +++ b/sysdeps/mach/hurd/i386/intr-msg.h @@ -20,21 +20,30 @@ /* Note that we must mark OPTION and TIMEOUT as outputs of this operation, to indicate that the signal thread might mutate them as part of sending us to a signal handler. */ -#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \ + +/* After _hurd_intr_rpc_msg_about_to we need to make a last check of cancel, in + case we got interrupted right before _hurd_intr_rpc_msg_about_to. */ +#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify, cancel_p, intr_port_p) \ ({ \ error_t err; \ - asm (".globl _hurd_intr_rpc_msg_do_trap\n" \ - ".globl _hurd_intr_rpc_msg_in_trap\n" \ + asm (".globl _hurd_intr_rpc_msg_about_to\n" \ ".globl _hurd_intr_rpc_msg_cx_sp\n" \ + ".globl _hurd_intr_rpc_msg_do_trap\n" \ + ".globl _hurd_intr_rpc_msg_in_trap\n" \ ".globl _hurd_intr_rpc_msg_sp_restored\n" \ - " movl %%esp, %%ecx\n" \ - " leal %3, %%esp\n" \ + "_hurd_intr_rpc_msg_about_to: cmpl $0, %5\n" \ + " jz _hurd_intr_rpc_msg_do\n" \ + " movl $0, %3\n" \ + " movl %6, %%eax\n" \ + " jmp _hurd_intr_rpc_msg_sp_restored\n" \ + "_hurd_intr_rpc_msg_do: movl %%esp, %%ecx\n" \ + " leal %4, %%esp\n" \ "_hurd_intr_rpc_msg_cx_sp: movl $-25, %%eax\n" \ "_hurd_intr_rpc_msg_do_trap: lcall $7, $0 # status in %0\n" \ "_hurd_intr_rpc_msg_in_trap: movl %%ecx, %%esp\n" \ "_hurd_intr_rpc_msg_sp_restored:" \ - : "=a" (err), "+m" (option), "+m" (timeout) \ - : "m" ((&msg)[-1]) \ + : "=a" (err), "+m" (option), "+m" (timeout), "=m" (*intr_port_p) \ + : "m" ((&msg)[-1]), "m" (*cancel_p), "i" (EINTR) \ : "ecx"); \ err; \ }) -- cgit v1.1 From c6982f7efc1c70fe2d6160a87ee44d871ac85ab0 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 29 Oct 2018 15:28:05 +0000 Subject: Patch to require Python 3.4 or later to build glibc. This patch makes Python 3.4 or later a required tool for building glibc, so allowing changes of awk, perl etc. code used in the build and test to Python code without any such changes needing makefile conditionals or to handle older Python versions. This patch makes the configure test for Python check the version and give an error if Python is missing or too old, and removes makefile conditionals that are no longer needed. It does not itself convert any code from another language to Python, and does not remove any compatibility with older Python versions from existing scripts. Tested for x86_64. * configure.ac (PYTHON_PROG): Use AC_CHECK_PROG_VER. Set critic_missing for versions before 3.4. * configure: Regenerated. * manual/install.texi (Tools for Compilation): Document requirement for Python to build glibc. * INSTALL: Regenerated. * Rules [PYTHON]: Make code unconditional. * benchtests/Makefile [PYTHON]: Likewise. * conform/Makefile [PYTHON]: Likewise. * manual/Makefile [PYTHON]: Likewise. * math/Makefile [PYTHON]: Likewise. --- ChangeLog | 14 ++++++++++++++ INSTALL | 8 ++++---- NEWS | 2 +- Rules | 7 ------- benchtests/Makefile | 7 ------- configure | 29 ++++++++++++++++++++--------- configure.ac | 18 ++++++------------ conform/Makefile | 6 ------ manual/Makefile | 2 +- manual/install.texi | 8 ++++---- math/Makefile | 10 ---------- 11 files changed, 50 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5709c3c..dc267e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-10-29 Joseph Myers + + * configure.ac (PYTHON_PROG): Use AC_CHECK_PROG_VER. Set + critic_missing for versions before 3.4. + * configure: Regenerated. + * manual/install.texi (Tools for Compilation): Document + requirement for Python to build glibc. + * INSTALL: Regenerated. + * Rules [PYTHON]: Make code unconditional. + * benchtests/Makefile [PYTHON]: Likewise. + * conform/Makefile [PYTHON]: Likewise. + * manual/Makefile [PYTHON]: Likewise. + * math/Makefile [PYTHON]: Likewise. + 2018-10-28 Samuel Thibault * hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000. diff --git a/INSTALL b/INSTALL index 50bd113..3884ada 100644 --- a/INSTALL +++ b/INSTALL @@ -531,11 +531,11 @@ build the GNU C Library: work with any version of 'sed'. As of release time, 'sed' version 4.5 is the newest verified to work to build the GNU C Library. - * Python 2.7/3.4 or later + * Python 3.4 or later - Python is required to build the GNU C Library manual and to run - some tests. As of release time, Python 3.6 is the newest verified - to work for testing the GNU C Library. + Python is required to build the GNU C Library. As of release time, + Python 3.6 is the newest verified to work for building and testing + the GNU C Library. * PExpect 4.0 diff --git a/NEWS b/NEWS index 270abc1..3d13b32 100644 --- a/NEWS +++ b/NEWS @@ -48,7 +48,7 @@ Deprecated and removed features, and other changes affecting compatibility: Changes to build and runtime requirements: -* Python is required to build the GNU C Library manual. +* Python 3.4 or later is required to build the GNU C Library. Security related changes: diff --git a/Rules b/Rules index 5abb727..dd325cb 100644 --- a/Rules +++ b/Rules @@ -114,11 +114,6 @@ tests-printers-programs := $(addprefix $(objpfx),$(tests-printers)) # .out files with the output of running the pretty printer tests. tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers)) -ifndef PYTHON -# Mark tests-printers tests as unsupported if we don't have PYTHON. -tests-unsupported += $(tests-printers) -endif - ifeq ($(build-programs),yes) others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs)) else @@ -277,7 +272,6 @@ endif endif # tests -ifdef PYTHON ifneq "$(strip $(tests-printers))" "" # Static pattern rule for building the test programs for the pretty printers. @@ -300,7 +294,6 @@ $(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \ $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \ $(evaluate-test) endif -endif .PHONY: distclean realclean subdir_distclean subdir_realclean \ diff --git a/benchtests/Makefile b/benchtests/Makefile index 45aeb5f..d558db4 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -180,14 +180,7 @@ $(error Invalid BENCHSET value) endif endif -# Define the bench target only if the target has a usable python installation. -ifdef PYTHON bench: bench-build bench-set bench-func bench-malloc -else -bench: - @echo "The bench target needs python to run." - @exit 1 -endif # Target to only build the benchmark without running it. We generate locales # only if we're building natively. diff --git a/configure b/configure index f30c31a..535e2f6 100755 --- a/configure +++ b/configure @@ -5344,19 +5344,30 @@ fi test -n "$PYTHON_PROG" && break done -test -n "$PYTHON_PROG" || PYTHON_PROG="no" -case "x$PYTHON_PROG" in -xno|x|x:) PYTHON_PROG=no ;; -*) ;; -esac - -if test "x$PYTHON_PROG" = xno; then - aux_missing="$aux_missing python" +if test -z "$PYTHON_PROG"; then + ac_verc_fail=yes else - PYTHON="$PYTHON_PROG -B" + # Found it, now check the version. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $PYTHON_PROG" >&5 +$as_echo_n "checking version of $PYTHON_PROG... " >&6; } + ac_prog_version=`$PYTHON_PROG --version 2>&1 | sed -n 's/^.*Python \([0-9][0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5 +$as_echo "$ac_prog_version" >&6; } fi +if test $ac_verc_fail = yes; then + critic_missing="$critic_missing python" +fi + +PYTHON="$PYTHON_PROG -B" + test -n "$critic_missing" && as_fn_error $? " *** These critical programs are missing or too old:$critic_missing diff --git a/configure.ac b/configure.ac index e983fd8..6cc10ed 100644 --- a/configure.ac +++ b/configure.ac @@ -1050,18 +1050,12 @@ else fi # Check for python3 if available, or else python. -AC_CHECK_PROGS(PYTHON_PROG, python3 python,no) -case "x$PYTHON_PROG" in -xno|x|x:) PYTHON_PROG=no ;; -*) ;; -esac - -if test "x$PYTHON_PROG" = xno; then - aux_missing="$aux_missing python" -else - PYTHON="$PYTHON_PROG -B" - AC_SUBST(PYTHON) -fi +AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version, + [Python \([0-9][0-9.]*\)], + [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*], + critic_missing="$critic_missing python") +PYTHON="$PYTHON_PROG -B" +AC_SUBST(PYTHON) test -n "$critic_missing" && AC_MSG_ERROR([ *** These critical programs are missing or too old:$critic_missing diff --git a/conform/Makefile b/conform/Makefile index 71e58a4..a2bbe0f 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -120,9 +120,7 @@ linknamespace-symlists-base := $(foreach std,$(conformtest-standards),\ symlist-$(std)) linknamespace-symlists-tests := $(addprefix $(objpfx),\ $(linknamespace-symlists-base)) -ifdef PYTHON tests-special += $(linknamespace-symlists-tests) -endif linknamespace-symlist-stdlibs-base := $(foreach std,$(conformtest-standards),\ symlist-stdlibs-$(std)) @@ -130,9 +128,7 @@ linknamespace-symlist-stdlibs-tests := \ $(addprefix $(objpfx),\ $(linknamespace-symlist-stdlibs-base)) -ifdef PYTHON tests-special += $(linknamespace-symlist-stdlibs-tests) -endif linknamespace-header-base := $(foreach std,\ $(conformtest-standards),\ @@ -141,9 +137,7 @@ linknamespace-header-base := $(foreach std,\ $(std)/$(h)/linknamespace.out)) linknamespace-header-tests := $(addprefix $(objpfx),\ $(linknamespace-header-base)) -ifdef PYTHON tests-special += $(linknamespace-header-tests) -endif include ../Rules diff --git a/manual/Makefile b/manual/Makefile index 9c35c9d..5f6006d 100644 --- a/manual/Makefile +++ b/manual/Makefile @@ -172,7 +172,7 @@ include ../Rules install-data subdir_install: install # Generated files requiring python: libm-err.texi # Generated files requiring perl: summary.texi -ifneq ($(if $(PYTHON),$(PERL),no),no) +ifneq ($(PERL),no) ifneq ($(strip $(MAKEINFO)),:) install: $(inst_infodir)/libc.info @if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \ diff --git a/manual/install.texi b/manual/install.texi index 08a39f5..c190023 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -575,11 +575,11 @@ with any version of @code{sed}. As of release time, @code{sed} version 4.5 is the newest verified to work to build @theglibc{}. @item -Python 2.7/3.4 or later +Python 3.4 or later -Python is required to build the @glibcadj{} manual and to run some -tests. As of release time, Python 3.6 is the newest verified to work -for testing @theglibc{}. +Python is required to build @theglibc{}. As of release time, Python +3.6 is the newest verified to work for building and testing +@theglibc{}. @item PExpect 4.0 diff --git a/math/Makefile b/math/Makefile index 750492b..34db021 100644 --- a/math/Makefile +++ b/math/Makefile @@ -255,7 +255,6 @@ tests += test-math-isinff test-math-iszero test-math-issignaling \ test-math-iscanonical test-math-cxx11 test-math-iseqsig endif -ifdef PYTHON libm-vec-tests = $(addprefix test-,$(libmvec-tests)) libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t)) test-extras += $(libm-test-support) @@ -351,9 +350,7 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ auto-libm-test-out% $(make-target-directory) $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ -endif -ifdef PYTHON tgmath3-macros = atan2 cbrt ceil copysign erf erfc exp2 expm1 fdim floor \ fma fmax fmin fmod frexp hypot ilogb ldexp lgamma llrint \ llround log10 log1p log2 logb lrint lround nearbyint \ @@ -380,7 +377,6 @@ tests-special += $(objpfx)test-tgmath3-macro-list.out $(objpfx)test-tgmath3-macro-list.out: gen-tgmath-tests.py $(PYTHON) $< check-list $(tgmath3-macros) > $@; \ $(evaluate-test) -endif libm-test-fast-math-cflags = -fno-builtin -D__FAST_MATH__ -DTEST_FAST_MATH libm-test-vec-cflags = $(libm-test-fast-math-cflags) -fno-inline \ @@ -476,7 +472,6 @@ $(objpfx)gen-libm-templates.stmp: Makefile $(foreach t, $(call type-foreach, $(gen-all-calls)), \ $(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp -ifdef PYTHON # This must come after the inclusion of sysdeps Makefiles via Rules. $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c: @@ -637,11 +632,6 @@ regen-ulps: $(addprefix $(objpfx),$(libm-tests)) echo "Difference between the current baseline and the new baseline is:";\ diff -urN $(ulps-file) $(objpfx)NewUlps; \ echo "Copy $(objpfx)NewUlps to $(ulps-file) (relative to source)." -else -regen-ulps: - @echo "Automatic regeneration of ULPs requires python."; \ - exit 1; -endif # The generated sysd-rules file defines rules like this for sources # coming from sysdeps/ directories. These rules find the generic sources. -- cgit v1.1 From 954cf3c29bd0b32bd11d5235b7e36148b187e77d Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 29 Oct 2018 17:49:07 +0000 Subject: Use tempfile.TemporaryDirectory in conform/glibcconform.py. Now that we require Python 3.4 or later, Python code creating temporary directories can use tempfile.TemporaryDirectory in "with" to have the directory deleted automatically instead of needing to use try/finally to handle removing a directory created with tempfile.mkdtemp. This patch does so in conform/glibcconform.py. Tested for x86_64. * conform/glibcconform.py: Do not import shutil. (list_exported_functions): Use tempfile.TemporaryDirectory instead of mkdtemp. --- ChangeLog | 4 ++++ conform/glibcconform.py | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc267e2..944d8fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-10-29 Joseph Myers + * conform/glibcconform.py: Do not import shutil. + (list_exported_functions): Use tempfile.TemporaryDirectory instead + of mkdtemp. + * configure.ac (PYTHON_PROG): Use AC_CHECK_PROG_VER. Set critic_missing for versions before 3.4. * configure: Regenerated. diff --git a/conform/glibcconform.py b/conform/glibcconform.py index 31ad4a9..c1db460 100644 --- a/conform/glibcconform.py +++ b/conform/glibcconform.py @@ -19,7 +19,6 @@ import os.path import re -import shutil import subprocess import tempfile @@ -43,11 +42,9 @@ def list_exported_functions(cc, standard, header): """ cc_all = '%s -D_ISOMAC %s' % (cc, CFLAGS[standard]) - # tempfile.TemporaryDirectory requires Python 3.2, so use mkdtemp. - temp_dir = tempfile.mkdtemp() - c_file_name = os.path.join(temp_dir, 'test.c') - aux_file_name = os.path.join(temp_dir, 'test.c.aux') - try: + with tempfile.TemporaryDirectory() as temp_dir: + c_file_name = os.path.join(temp_dir, 'test.c') + aux_file_name = os.path.join(temp_dir, 'test.c.aux') with open(c_file_name, 'w') as c_file: c_file.write('#include <%s>\n' % header) fns = set() @@ -72,6 +69,4 @@ def list_exported_functions(cc, standard, header): else: raise ValueError("couldn't parse -aux-info output: %s" % line) - finally: - shutil.rmtree(temp_dir) return fns -- cgit v1.1 From b6e7c449f9bb33943f10fdd8f3e539dceb136177 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 29 Oct 2018 18:57:13 +0100 Subject: hurd: return EIEIO instead of EIO EIO would be understood as hardware failure, while this is software failure. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Return EIEIO instead of EIO --- ChangeLog | 2 +- hurd/intr-msg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 944d8fa..53fedc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,7 +20,7 @@ * hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not - answer to interrupt_operation, return EIO instead of EINTR. + answer to interrupt_operation, return EIEIO instead of EINTR. * sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make _hurd_intr_rpc_msg_about_to global point to start of controlled assembly snippet. Make it check canceled flag. diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 7ace0a1..9ddae62 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -323,9 +323,9 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, /* FALLTHROUGH */ dead: - err = EIO; + err = EIEIO; - /* The EIO return indicates cancellation, so clear the flag. */ + /* The EIEIO return indicates cancellation, so clear the flag. */ ss->cancel = 0; break; -- cgit v1.1 From fec8bb7ca93d66cd2b019cfebcee6b3e6560ea36 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 29 Oct 2018 13:38:30 +0100 Subject: Currency symbol should not preceed amount for [BZ #23791] CLDR also has the currency symbol after the amount for Catalan. Also set grouping in LC_NUMERIC to 3;3. Reviewed-by: Mike FABIAN --- ChangeLog | 7 +++++++ localedata/locales/ca_ES | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53fedc2..91104bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-10-29 Sergi Almacellas Abellana + + [BZ #23791] + * localedata/locales/ca_ES (LC_MONETARY): set p_cs_precedes and + n_cs_precedes to 0. + * localedata/locales/ca_ES (LC_MONETARY): set grouping to 3;3 + 2018-10-29 Joseph Myers * conform/glibcconform.py: Do not import shutil. diff --git a/localedata/locales/ca_ES b/localedata/locales/ca_ES index 5d82978..0ba74cc 100644 --- a/localedata/locales/ca_ES +++ b/localedata/locales/ca_ES @@ -77,9 +77,9 @@ positive_sign "" negative_sign "-" int_frac_digits 2 frac_digits 2 -p_cs_precedes 1 +p_cs_precedes 0 p_sep_by_space 1 -n_cs_precedes 1 +n_cs_precedes 0 n_sep_by_space 1 p_sign_posn 1 n_sign_posn 1 @@ -88,7 +88,7 @@ END LC_MONETARY LC_NUMERIC decimal_point "," thousands_sep "." -grouping 0;0 +grouping 3;3 END LC_NUMERIC LC_TIME -- cgit v1.1 From 2dd12baa045f25c52b30a34b10f72d51f2605413 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 25 Sep 2018 11:11:27 +0200 Subject: RISC-V: properly terminate call chain (bug 23125) Mark the ra register as undefined in _start, so that unwinding through main works correctly. Also, don't use a tail call so that ra points after the call to __libc_start_main, not after the previous call. --- ChangeLog | 9 +++++++++ elf/Makefile | 4 +++- elf/tst-unwind-main.c | 38 ++++++++++++++++++++++++++++++++++++++ sysdeps/riscv/start.S | 7 ++++++- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 elf/tst-unwind-main.c diff --git a/ChangeLog b/ChangeLog index 91104bb..ccfdf0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2018-10-30 Andreas Schwab + + [BZ #23125] + * sysdeps/riscv/start.S (ENTRY_POINT): Mark ra as undefined. + Don't use tail call. + * elf/tst-unwind-main.c: New file. + * elf/Makefile (tests): Add tst-unwind-main. + (CFLAGS-tst-unwind-main.c): Define. + 2018-10-29 Sergi Almacellas Abellana [BZ #23791] diff --git a/elf/Makefile b/elf/Makefile index e868744..d72e7b6 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -187,7 +187,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \ - tst-unwind-ctor + tst-unwind-ctor tst-unwind-main # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -1495,3 +1495,5 @@ $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so + +CFLAGS-tst-unwind-main.c += -funwind-tables diff --git a/elf/tst-unwind-main.c b/elf/tst-unwind-main.c new file mode 100644 index 0000000..d123603 --- /dev/null +++ b/elf/tst-unwind-main.c @@ -0,0 +1,38 @@ +/* Test unwinding through main. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +static _Unwind_Reason_Code +callback (struct _Unwind_Context *ctx, void *arg) +{ + return _URC_NO_REASON; +} + +int +main (void) +{ + /* Arrange for this test to be killed if _Unwind_Backtrace runs into an + endless loop. We cannot use the test driver because the complete + call chain needs to be compiled with -funwind-tables so that + _Unwind_Backtrace is able to reach _start. */ + alarm (DEFAULT_TIMEOUT); + _Unwind_Backtrace (callback, 0); +} diff --git a/sysdeps/riscv/start.S b/sysdeps/riscv/start.S index 4635ddb..2d6f06e 100644 --- a/sysdeps/riscv/start.S +++ b/sysdeps/riscv/start.S @@ -43,6 +43,10 @@ __libc_start_main wants this in a5. */ ENTRY (ENTRY_POINT) + /* Terminate call stack by noting ra is undefined. Use a dummy + .cfi_label to force starting the FDE. */ + .cfi_label .Ldummy + cfi_undefined (ra) call .Lload_gp mv a5, a0 /* rtld_fini. */ /* main may be in a shared library. */ @@ -54,7 +58,8 @@ ENTRY (ENTRY_POINT) lla a4, __libc_csu_fini mv a6, sp /* stack_end. */ - tail __libc_start_main@plt + call __libc_start_main@plt + ebreak END (ENTRY_POINT) /* Dynamic links need the global pointer to be initialized prior to calling -- cgit v1.1 From f5e7e95921847bd83186bfe621fc2b48c4de5477 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 30 Oct 2018 13:11:47 +0100 Subject: stdlib/test-bz22786: Avoid spurious test failures using alias mappings On systems without enough random-access memory, stdlib/test-bz22786 will go deeply into swap and time out, even with a substantial TIMEOUTFACTOR. This commit adds a facility to construct repeating strings with alias mappings, so that the requirement for physical memory, and uses it in stdlib/test-bz22786. --- ChangeLog | 11 ++ stdlib/test-bz22786.c | 16 +-- support/Makefile | 2 + support/blob_repeat.c | 278 ++++++++++++++++++++++++++++++++++++++ support/blob_repeat.h | 44 ++++++ support/tst-support_blob_repeat.c | 85 ++++++++++++ 6 files changed, 426 insertions(+), 10 deletions(-) create mode 100644 support/blob_repeat.c create mode 100644 support/blob_repeat.h create mode 100644 support/tst-support_blob_repeat.c diff --git a/ChangeLog b/ChangeLog index ccfdf0d..a9e1713 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2018-10-30 Florian Weimer + + Avoid spurious test failures in stdlib/test-bz22786. + * support/Makefile (libsupport-routines): Add blob_repeat. + (tests): Add tst-support_blob_repeat. + * support/blob_repeat.h: New file. + * support/blob_repeat.c: Likewise. + * support/tst-support_blob_repeat.c: Likewise. + * stdlib/test-bz22786.c (do_test): Replace malloc and memset with + support_blob_repeat_allocate. + 2018-10-30 Andreas Schwab [BZ #23125] diff --git a/stdlib/test-bz22786.c b/stdlib/test-bz22786.c index 777bf91..bb1e04f 100644 --- a/stdlib/test-bz22786.c +++ b/stdlib/test-bz22786.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -39,17 +40,12 @@ do_test (void) const char *lnk = xasprintf ("%s/symlink", dir); const size_t path_len = (size_t) INT_MAX + strlen (lnk) + 1; - DIAG_PUSH_NEEDS_COMMENT; -#if __GNUC_PREREQ (7, 0) - /* GCC 7 warns about too-large allocations; here we need such - allocation to succeed for the test to work. */ - DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than="); -#endif - char *path = malloc (path_len); - DIAG_POP_NEEDS_COMMENT; + struct support_blob_repeat repeat + = support_blob_repeat_allocate ("a", 1, path_len); + char *path = repeat.start; if (path == NULL) { - printf ("malloc (%zu): %m\n", path_len); + printf ("Repeated allocation (%zu bytes): %m\n", path_len); /* On 31-bit s390 the malloc will always fail as we do not have so much memory, and we want to mark the test unsupported. Likewise on systems with little physical memory the test will @@ -62,7 +58,6 @@ do_test (void) /* Construct very long path = "/tmp/bz22786.XXXX/symlink/aaaa....." */ char *p = mempcpy (path, lnk, strlen (lnk)); *(p++) = '/'; - memset (p, 'a', path_len - (p - path) - 2); p[path_len - (p - path) - 1] = '\0'; /* This call crashes before the fix for bz22786 on 32-bit platforms. */ @@ -76,6 +71,7 @@ do_test (void) /* Cleanup. */ unlink (lnk); + support_blob_repeat_free (&repeat); return 0; } diff --git a/support/Makefile b/support/Makefile index 8b4a7bf..4d30703 100644 --- a/support/Makefile +++ b/support/Makefile @@ -25,6 +25,7 @@ extra-libs-others = $(extra-libs) extra-libs-noinstall := $(extra-libs) libsupport-routines = \ + blob_repeat \ check \ check_addrinfo \ check_dns_packet \ @@ -190,6 +191,7 @@ $(objpfx)true-container : $(libsupport) tests = \ README-testing \ tst-support-namespace \ + tst-support_blob_repeat \ tst-support_capture_subprocess \ tst-support_format_dns_packet \ tst-support_quote_blob \ diff --git a/support/blob_repeat.c b/support/blob_repeat.c new file mode 100644 index 0000000..da4ca83 --- /dev/null +++ b/support/blob_repeat.c @@ -0,0 +1,278 @@ +/* Repeating a memory blob, with alias mapping optimization. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Small allocations should use malloc directly instead of the mmap + optimization because mappings carry a lot of overhead. */ +static const size_t maximum_small_size = 4 * 1024 * 1024; + +/* Internal helper for fill. */ +static void +fill0 (char *target, const char *element, size_t element_size, + size_t count) +{ + while (count > 0) + { + memcpy (target, element, element_size); + target += element_size; + --count; + } +} + +/* Fill the buffer at TARGET with COUNT copies of the ELEMENT_SIZE + bytes starting at ELEMENT. */ +static void +fill (char *target, const char *element, size_t element_size, + size_t count) +{ + if (element_size == 0 || count == 0) + return; + else if (element_size == 1) + memset (target, element[0], count); + else if (element_size == sizeof (wchar_t)) + { + wchar_t wc; + memcpy (&wc, element, sizeof (wc)); + wmemset ((wchar_t *) target, wc, count); + } + else if (element_size < 1024 && count > 4096) + { + /* Use larger copies for really small element sizes. */ + char buffer[8192]; + size_t buffer_count = sizeof (buffer) / element_size; + fill0 (buffer, element, element_size, buffer_count); + while (count > 0) + { + size_t copy_count = buffer_count; + if (copy_count > count) + copy_count = count; + size_t copy_bytes = copy_count * element_size; + memcpy (target, buffer, copy_bytes); + target += copy_bytes; + count -= copy_count; + } + } + else + fill0 (target, element, element_size, count); +} + +/* Use malloc instead of mmap for small allocations and unusual size + combinations. */ +static struct support_blob_repeat +allocate_malloc (size_t total_size, const void *element, size_t element_size, + size_t count) +{ + void *buffer = malloc (total_size); + if (buffer == NULL) + return (struct support_blob_repeat) { 0 }; + fill (buffer, element, element_size, count); + return (struct support_blob_repeat) + { + .start = buffer, + .size = total_size, + .use_malloc = true + }; +} + +/* Return the least common multiple of PAGE_SIZE and ELEMENT_SIZE, + avoiding overflow. This assumes that PAGE_SIZE is a power of + two. */ +static size_t +minimum_stride_size (size_t page_size, size_t element_size) +{ + TEST_VERIFY_EXIT (page_size > 0); + TEST_VERIFY_EXIT (element_size > 0); + + /* Compute the number of trailing zeros common to both sizes. */ + unsigned int common_zeros = __builtin_ctzll (page_size | element_size); + + /* In the product, this power of two appears twice, but in the least + common multiple, it appears only once. Therefore, shift one + factor. */ + size_t multiple; + if (__builtin_mul_overflow (page_size >> common_zeros, element_size, + &multiple)) + return 0; + return multiple; +} + +/* Allocations larger than maximum_small_size potentially use mmap + with alias mappings. */ +static struct support_blob_repeat +allocate_big (size_t total_size, const void *element, size_t element_size, + size_t count) +{ + unsigned long page_size = xsysconf (_SC_PAGESIZE); + size_t stride_size = minimum_stride_size (page_size, element_size); + if (stride_size == 0) + { + errno = EOVERFLOW; + return (struct support_blob_repeat) { 0 }; + } + + /* Ensure that the stride size is at least maximum_small_size. This + is necessary to reduce the number of distinct mappings. */ + if (stride_size < maximum_small_size) + stride_size + = ((maximum_small_size + stride_size - 1) / stride_size) * stride_size; + + if (stride_size > total_size) + /* The mmap optimization would not save anything. */ + return allocate_malloc (total_size, element, element_size, count); + + /* Reserve the memory region. If we cannot create the mapping, + there is no reason to set up the backing file. */ + void *target = mmap (NULL, total_size, PROT_NONE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (target == MAP_FAILED) + return (struct support_blob_repeat) { 0 }; + + /* Create the backing file for the repeated mapping. */ + int fd; + { + char *temppath; + fd = create_temp_file ("support_blob_repeat-", &temppath); + if (fd < 0) + FAIL_EXIT1 ("create_temp_file: %m"); + xunlink (temppath); + free (temppath); + } + + /* Make sure that there is backing storage, so that the fill + operation will not fault. */ + if (posix_fallocate (fd, 0, stride_size) != 0) + FAIL_EXIT1 ("posix_fallocate (%zu): %m", stride_size); + + /* The stride size must still be a multiple of the page size and + element size. */ + TEST_VERIFY_EXIT ((stride_size % page_size) == 0); + TEST_VERIFY_EXIT ((stride_size % element_size) == 0); + + /* Fill the backing store. */ + { + void *ptr = mmap (target, stride_size, PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_FILE | MAP_SHARED, fd, 0); + if (ptr == MAP_FAILED) + { + int saved_errno = errno; + xmunmap (target, total_size); + xclose (fd); + errno = saved_errno; + return (struct support_blob_repeat) { 0 }; + } + if (ptr != target) + FAIL_EXIT1 ("mapping of %zu bytes moved from %p to %p", + stride_size, target, ptr); + + /* Write the repeating data. */ + fill (target, element, element_size, stride_size / element_size); + + /* Return to a PROT_NONE mapping, just to be on the safe side. */ + ptr = mmap (target, stride_size, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (ptr == MAP_FAILED) + FAIL_EXIT1 ("Failed to reinstate PROT_NONE mapping: %m"); + if (ptr != target) + FAIL_EXIT1 ("PROT_NONE mapping of %zu bytes moved from %p to %p", + stride_size, target, ptr); + } + + /* Create the alias mappings. */ + { + size_t remaining_size = total_size; + char *current = target; + int flags = MAP_FIXED | MAP_FILE | MAP_PRIVATE; +#ifdef MAP_NORESERVE + flags |= MAP_NORESERVE; +#endif + while (remaining_size > 0) + { + size_t to_map = stride_size; + if (to_map > remaining_size) + to_map = remaining_size; + void *ptr = mmap (current, to_map, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (ptr == MAP_FAILED) + { + int saved_errno = errno; + xmunmap (target, total_size); + xclose (fd); + errno = saved_errno; + return (struct support_blob_repeat) { 0 }; + } + if (ptr != current) + FAIL_EXIT1 ("MAP_PRIVATE mapping of %zu bytes moved from %p to %p", + to_map, target, ptr); + remaining_size -= to_map; + current += to_map; + } + } + + xclose (fd); + + return (struct support_blob_repeat) + { + .start = target, + .size = total_size, + .use_malloc = false + }; +} + +struct support_blob_repeat +support_blob_repeat_allocate (const void *element, size_t element_size, + size_t count) +{ + size_t total_size; + if (__builtin_mul_overflow (element_size, count, &total_size)) + { + errno = EOVERFLOW; + return (struct support_blob_repeat) { 0 }; + } + if (total_size <= maximum_small_size) + return allocate_malloc (total_size, element, element_size, count); + else + return allocate_big (total_size, element, element_size, count); +} + +void +support_blob_repeat_free (struct support_blob_repeat *blob) +{ + if (blob->size > 0) + { + int saved_errno = errno; + if (blob->use_malloc) + free (blob->start); + else + xmunmap (blob->start, blob->size); + errno = saved_errno; + } + *blob = (struct support_blob_repeat) { 0 }; +} diff --git a/support/blob_repeat.h b/support/blob_repeat.h new file mode 100644 index 0000000..8e9d7ff --- /dev/null +++ b/support/blob_repeat.h @@ -0,0 +1,44 @@ +/* Repeating a memory blob, with alias mapping optimization. + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef SUPPORT_BLOB_REPEAT_H +#define SUPPORT_BLOB_REPEAT_H + +#include +#include + +struct support_blob_repeat +{ + void *start; + size_t size; + bool use_malloc; +}; + +/* Return an allocation of COUNT elements, each of ELEMENT_SIZE bytes, + initialized with the bytes starting at ELEMENT. The memory is + writable (and thus counts towards the commit charge). In case of + on error, all members of the return struct are zero-initialized, + and errno is set accordingly. */ +struct support_blob_repeat support_blob_repeat_allocate (const void *element, + size_t element_size, + size_t count); + +/* Deallocate the blob created by support_blob_repeat_allocate. */ +void support_blob_repeat_free (struct support_blob_repeat *); + +#endif /* SUPPORT_BLOB_REPEAT_H */ diff --git a/support/tst-support_blob_repeat.c b/support/tst-support_blob_repeat.c new file mode 100644 index 0000000..1978c14 --- /dev/null +++ b/support/tst-support_blob_repeat.c @@ -0,0 +1,85 @@ +/* Tests for + Copyright (C) 2018 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +static int +do_test (void) +{ + struct support_blob_repeat repeat + = support_blob_repeat_allocate ("5", 1, 5); + TEST_COMPARE_BLOB (repeat.start, repeat.size, "55555", 5); + support_blob_repeat_free (&repeat); + + repeat = support_blob_repeat_allocate ("ABC", 3, 3); + TEST_COMPARE_BLOB (repeat.start, repeat.size, "ABCABCABC", 9); + support_blob_repeat_free (&repeat); + + repeat = support_blob_repeat_allocate ("abc", 4, 3); + TEST_COMPARE_BLOB (repeat.start, repeat.size, "abc\0abc\0abc", 12); + support_blob_repeat_free (&repeat); + + size_t gigabyte = 1U << 30; + repeat = support_blob_repeat_allocate ("X", 1, gigabyte + 1); + if (repeat.start == NULL) + puts ("warning: not enough memory for 1 GiB mapping"); + else + { + TEST_COMPARE (repeat.size, gigabyte + 1); + { + unsigned char *p = repeat.start; + for (size_t i = 0; i < gigabyte + 1; ++i) + if (p[i] != 'X') + FAIL_EXIT1 ("invalid byte 0x%02x at %zu", p[i], i); + + /* Check that there is no sharing across the mapping. */ + p[0] = 'Y'; + p[1U << 24] = 'Z'; + for (size_t i = 0; i < gigabyte + 1; ++i) + if (i == 0) + TEST_COMPARE (p[i], 'Y'); + else if (i == 1U << 24) + TEST_COMPARE (p[i], 'Z'); + else if (p[i] != 'X') + FAIL_EXIT1 ("invalid byte 0x%02x at %zu", p[i], i); + } + } + support_blob_repeat_free (&repeat); + + repeat = support_blob_repeat_allocate ("012345678", 9, 10 * 1000 * 1000); + if (repeat.start == NULL) + puts ("warning: not enough memory for large mapping"); + else + { + unsigned char *p = repeat.start; + for (int i = 0; i < 10 * 1000 * 1000; ++i) + for (int j = 0; j <= 8; ++j) + if (p[i * 9 + j] != '0' + j) + { + printf ("error: element %d index %d\n", i, j); + TEST_COMPARE (p[i * 9 + j], '0' + j); + } + } + support_blob_repeat_free (&repeat); + + return 0; +} + +#include -- cgit v1.1 From 07da99aad93c9364acb7efdab47c27ba698f6313 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 30 Oct 2018 13:55:01 +0100 Subject: stdlib/tst-strtod-overflow: Switch to support_blob_repeat This is another test with an avoidable large memory allocation. --- ChangeLog | 5 +++++ stdlib/tst-strtod-overflow.c | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9e1713..734defa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-10-30 Florian Weimer + * stdlib/tst-strtod-overflow.c (do_test): Switch to + support_blob_repeat. + +2018-10-30 Florian Weimer + Avoid spurious test failures in stdlib/test-bz22786. * support/Makefile (libsupport-routines): Add blob_repeat. (tests): Add tst-support_blob_repeat. diff --git a/stdlib/tst-strtod-overflow.c b/stdlib/tst-strtod-overflow.c index d14638d..dc53c1e 100644 --- a/stdlib/tst-strtod-overflow.c +++ b/stdlib/tst-strtod-overflow.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #define EXPONENT "e-2147483649" #define SIZE 214748364 @@ -26,21 +28,23 @@ static int do_test (void) { - char *p = malloc (1 + SIZE + sizeof (EXPONENT)); - if (p == NULL) + struct support_blob_repeat repeat = support_blob_repeat_allocate + ("0", 1, 1 + SIZE + sizeof (EXPONENT)); + if (repeat.size == 0) { - puts ("malloc failed, cannot test for overflow"); - return 0; + puts ("warning: memory allocation failed, cannot test for overflow"); + return EXIT_UNSUPPORTED; } + char *p = repeat.start; p[0] = '1'; - memset (p + 1, '0', SIZE); memcpy (p + 1 + SIZE, EXPONENT, sizeof (EXPONENT)); double d = strtod (p, NULL); if (d != 0) { - printf ("strtod returned wrong value: %a\n", d); + printf ("error: strtod returned wrong value: %a\n", d); return 1; } + support_blob_repeat_free (&repeat); return 0; } -- cgit v1.1 From a91e9301c47bb688f4e496a19cfc68261ff18293 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 30 Oct 2018 13:55:50 +0100 Subject: support_blob_repeat: Call mkstemp directory for the backing file This avoids a warning during post-test cleanup. --- ChangeLog | 4 ++++ support/blob_repeat.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 734defa..eefe1ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-10-30 Florian Weimer + * support/blob_repeat.c (allocate_big): Call mkstemp directly. + +2018-10-30 Florian Weimer + * stdlib/tst-strtod-overflow.c (do_test): Switch to support_blob_repeat. diff --git a/support/blob_repeat.c b/support/blob_repeat.c index da4ca83..16c1e44 100644 --- a/support/blob_repeat.c +++ b/support/blob_repeat.c @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -155,13 +155,17 @@ allocate_big (size_t total_size, const void *element, size_t element_size, if (target == MAP_FAILED) return (struct support_blob_repeat) { 0 }; - /* Create the backing file for the repeated mapping. */ + /* Create the backing file for the repeated mapping. Call mkstemp + directly to remove the resources backing the temporary file + immediately, once support_blob_repeat_free is called. Using + create_temp_file would result in a warning during post-test + cleanup. */ int fd; { - char *temppath; - fd = create_temp_file ("support_blob_repeat-", &temppath); + char *temppath = xasprintf ("%s/support_blob_repeat-XXXXXX", test_dir); + fd = mkstemp (temppath); if (fd < 0) - FAIL_EXIT1 ("create_temp_file: %m"); + FAIL_EXIT1 ("mkstemp (\"%s\"): %m", temppath); xunlink (temppath); free (temppath); } -- cgit v1.1 From 60708030536df82616c16aa2f14f533c4362b969 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 30 Oct 2018 13:56:40 +0100 Subject: stdlib/test-bz22786: Avoid memory leaks in the test itself --- ChangeLog | 5 +++++ stdlib/test-bz22786.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index eefe1ce..1649229 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-10-30 Florian Weimer + * stdlib/test-bz22786.c (do_test): Additional free calls to avoid + memory leaks. + +2018-10-30 Florian Weimer + * support/blob_repeat.c (allocate_big): Call mkstemp directly. 2018-10-30 Florian Weimer diff --git a/stdlib/test-bz22786.c b/stdlib/test-bz22786.c index bb1e04f..8035e8a 100644 --- a/stdlib/test-bz22786.c +++ b/stdlib/test-bz22786.c @@ -36,8 +36,8 @@ static int do_test (void) { - const char *dir = support_create_temp_directory ("bz22786."); - const char *lnk = xasprintf ("%s/symlink", dir); + char *dir = support_create_temp_directory ("bz22786."); + char *lnk = xasprintf ("%s/symlink", dir); const size_t path_len = (size_t) INT_MAX + strlen (lnk) + 1; struct support_blob_repeat repeat @@ -72,6 +72,8 @@ do_test (void) /* Cleanup. */ unlink (lnk); support_blob_repeat_free (&repeat); + free (lnk); + free (dir); return 0; } -- cgit v1.1 From 3ca235ed369872a6ec15cb15e826cd983d09f786 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 30 Oct 2018 22:18:34 +0000 Subject: Convert linknamespace tests from Perl to Python. This patch replaces conform/linknamespace.pl with a new conform/linknamespace.py, so continuing the consolidation on Python instead of Perl for miscellaneous scripts used in building and testing glibc. The new script follows the same logic as the old one; as a recently-added script, there were no major cleanups to be made in the course of the language conversion. Tested for x86_64, and with build-many-glibcs.py. For x86_64 I also tested that if the Perl and Python scripts were made to print all the symbols in seen_where and the paths of symbol references by which those symbols were linked in, even when those symbols were OK, identical symbol lists appeared in the output with both versions of the script (the differences in linknamespace.out files were only in paths to temporary files in diagnostics for e.g. deprecated functions, and error output for the expected compilation failures when testing ndbm.h and varargs.h). * conform/linknamespace.py: New file. * conform/linknamespace.pl: Remove file. * conform/Makefile ($(linknamespace-header-tests)): Use linknamespace.py instead of linknamespace.pl. Do not use --tmpdir option. --- ChangeLog | 8 ++ conform/Makefile | 13 ++- conform/linknamespace.pl | 233 ----------------------------------------------- conform/linknamespace.py | 217 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+), 240 deletions(-) delete mode 100644 conform/linknamespace.pl create mode 100644 conform/linknamespace.py diff --git a/ChangeLog b/ChangeLog index 1649229..86040c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-10-30 Joseph Myers + + * conform/linknamespace.py: New file. + * conform/linknamespace.pl: Remove file. + * conform/Makefile ($(linknamespace-header-tests)): Use + linknamespace.py instead of linknamespace.pl. Do not use --tmpdir + option. + 2018-10-30 Florian Weimer * stdlib/test-bz22786.c (do_test): Additional free calls to avoid diff --git a/conform/Makefile b/conform/Makefile index a2bbe0f..fbc4110 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -218,17 +218,16 @@ $(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ $(evaluate-test) $(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \ - linknamespace.pl \ + linknamespace.py \ $(linknamespace-symlists-tests) \ $(linknamespace-symlist-stdlibs-tests) (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ mkdir -p $(@D)/scratch; \ - $(PERL) -I. -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \ - --libsyms=$(objpfx)symlist-stdlibs-$$std \ - --readelf='$(READELF)' \ - > $@ 2>&1); \ + $(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \ + --standard=$$std --stdsyms=$(objpfx)symlist-$$std \ + --header=$$hdr --libsyms=$(objpfx)symlist-stdlibs-$$std \ + --readelf='$(READELF)' \ + > $@ 2>&1); \ $(evaluate-test) # Pre-standard C feature no longer supported by GCC (obsoleted in diff --git a/conform/linknamespace.pl b/conform/linknamespace.pl deleted file mode 100644 index 3fc6aca..0000000 --- a/conform/linknamespace.pl +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/perl - -# Check that use of symbols declared in a given header does not result -# in any symbols being brought in that are not reserved with external -# linkage for the given standard. - -# Copyright (C) 2014-2018 Free Software Foundation, Inc. -# This file is part of the GNU C Library. - -# The GNU C Library is free software; you can redistribute it and/or -# 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. - -# 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 -# Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public -# License along with the GNU C Library; if not, see -# . - -use GlibcConform; -use Getopt::Long; - -GetOptions ('header=s' => \$header, 'standard=s' => \$standard, - 'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir, - 'stdsyms=s' => \$stdsyms_file, 'libsyms=s' => \$libsyms_file, - 'readelf=s' => \$READELF); - -# Load the list of symbols that are OK. -%stdsyms = (); -open (STDSYMS, "<$stdsyms_file") || die ("open $stdsyms_file: $!\n"); -while () { - chomp; - $stdsyms{$_} = 1; -} -close (STDSYMS) || die ("close $stdsyms_file: $!\n"); - -# The following whitelisted symbols are also allowed for now. -# -# * Bug 17576: stdin, stdout, stderr only reserved with external -# linkage when stdio.h included (and possibly not then), not -# generally. -# -# * Bug 18442: re_syntax_options wrongly brought in by regcomp and -# used by re_comp. -# -@whitelist = qw(stdin stdout stderr re_syntax_options); -foreach my $sym (@whitelist) { - $stdsyms{$sym} = 1; -} - -# Return information about GLOBAL and WEAK symbols listed in readelf -# -s output. -sub list_syms { - my ($syms_file) = @_; - open (SYMS, "<$syms_file") || die ("open $syms_file: $!\n"); - my ($file) = $syms_file; - my (@ret) = (); - while () { - chomp; - if (/^File: (.*)/) { - $file = $1; - $file =~ s|^.*/||; - next; - } - s/^\s*//; - # Architecture-specific st_other bits appear inside [] and disrupt - # the format of readelf output. - s/\[.*?\]//; - my (@fields) = split (/\s+/, $_); - if (@fields < 8) { - next; - } - my ($bind) = $fields[4]; - my ($ndx) = $fields[6]; - my ($sym) = $fields[7]; - if ($bind ne "GLOBAL" && $bind ne "WEAK") { - next; - } - if ($sym !~ /^\w+$/) { - next; - } - push (@ret, [$file, $sym, $bind, $ndx ne "UND"]); - } - close (SYMS) || die ("close $syms_file: $!\n"); - return @ret; -} - -# Load information about GLOBAL and WEAK symbols defined or used in -# the standard libraries. -# Symbols from a given object, except for weak defined symbols. -%seen_syms = (); -# Strong undefined symbols from a given object. -%strong_undef_syms = (); -# Objects defining a given symbol (strongly or weakly). -%sym_objs = (); -@sym_data = list_syms ($libsyms_file); -foreach my $sym (@sym_data) { - my ($file, $name, $bind, $defined) = @$sym; - if ($defined) { - if (!defined ($sym_objs{$name})) { - $sym_objs{$name} = []; - } - push (@{$sym_objs{$name}}, $file); - } - if ($bind eq "GLOBAL" || !$defined) { - if (!defined ($seen_syms{$file})) { - $seen_syms{$file} = []; - } - push (@{$seen_syms{$file}}, $name); - } - if ($bind eq "GLOBAL" && !$defined) { - if (!defined ($strong_undef_syms{$file})) { - $strong_undef_syms{$file} = []; - } - push (@{$strong_undef_syms{$file}}, $name); - } -} - -# Determine what ELF-level symbols are brought in by use of C-level -# symbols declared in the given header. -# -# The rules followed are heuristic and so may produce false positives -# and false negatives. -# -# * All undefined symbols are considered of signficance, but it is -# possible that (a) any standard library definition is weak, so can be -# overridden by the user's definition, and (b) the symbol is only used -# conditionally and not if the program is limited to standard -# functionality. -# -# * If a symbol reference is only brought in by the user using a data -# symbol rather than a function from the standard library, this will -# not be detected. -# -# * If a symbol reference is only brought in by crt*.o or libgcc, this -# will not be detected. -# -# * If a symbol reference is only brought in through __builtin_foo in -# a standard macro being compiled to call foo, this will not be -# detected. -# -# * Header inclusions should be compiled several times with different -# options such as -O2, -D_FORTIFY_SOURCE and -D_FILE_OFFSET_BITS=64 to -# find out what symbols are undefined from such a compilation; this is -# not yet implemented. -# -# * This script finds symbols referenced through use of macros on the -# basis that if a macro calls an internal function, that function must -# also be declared in the header. However, the header might also -# declare implementation-namespace functions that are not called by -# any standard macro in the header, resulting in false positives for -# any symbols brought in only through use of those -# implementation-namespace functions. -# -# * Namespace issues can apply for dynamic linking as well as static -# linking, when a call is from one shared library to another or uses a -# PLT entry for a call within a shared library; such issues are only -# detected by this script if the same namespace issue applies for -# static linking. - -@c_syms = list_exported_functions ("$CC $flags", $standard, $header, $tmpdir); -$cincfile = "$tmpdir/undef-$$.c"; -$cincfile_o = "$tmpdir/undef-$$.o"; -$cincfile_sym = "$tmpdir/undef-$$.sym"; -open (CINCFILE, ">$cincfile") || die ("open $cincfile: $!\n"); -print CINCFILE "#include <$header>\n"; -foreach my $sym (sort @c_syms) { - print CINCFILE "void *__glibc_test_$sym = (void *) &$sym;\n"; -} -close CINCFILE || die ("close $cincfile: $!\n"); -system ("$CC $flags -D_ISOMAC $CFLAGS{$standard} -c $cincfile -o $cincfile_o") - && die ("compiling failed\n"); -system ("LC_ALL=C $READELF -W -s $cincfile_o > $cincfile_sym") - && die ("readelf failed\n"); -@elf_syms = list_syms ($cincfile_sym); -unlink ($cincfile) || die ("unlink $cincfile: $!\n"); -unlink ($cincfile_o) || die ("unlink $cincfile_o: $!\n"); -unlink ($cincfile_sym) || die ("unlink $cincfile_sym: $!\n"); - -%seen_where = (); -%files_seen = (); -%all_undef = (); -%current_undef = (); -foreach my $sym (@elf_syms) { - my ($file, $name, $bind, $defined) = @$sym; - if ($bind eq "GLOBAL" && !$defined) { - $seen_where{$name} = "[initial] $name"; - $all_undef{$name} = "[initial] $name"; - $current_undef{$name} = "[initial] $name"; - } -} - -while (%current_undef) { - %new_undef = (); - foreach my $sym (sort keys %current_undef) { - foreach my $file (@{$sym_objs{$sym}}) { - if (defined ($files_seen{$file})) { - next; - } - $files_seen{$file} = 1; - foreach my $ssym (@{$seen_syms{$file}}) { - if (!defined ($seen_where{$ssym})) { - $seen_where{$ssym} = "$current_undef{$sym} -> [$file] $ssym"; - } - } - foreach my $usym (@{$strong_undef_syms{$file}}) { - if (!defined ($all_undef{$usym})) { - $all_undef{$usym} = "$current_undef{$sym} -> [$file] $usym"; - $new_undef{$usym} = "$current_undef{$sym} -> [$file] $usym"; - } - } - } - } - %current_undef = %new_undef; -} - -$ret = 0; -foreach my $sym (sort keys %seen_where) { - if ($sym =~ /^_/) { - next; - } - if (defined ($stdsyms{$sym})) { - next; - } - print "$seen_where{$sym}\n"; - $ret = 1; -} - -exit $ret; diff --git a/conform/linknamespace.py b/conform/linknamespace.py new file mode 100644 index 0000000..07a7754 --- /dev/null +++ b/conform/linknamespace.py @@ -0,0 +1,217 @@ +#!/usr/bin/python +# Check that use of symbols declared in a given header does not result +# in any symbols being brought in that are not reserved with external +# linkage for the given standard. +# Copyright (C) 2014-2018 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# +# The GNU C Library is free software; you can redistribute it and/or +# 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. +# +# 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +import argparse +from collections import defaultdict +import os.path +import re +import subprocess +import sys +import tempfile + +import glibcconform + +# The following whitelisted symbols are also allowed for now. +# +# * Bug 17576: stdin, stdout, stderr only reserved with external +# linkage when stdio.h included (and possibly not then), not +# generally. +# +# * Bug 18442: re_syntax_options wrongly brought in by regcomp and +# used by re_comp. +# +WHITELIST = {'stdin', 'stdout', 'stderr', 're_syntax_options'} + + +def list_syms(filename): + """Return information about GLOBAL and WEAK symbols listed in readelf + -s output.""" + ret = [] + cur_file = filename + with open(filename, 'r') as syms_file: + for line in syms_file: + line = line.rstrip() + if line.startswith('File: '): + cur_file = line[len('File: '):] + cur_file = cur_file.split('/')[-1] + continue + # Architecture-specific st_other bits appear inside [] and + # disrupt the format of readelf output. + line = re.sub(r'\[.*?\]', '', line) + fields = line.split() + if len(fields) < 8: + continue + bind = fields[4] + ndx = fields[6] + sym = fields[7] + if bind not in ('GLOBAL', 'WEAK'): + continue + if not re.fullmatch('[A-Za-z0-9_]+', sym): + continue + ret.append((cur_file, sym, bind, ndx != 'UND')) + return ret + + +def main(): + """The main entry point.""" + parser = argparse.ArgumentParser(description='Check link-time namespace.') + parser.add_argument('--header', metavar='HEADER', + help='name of header') + parser.add_argument('--standard', metavar='STD', + help='standard to use when processing header') + parser.add_argument('--cc', metavar='CC', + help='C compiler to use') + parser.add_argument('--flags', metavar='CFLAGS', + help='Compiler flags to use with CC') + parser.add_argument('--stdsyms', metavar='FILE', + help='File with list of standard symbols') + parser.add_argument('--libsyms', metavar='FILE', + help='File with symbol information from libraries') + parser.add_argument('--readelf', metavar='READELF', + help='readelf program to use') + args = parser.parse_args() + + # Load the list of symbols that are OK. + stdsyms = set() + with open(args.stdsyms, 'r') as stdsyms_file: + for line in stdsyms_file: + stdsyms.add(line.rstrip()) + stdsyms |= WHITELIST + + # Load information about GLOBAL and WEAK symbols defined or used + # in the standard libraries. + # Symbols from a given object, except for weak defined symbols. + seen_syms = defaultdict(list) + # Strong undefined symbols from a given object. + strong_undef_syms = defaultdict(list) + # Objects defining a given symbol (strongly or weakly). + sym_objs = defaultdict(list) + for file, name, bind, defined in list_syms(args.libsyms): + if defined: + sym_objs[name].append(file) + if bind == 'GLOBAL' or not defined: + seen_syms[file].append(name) + if bind == 'GLOBAL' and not defined: + strong_undef_syms[file].append(name) + + # Determine what ELF-level symbols are brought in by use of C-level + # symbols declared in the given header. + # + # The rules followed are heuristic and so may produce false + # positives and false negatives. + # + # * All undefined symbols are considered of signficance, but it is + # possible that (a) any standard library definition is weak, so + # can be overridden by the user's definition, and (b) the symbol + # is only used conditionally and not if the program is limited to + # standard functionality. + # + # * If a symbol reference is only brought in by the user using a + # data symbol rather than a function from the standard library, + # this will not be detected. + # + # * If a symbol reference is only brought in by crt*.o or libgcc, + # this will not be detected. + # + # * If a symbol reference is only brought in through __builtin_foo + # in a standard macro being compiled to call foo, this will not be + # detected. + # + # * Header inclusions should be compiled several times with + # different options such as -O2, -D_FORTIFY_SOURCE and + # -D_FILE_OFFSET_BITS=64 to find out what symbols are undefined + # from such a compilation; this is not yet implemented. + # + # * This script finds symbols referenced through use of macros on + # the basis that if a macro calls an internal function, that + # function must also be declared in the header. However, the + # header might also declare implementation-namespace functions + # that are not called by any standard macro in the header, + # resulting in false positives for any symbols brought in only + # through use of those implementation-namespace functions. + # + # * Namespace issues can apply for dynamic linking as well as + # static linking, when a call is from one shared library to + # another or uses a PLT entry for a call within a shared library; + # such issues are only detected by this script if the same + # namespace issue applies for static linking. + seen_where = {} + files_seen = set() + all_undef = {} + current_undef = {} + compiler = '%s %s' % (args.cc, args.flags) + c_syms = glibcconform.list_exported_functions(compiler, args.standard, + args.header) + with tempfile.TemporaryDirectory() as temp_dir: + cincfile_name = os.path.join(temp_dir, 'undef.c') + cincfile_o_name = os.path.join(temp_dir, 'undef.o') + cincfile_sym_name = os.path.join(temp_dir, 'undef.sym') + cincfile_text = ('#include <%s>\n%s\n' + % (args.header, + '\n'.join('void *__glibc_test_%s = (void *) &%s;' + % (sym, sym) for sym in sorted(c_syms)))) + with open(cincfile_name, 'w') as cincfile: + cincfile.write(cincfile_text) + cmd = ('%s %s -D_ISOMAC %s -c %s -o %s' + % (args.cc, args.flags, glibcconform.CFLAGS[args.standard], + cincfile_name, cincfile_o_name)) + subprocess.check_call(cmd, shell=True) + cmd = ('LC_ALL=C %s -W -s %s > %s' + % (args.readelf, cincfile_o_name, cincfile_sym_name)) + subprocess.check_call(cmd, shell=True) + for file, name, bind, defined in list_syms(cincfile_sym_name): + if bind == 'GLOBAL' and not defined: + sym_text = '[initial] %s' % name + seen_where[name] = sym_text + all_undef[name] = sym_text + current_undef[name] = sym_text + + while current_undef: + new_undef = {} + for sym, cu_sym in sorted(current_undef.items()): + for file in sym_objs[sym]: + if file in files_seen: + continue + files_seen.add(file) + for ssym in seen_syms[file]: + if ssym not in seen_where: + seen_where[ssym] = ('%s -> [%s] %s' + % (cu_sym, file, ssym)) + for usym in strong_undef_syms[file]: + if usym not in all_undef: + usym_text = '%s -> [%s] %s' % (cu_sym, file, usym) + all_undef[usym] = usym_text + new_undef[usym] = usym_text + current_undef = new_undef + + ret = 0 + for sym in sorted(seen_where): + if sym.startswith('_'): + continue + if sym in stdsyms: + continue + print(seen_where[sym]) + ret = 1 + sys.exit(ret) + + +if __name__ == '__main__': + main() -- cgit v1.1 From e3a88b3e9d7dc37e5e0d7d2a49161442081198e0 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 31 Oct 2018 01:49:11 +0100 Subject: hurd: Document how to translate EIEIO error message * sysdeps/gnu/errlist.c (EIEIO): Document how translators should translate the error message. --- ChangeLog | 5 +++++ sysdeps/gnu/errlist.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 86040c0..c2d1d84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-10-31 Samuel Thibault + + * sysdeps/gnu/errlist.c (EIEIO): Document how translators should + translate the error message. + 2018-10-30 Joseph Myers * conform/linknamespace.py: New file. diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c index 31ebfa9..ccb9986 100644 --- a/sysdeps/gnu/errlist.c +++ b/sysdeps/gnu/errlist.c @@ -975,6 +975,19 @@ TRANS You did @strong{what}? */ #ifdef EIEIO /* TRANS Go home and have a glass of warm, dairy-fresh milk. */ +TRANS @c Okay. Since you are dying to know, I'll tell you. +TRANS @c This is a joke, obviously. There is a children's song which begins, +TRANS @c "Old McDonald had a farm, e-i-e-i-o." Every time I see the (real) +TRANS @c errno macro EIO, I think about that song. Probably most of my +TRANS @c compatriots who program on Unix do, too. One of them must have stayed +TRANS @c up a little too late one night and decided to add it to Hurd or Glibc. +TRANS @c Whoever did it should be castigated, but it made me laugh. +TRANS @c --jtobey@channel1.com +TRANS @c +TRANS @c "bought the farm" means "died". -jtobey +TRANS @c +TRANS @c Translators, please do not translate this litteraly, translate it into +TRANS @c an idiomatic funny way of saying that the computer died. [ERR_REMAP (EIEIO)] = N_("Computer bought the farm"), # if EIEIO > ERR_MAX # undef ERR_MAX -- cgit v1.1 From 3ed7c33fa2915008ec861f25b2d54a0ccc59ca21 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 31 Oct 2018 09:17:05 +0100 Subject: hurd: Fix build * sysdeps/gnu/errlist.c (EIEIO): Fix comment marker. --- sysdeps/gnu/errlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c index ccb9986..77577bf 100644 --- a/sysdeps/gnu/errlist.c +++ b/sysdeps/gnu/errlist.c @@ -974,7 +974,7 @@ TRANS You did @strong{what}? */ #endif #ifdef EIEIO /* -TRANS Go home and have a glass of warm, dairy-fresh milk. */ +TRANS Go home and have a glass of warm, dairy-fresh milk. TRANS @c Okay. Since you are dying to know, I'll tell you. TRANS @c This is a joke, obviously. There is a children's song which begins, TRANS @c "Old McDonald had a farm, e-i-e-i-o." Every time I see the (real) @@ -987,7 +987,7 @@ TRANS @c TRANS @c "bought the farm" means "died". -jtobey TRANS @c TRANS @c Translators, please do not translate this litteraly, translate it into -TRANS @c an idiomatic funny way of saying that the computer died. +TRANS @c an idiomatic funny way of saying that the computer died. */ [ERR_REMAP (EIEIO)] = N_("Computer bought the farm"), # if EIEIO > ERR_MAX # undef ERR_MAX -- cgit v1.1