about summary refs log tree commit diff
path: root/stdio-common
Commit message (Collapse)AuthorAgeFilesLines
* signal: Move sys_errlist to a compat symbolAdhemerval Zanella2020-07-074-14/+101
| | | | | | | | | | | | | | | | | | | | The symbol is deprecated by strerror since its usage imposes some issues such as copy relocations. Its internal name is also changed to _sys_errlist_internal to avoid static linking usage. The compat code is also refactored by removing the over enginered errlist-compat.c generation from manual entried and extra comment token in linker script file. It disantangle the code generation from manual and simplify both Linux and Hurd compat code. The definitions from errlist.c are moved to errlist.h and a new test is added to avoid a new errno entry without an associated one in manual. Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi on all affected platforms. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* signal: Move sys_siglist to a compat symbolAdhemerval Zanella2020-07-073-5/+7
| | | | | | | | | | | | | | | | | | | The symbol was deprecated by strsignal and its usage imposes issues such as copy relocations. Its internal name is changed to __sys_siglist and __sys_sigabbrev to avoid static linking usage. The compat code is also refactored, since both Linux and Hurd usage the same strategy: export the same array with different object sizes. The libSegfault change avoids calling strsignal on the SIGFAULT signal handler (the current usage is already sketchy, adding a call that potentially issue locale internal function is even sketchier). Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi on all affected platforms. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove most vfprintf width/precision-dependent allocations (bug 14231, bug ↵Joseph Myers2020-07-074-121/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 26211). The vfprintf implementation (used for all printf-family functions) contains complicated logic to allocate internal buffers of a size depending on the width and precision used for a format, using either malloc or alloca depending on that size, and with consequent checks for size overflow and allocation failure. As noted in bug 26211, the version of that logic used when '$' plus argument number formats are in use is missing the overflow checks, which can result in segfaults (quite possibly exploitable, I didn't try to work that out) when the width or precision is in the range 0x7fffffe0 through 0x7fffffff (maybe smaller values as well in the wprintf case on 32-bit systems, when the multiplication by sizeof (CHAR_T) can overflow). All that complicated logic in fact appears to be useless. As far as I can tell, there has been no need (outside the floating-point printf code, which does its own allocations) for allocations depending on width or precision since commit 3e95f6602b226e0de06aaff686dc47b282d7cc16 ("Remove limitation on size of precision for integers", Sun Sep 12 21:23:32 1999 +0000). Thus, this patch removes that logic completely, thereby fixing both problems with excessive allocations for large width and precision for non-floating-point formats, and the problem with missing overflow checks with such allocations. Note that this does have the consequence that width and precision up to INT_MAX are now allowed where previously INT_MAX / sizeof (CHAR_T) - EXTSIZ or more would have been rejected, so could potentially expose any other overflows where the value would previously have been rejected by those removed checks. I believe this completely fixes bugs 14231 and 26211. Excessive allocations are still possible in the floating-point case (bug 21127), as are other integer or buffer overflows (see bug 26201). This does not address the cases where a precision larger than INT_MAX (embedded in the format string) would be meaningful without printf's return value overflowing (when it's used with a string format, or %g without the '#' flag, so the actual output will be much smaller), as mentioned in bug 17829 comment 8; using size_t internally for precision to handle that case would be complicated by struct printf_info being a public ABI. Nor does it address the matter of an INT_MIN width being negated (bug 17829 comment 7; the same logic appears a second time in the file as well, in the form of multiplying by -1). There may be other sources of memory allocations with malloc in printf functions as well (bug 24988, bug 16060). From inspection, I think there are also integer overflows in two copies of "if ((width -= len) < 0)" logic (where width is int, len is size_t and a very long string could result in spurious padding being output on a 32-bit system before printf overflows the count of output characters). Tested for x86-64 and x86.
* Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABIPaul E. Murphy2020-04-302-2/+2
| | | | | | | | | | | | | | | Improve the commentary to aid future developers who will stumble upon this novel, yet not always perfect, mechanism to support alternative formats for long double. Likewise, rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI now that development work has settled down. The command used was git grep -l __LONG_DOUBLE_USES_FLOAT128 ':!./ChangeLog*' | \ xargs sed -i 's/__LONG_DOUBLE_USES_FLOAT128/__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI/g' Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* Fix tests which expose ldbl -> _Float128 redirectsPaul E. Murphy2020-03-251-0/+4
| | | | | | | | | | | | | | | | | | The ldbl redirects for ieee128 have some jagged edges when inspecting and manipulating symbols directly. e.g asprintf is unconditionally redirected to __asprintfieee128 thus any tests relying on GCC's redirect behavior will encounter problems if they inspect the symbol names too closely. I've mitigated tests which expose the limitations of the ldbl -> f128 redirects by giving them knowledge about the redirected symbol names. Hopefully there isn't much user code which depends on this implementation specific behavior. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* stdio: Add tests for printf multibyte convertion leak [BZ#25691]Adhemerval Zanella2020-03-202-2/+115
| | | | Checked on x86_64-linux-gnu and i686-linux-gnu.
* stdio: Remove memory leak from multibyte convertion [BZ#25691]Florian Weimer2020-03-201-144/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an updated version of a previous patch [1] with the following changes: - Use compiler overflow builtins on done_add_func function. - Define the scratch +utstring_converted_wide_string using CHAR_T. - Added a testcase and mention the bug report. Both default and wide printf functions might leak memory when manipulate multibyte characters conversion depending of the size of the input (whether __libc_use_alloca trigger or not the fallback heap allocation). This patch fixes it by removing the extra memory allocation on string formatting with conversion parts. The testcase uses input argument size that trigger memory leaks on unpatched code (using a scratch buffer the threashold to use heap allocation is lower). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [1] https://sourceware.org/pipermail/libc-alpha/2017-June/082098.html
* Prepare redirections for IEEE long double on powerpc64leGabriel F. T. Gomes2020-02-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | All functions that have a format string, which can consume a long double argument, must have one version for each long double format supported on a platform. On powerpc64le, these functions currently have two versions (i.e.: long double with the same format as double, and long double with IBM Extended Precision format). Support for a third long double format option (i.e. long double with IEEE long double format) is being prepared and all the aforementioned functions now have a third version (not yet exported on the master branch, but the code is in). For these functions to get selected (during build time), references to them in user programs (or dependent libraries) must get redirected to the aforementioned new versions of the functions. This patch installs the header magic required to perform such redirections. Notice, however, that since the redirections only happen when __LONG_DOUBLE_USES_FLOAT128 is set to 1, and no platform (including powerpc64le) currently does it, no redirections actually happen. Redirections and the exporting of the new functions will happen at the same time (when powerpc64le adds ldbl-128ibm-compat to their Implies. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> Reviewed-by: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-01114-114/+114
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-07114-114/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Prepare vfprintf to use __printf_fp/__printf_fphex with float128 argGabriel F. T. Gomes2019-06-272-13/+63
| | | | | | | | | | | | | | | | | | | | | | | | On powerpc64le, long double can currently take two formats: the same as double (-mlong-double-64) or IBM Extended Precision (default with -mlong-double-128 or explicitly with -mabi=ibmlongdouble). The internal implementation of printf-like functions is aware of these possibilities and properly parses floating-point values from the variable arguments, before making calls to __printf_fp and __printf_fphex. These functions are also aware of the format possibilities and know how to convert both formats to string. When library support for TS 18661-3 was added to glibc, __printf_fp and __printf_fphex were extended with support for an additional type (__float128/_Float128) with a different format (binary128). Now that powerpc64le is getting support for its third long double format, and taking into account that this format is the same as the format of __float128/_Float128, this patch extends __vfprintf_internal to properly call __printf_fp and __printf_fphex with this new format. Tested for powerpc64le (with additional patches to actually enable the use of these preparations) and for x86_64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Break lines before not after operators, batch 4.Joseph Myers2019-03-071-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes further coding style issues where code should have broken lines before operators in accordance with the GNU Coding Standards but instead was breaking lines after them. Tested for x86_64, and with build-many-glibcs.py. * stdio-common/vfscanf-internal.c (ARG): Break lines before rather than after operators. * sysdeps/mach/hurd/setitimer.c (timer_thread): Likewise. (setitimer_locked): Likewise. * sysdeps/mach/hurd/sigaction.c (__sigaction): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/pagecopy.h (PAGE_COPY_FWD): Likewise. * sysdeps/mach/thread_state.h (machine_get_basic_state): Likewise. * sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c (PPC_CPU_SUPPORTED): Likewise. * sysdeps/unix/sysv/linux/alpha/a.out.h (N_TXTOFF): Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h (stat_overflow): Likewise. (statfs_overflow): Likewise. * sysdeps/unix/sysv/linux/tst-personality.c (do_test): Likewise. * sysdeps/unix/sysv/linux/tst-ttyname.c (eq_ttyname): Likewise. (eq_ttyname_r): Likewise. (run_chroot_tests): Likewise.
* hurd: Add renameat2 support for RENAME_NOREPLACESamuel Thibault2019-02-271-1/+3
| | | | | | | | | * include/stdio.h (__renameat2): New hidden prototype. * stdio-common/renameat2.c (__renameat2): Add hidden definition. * sysdeps/mach/hurd/renameat.c (__renameat): Move implementation to... * sysdeps/mach/hurd/renameat2.c (__renameat2): ... new function, and add support for RENAME_NOREPLACE. * sysdeps/unix/sysv/linux/renameat2.c (__renameat2): Add hidden definition.
* Add some spaces before '('.Joseph Myers2019-02-273-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes various places where a space should have been present before '(' in accordance with the GNU Coding Standards. Most but not all of the fixes in this patch are for calls to sizeof (but it's not exhaustive regarding such calls that should be fixed). Tested for x86_64, and with build-many-glibcs.py. * benchtests/bench-strcpy.c (do_test): Use space before '('. * benchtests/bench-string.h (cmdline_process_function): Likewise. * benchtests/bench-strlen.c (do_test): Likewise. (test_main): Likewise. * catgets/gencat.c (read_old): Likewise. * elf/cache.c (load_aux_cache): Likewise. * iconvdata/bug-iconv8.c (do_test): Likewise. * math/test-tgmath-ret.c (do_test): Likewise. * nis/nis_call.c (rec_dirsearch): Likewise. * nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise. * nptl/tst-audit-threads.c (do_test): Likewise. * nptl/tst-cancel4-common.h (set_socket_buffer): Likewise. * nss/nss_test1.c (init): Likewise. * nss/test-netdb.c (test_hosts): Likewise. * posix/execvpe.c (maybe_script_execute): Likewise. * stdio-common/tst-fmemopen4.c (do_test): Likewise. * stdio-common/tst-printf.c (do_test): Likewise. * stdio-common/vfscanf-internal.c (__vfscanf_internal): Likewise. * stdlib/fmtmsg.c (NKEYWORDS): Likewise. * stdlib/qsort.c (STACK_SIZE): Likewise. * stdlib/test-canon.c (do_test): Likewise. * stdlib/tst-swapcontext1.c (do_test): Likewise. * string/memcmp.c (OPSIZ): Likewise. * string/test-strcpy.c (do_test): Likewise. (do_random_tests): Likewise. * string/test-strlen.c (do_test): Likewise. (test_main): Likewise. * string/test-strrchr.c (do_test): Likewise. (do_random_tests): Likewise. * string/tester.c (test_memrchr): Likewise. (test_memchr): Likewise. * sysdeps/generic/memcopy.h (OPSIZ): Likewise. * sysdeps/generic/unwind-dw2.c (execute_stack_op): Likewise. * sysdeps/generic/unwind-pe.h (read_sleb128): Likewise. (read_encoded_value_with_base): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_runtime_setup): Likewise. * sysdeps/hppa/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/ia64/fpu/sfp-machine.h (TI_BITS): Likewise. * sysdeps/mach/hurd/spawni.c (__spawni): Likewise. * sysdeps/posix/spawni.c (maybe_script_execute): Likewise. * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (query_auxv): Likewise. * sysdeps/unix/sysv/linux/aarch64/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/arm/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Likewise. * sysdeps/unix/sysv/linux/csky/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/m68k/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/nios2/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute): Likewise. * sysdeps/unix/sysv/linux/x86/bits/procfs.h (ELF_NGREG): Likewise. * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h (FP_XSTATE_MAGIC2_SIZE): Likewise. * sysdeps/x86/fpu/sfp-machine.h (TI_BITS): Likewise. * time/test_time.c (main): Likewise.
* Break some lines before not after operators.Joseph Myers2019-02-223-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GNU Coding Standards specify that line breaks in expressions should go before an operator, not after one. This patch fixes various code to do this. It only changes code that appears to be mostly following GNU style anyway, not files and directories with substantially different formatting. It is not exhaustive even for files using GNU style (for example, changes to sysdeps files are deferred for subsequent cleanups). Some files changed are shared with gnulib, but most are specific to glibc. Changes were made manually, with places to change found by grep (so some cases, e.g. where the operator was followed by a comment at end of line, are particularly liable to have been missed by grep, but I did include cases where the operator was followed by backslash-newline). This patch generally does not attempt to address other coding style issues in the expressions changed (for example, missing spaces before '(', or lack of parentheses to ensure indentation of continuation lines properly reflects operator precedence). Tested for x86_64, and with build-many-glibcs.py. * benchtests/bench-memmem.c (simple_memmem): Break lines before rather than after operators. * benchtests/bench-skeleton.c (TIMESPEC_AFTER): Likewise. * crypt/md5.c (md5_finish_ctx): Likewise. * crypt/sha256.c (__sha256_finish_ctx): Likewise. * crypt/sha512.c (__sha512_finish_ctx): Likewise. * elf/cache.c (load_aux_cache): Likewise. * elf/dl-load.c (open_verify): Likewise. * elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise. * elf/readelflib.c (process_elf_file): Likewise. * elf/rtld.c (dl_main): Likewise. * elf/sprof.c (generate_call_graph): Likewise. * hurd/ctty-input.c (_hurd_ctty_input): Likewise. * hurd/ctty-output.c (_hurd_ctty_output): Likewise. * hurd/dtable.c (reauth_dtable): Likewise. * hurd/getdport.c (__getdport): Likewise. * hurd/hurd/signal.h (_hurd_interrupted_rpc_timeout): Likewise. * hurd/hurd/sigpreempt.h (HURD_PREEMPT_SIGNAL_P): Likewise. * hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise): Likewise. * hurd/hurdioctl.c (fioctl): Likewise. * hurd/hurdselect.c (_hurd_select): Likewise. * hurd/hurdsig.c (_hurdsig_abort_rpcs): Likewise. (STOPSIGS): Likewise. * hurd/hurdstartup.c (_hurd_startup): Likewise. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Likewise. * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise. * hurd/msgportdemux.c (msgport_server): Likewise. * hurd/setauth.c (_hurd_setauth): Likewise. * include/features.h (__GLIBC_USE_DEPRECATED_SCANF): Likewise. * libio/libioP.h [IO_DEBUG] (CHECK_FILE): Likewise. * locale/programs/ld-ctype.c (set_class_defaults): Likewise. * localedata/tests-mbwc/tst_swscanf.c (tst_swscanf): Likewise. * login/tst-utmp.c (do_check): Likewise. (simulate_login): Likewise. * mach/lowlevellock.h (lll_lock): Likewise. (lll_trylock): Likewise. * math/test-fenv.c (ALL_EXC): Likewise. * math/test-fenvinline.c (ALL_EXC): Likewise. * misc/sys/cdefs.h (__attribute_deprecated_msg__): Likewise. * nis/nis_call.c (__do_niscall3): Likewise. * nis/nis_callback.c (cb_prog_1): Likewise. * nis/nis_defaults.c (searchaccess): Likewise. * nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise. * nis/nis_ismember.c (internal_ismember): Likewise. * nis/nis_local_names.c (nis_local_principal): Likewise. * nis/nss_nis/nis-rpc.c (_nss_nis_getrpcbyname_r): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r): Likewise. * nis/ypclnt.c (yp_match): Likewise. (yp_first): Likewise. (yp_next): Likewise. (yp_master): Likewise. (yp_order): Likewise. * nscd/hstcache.c (cache_addhst): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nss/nss_compat/compat-pwd.c (copy_pwd_changes): Likewise. (internal_getpwuid_r): Likewise. * nss/nss_compat/compat-spwd.c (copy_spwd_changes): Likewise. * posix/glob.h (__GLOB_FLAGS): Likewise. * posix/regcomp.c (peek_token): Likewise. (peek_token_bracket): Likewise. (parse_expression): Likewise. * posix/regexec.c (sift_states_iter_mb): Likewise. (check_node_accept_bytes): Likewise. * posix/tst-spawn3.c (do_test): Likewise. * posix/wordexp-test.c (testit): Likewise. * posix/wordexp.c (parse_tilde): Likewise. (exec_comm): Likewise. * posix/wordexp.h (__WRDE_FLAGS): Likewise. * resource/vtimes.c (TIMEVAL_TO_VTIMES): Likewise. * setjmp/sigjmp.c (__sigjmp_save): Likewise. * stdio-common/printf_fp.c (__printf_fp_l): Likewise. * stdio-common/tst-fileno.c (do_test): Likewise. * stdio-common/vfprintf-internal.c (vfprintf): Likewise. * stdlib/strfmon_l.c (__vstrfmon_l_internal): Likewise. * stdlib/strtod_l.c (round_and_return): Likewise. (____STRTOF_INTERNAL): Likewise. * stdlib/tst-strfrom.h (TEST_STRFROM): Likewise. * string/strcspn.c (STRCSPN): Likewise. * string/test-memmem.c (simple_memmem): Likewise. * termios/tcsetattr.c (tcsetattr): Likewise. * time/alt_digit.c (_nl_parse_alt_digit): Likewise. * time/asctime.c (asctime_internal): Likewise. * time/strptime_l.c (__strptime_internal): Likewise. * time/sys/time.h (timercmp): Likewise. * time/tzfile.c (__tzfile_compute): Likewise.
* Add internal implementations for argp.h, err.h, and error.h functionsGabriel F. T. Gomes2019-02-211-7/+9
| | | | | | | | | | | | Since the introduction of explicit flags in the internal implementation of the printf family of functions, the 'mode' parameter can be used to select which format long double parameters have (with the mode flag: PRINTF_LDBL_IS_DBL). This patch uses this feature in the implementation of some functions in argp.h, err.h, and error.h (only those that take a format string and positional parameters). Future patches will add support for 'nldbl' and 'ieee128' versions of these functions. Tested for powerpc64le and x86_64.
* Use C99-compliant scanf under _GNU_SOURCE with modern compilers.Zack Weinberg2019-01-0314-72/+447
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference between noncompliant and C99-compliant scanf is that the former accepts the archaic GNU extension '%as' (also %aS and %a[...]) meaning to allocate space for the input string with malloc. This extension conflicts with C99's use of %a as a format _type_ meaning to read a floating-point number; POSIX.1-2008 standardized equivalent functionality using the modifier letter 'm' instead (%ms, %mS, %m[...]). The extension was already disabled in most conformance modes: specifically, any mode that doesn't involve _GNU_SOURCE and _does_ involve either strict conformance to C99 or loose conformance to both C99 and POSIX.1-2001 would get the C99-compliant scanf. With compilers new enough to use -std=gnu11 instead of -std=gnu89, or equivalent, that includes the default mode. With this patch, we now provide C99-compliant scanf in all configurations except when _GNU_SOURCE is defined *and* __STDC_VERSION__ or __cplusplus (whichever is relevant) indicates C89/C++98. This leaves the old scanf available under e.g. -std=c89 -D_GNU_SOURCE, but removes it from e.g. -std=gnu11 -D_GNU_SOURCE (it was already not present under -std=gnu11 without -D_GNU_SOURCE) and from -std=gnu89 without -D_GNU_SOURCE. There needs to be an internal override so we can compile the noncompliant scanf itself. This is the same problem we had when we removed 'gets' from _GNU_SOURCE and it's dealt with the same way: there's a new __GLIBC_USE symbol, DEPRECATED_SCANF, which defaults to off under the appropriate conditions for external code, but can be overridden by individual files within stdio. We also run into problems with PLT bypass for internal uses of sscanf, because libc_hidden_proto uses __REDIRECT and so does the logic in stdio.h for choosing which implementation of scanf to use; __REDIRECT isn't transitive, so include/stdio.h needs to bridge the gap with a macro. As far as I can tell, sscanf is the only function in this family that's internally called by unrelated code. Finally, there are several tests in stdio-common that use the extension. bug21.c is a regression test for a crash; it still exercises the relevant code when changed to use %ms instead of %as. scanf14.c through scanf17.c are more complicated since they are actually testing the subtleties of the extension - under what circumstances is 'a' treated as a modifier letter, etc. I changed all of them to use %ms instead of %as as well, but duplicated scanf14.c and scanf16.c as scanf14a.c and scanf16a.c. These still use %as and are compiled with -std=gnu89 to access the old extension. A bunch of diagnostic overrides and manual workarounds for the old stdio.h behavior become unnecessary. Yay! * include/features.h (__GLIBC_USE_DEPRECATED_SCANF): New __GLIBC_USE parameter. Only use deprecated scanf when __USE_GNU is defined and __STDC_VERSION__ is less than 199901L or __cplusplus is less than 201103L, whichever is relevant for the language being compiled. * libio/stdio.h, libio/bits/stdio-ldbl.h: Decide whether to redirect scanf, fscanf, sscanf, vscanf, vfscanf, and vsscanf to their __isoc99_ variants based only on __GLIBC_USE (DEPRECATED_SCANF). * wcsmbs/wchar.h: wcsmbs/bits/wchar-ldbl.h: Likewise for wscanf, fwscanf, swscanf, vwscanf, vfwscanf, and vswscanf. * libio/iovsscanf.c * libio/fwscanf.c * libio/iovswscanf.c * libio/swscanf.c * libio/vscanf.c * libio/vwscanf.c * libio/wscanf.c * stdio-common/fscanf.c * stdio-common/scanf.c * stdio-common/vfscanf.c * stdio-common/vfwscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.c * sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-scanf.c * sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c * sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c: Override __GLIBC_USE_DEPRECATED_SCANF to 1. * stdio-common/sscanf.c: Likewise. Remove ldbl_hidden_def for __sscanf. * stdio-common/isoc99_sscanf.c: Add libc_hidden_def for __isoc99_sscanf. * include/stdio.h: Provide libc_hidden_proto for __isoc99_sscanf, not sscanf. [!__GLIBC_USE (DEPRECATED_SCANF)]: Define sscanf as __isoc99_scanf with a preprocessor macro. * stdio-common/bug21.c, stdio-common/scanf14.c: Use %ms instead of %as, %mS instead of %aS, %m[] instead of %a[]; remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat. * stdio-common/scanf16.c: Likewise. Add __attribute__ ((format (scanf))) to xscanf, xfscanf, xsscanf. * stdio-common/scanf14a.c: New copy of scanf14.c which still uses %as, %aS, %a[]. Remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat. * stdio-common/scanf16a.c: New copy of scanf16.c which still uses %as, %aS, %a[]. Add __attribute__ ((format (scanf))) to xscanf, xfscanf, xsscanf. * stdio-common/scanf15.c, stdio-common/scanf17.c: No need to override feature selection macros or provide definitions of u_char etc. * stdio-common/Makefile (tests): Add scanf14a and scanf16a. (CFLAGS-scanf15.c, CFLAGS-scanf17.c): Remove. (CFLAGS-scanf14a.c, CFLAGS-scanf16a.c): New. Compile these files with -std=gnu89.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-01108-108/+108
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Prepare vfscanf to use __strtof128_internalGabriel F. T. Gomes2018-12-071-0/+14
| | | | | | | | | | | | | | | | | | | | | On powerpc64le, long double can currently take two formats: the same as double (-mlong-double-64) or IBM Extended Precision (default with -mlong-double-128 or explicitly with -mabi=ibmlongdouble). The internal implementation of scanf-like functions is aware of these possibilites and, based on the format in use, properly calls __strtold_internal or __strtod_internal, saving the return to a variable of type double or long double. When library support for TS 18661-3 was added to glibc, a new function, __strtof128_internal, was added to enable reading of floating-point values with IEEE binary128 format into the _Float128 type. Now that powerpc64le is getting support for its third long double format, and taking into account that this format is the same as the format of _Float128, this patch extends __vfscanf_internal and __vfwscanf_internal to call __strtof128_internal or __wcstof128_internal when appropriate. The result gets saved into a variable of _Float128 type. Tested for powerpc64le.
* Use PRINTF_LDBL_IS_DBL instead of __ldbl_is_dbl.Zack Weinberg2018-12-051-4/+0
| | | | | | | | | After all that prep work, nldbl-compat.c can now use PRINTF_LDBL_IS_DBL instead of __no_long_double to control the behavior of printf-like functions; this is the last thing we needed __no_long_double for, so it can go away entirely. Tested for powerpc and powerpc64le.
* Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)Zack Weinberg2018-12-055-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The _chk variants of all of the printf functions become much simpler. This is the last thing that we needed _IO_acquire_lock_clear_flags2 for, so it can go as well. I took the opportunity to make the headers included and the names of all local variables consistent across all the affected files. Since we ultimately want to get rid of __no_long_double as well, it must be possible to get all of the nontrivial effects of the _chk functions by calling the _internal functions with appropriate flags. For most of the __(v)xprintf_chk functions, this is covered by PRINTF_FORTIFY plus some up-front argument checks that can be duplicated. However, __(v)sprintf_chk installs a custom jump table so that it can crash instead of overflowing the output buffer. This functionality is moved to __vsprintf_internal, which now has a 'maxlen' argument like __vsnprintf_internal; to get the unsafe behavior of ordinary (v)sprintf, pass -1 for that argument. obstack_printf_chk and obstack_vprintf_chk are no longer in the same file. As a side-effect of the unification of both fortified and non-fortified vdprintf initialization, this patch fixes bug 11319 for __dprintf_chk and __vdprintf_chk, which was previously fixed only for dprintf and vdprintf by the commit commit 7ca890b88e6ab7624afb1742a9fffb37ad5b3fc3 Author: Ulrich Drepper <drepper@redhat.com> Date: Wed Feb 24 16:07:57 2010 -0800 Fix reporting of I/O errors in *dprintf functions. This patch adds a test case to avoid regressions. Tested for powerpc and powerpc64le.
* Add __v*printf_internal with flags argumentsZack Weinberg2018-12-0513-2370/+2410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a lot more printf variants than there are scanf variants, and the code for setting up and tearing down their custom FILE variants around the call to __vf(w)printf is more complicated and variable. Therefore, I have added _internal versions of all the v*printf variants, rather than introducing helper routines so that they can all directly call __vf(w)printf_internal, as was done with scanf. As with the scanf changes, in this patch the _internal functions still look at the environmental mode bits and all callers pass 0 for the flags parameter. Several of the affected public functions had _IO_ name aliases that were not exported (but, in one case, appeared in libio.h anyway); I was originally planning to leave them as aliases to avoid having to touch internal callers, but it turns out ldbl_*_alias only work for exported symbols, so they've all been removed instead. It also turns out there were hardly any internal callers. _IO_vsprintf and _IO_vfprintf *are* exported, so those two stick around. Summary for the changes to each of the affected symbols: _IO_vfprintf, _IO_vsprintf: All internal calls removed, thus the internal declarations, as well as uses of libc_hidden_proto and libc_hidden_def, were also removed. The external symbol is now exposed via uses of ldbl_strong_alias to __vfprintf_internal and __vsprintf_internal, respectively. _IO_vasprintf, _IO_vdprintf, _IO_vsnprintf, _IO_vfwprintf, _IO_vswprintf, _IO_obstack_vprintf, _IO_obstack_printf: All internal calls removed, thus declaration in internal headers were also removed. They were never exported, so there are no aliases tying them to the internal functions. I.e.: entirely gone. __vsnprintf: Internal calls were always preceded by macros such as #define __vsnprintf _IO_vsnprintf, and #define __vsnprintf vsnprintf The macros were removed and their uses replaced with calls to the new internal function __vsnprintf_internal. Since there were no internal calls, the internal declaration was also removed. The external symbol is preserved with ldbl_weak_alias to ___vsnprintf. __vfwprintf: All internal calls converted into calls to __vfwprintf_internal, thus the internal declaration was removed. The function is now a wrapper that calls __vfwprintf_internal. The external symbol is preserved. __vswprintf: Similarly, but no external symbol. __vasprintf, __vdprintf, __vfprintf, __vsprintf: New internal wrappers. Not exported. vasprintf, vdprintf, vfprintf, vsprintf, vsnprintf, vfwprintf, vswprintf, obstack_vprintf, obstack_printf: These functions used to be aliases to the respective _IO_* function, they are now aliases to their respective __* functions. Tested for powerpc and powerpc64le.
* Use SCANF_LDBL_IS_DBL instead of __ldbl_is_dbl.Zack Weinberg2018-12-051-4/+0
| | | | | | | | | | Change the callers of __vfscanf_internal and __vfwscanf_internal that want to treat 'long double' as another name for 'double' (all of which happen to be in sysdeps/ieee754/ldbl-opt/nldbl-compat.c) to communicate this via the new flags argument, instead of the per-thread variable __no_long_double and its __ldbl_is_dbl wrapper macro. Tested for powerpc and powerpc64le.
* Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD.Zack Weinberg2018-12-057-39/+6
| | | | | | | | | Change the callers of __vfscanf_internal and __vfwscanf_internal that want C99-compliant behavior to communicate this via the new flags argument, rather than setting bits on the FILE object. This also means these functions do not need to do their own locking. Tested for powerpc and powerpc64le.
* Add __vfscanf_internal and __vfwscanf_internal with flags arguments.Zack Weinberg2018-12-0516-3073/+3178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two flags currently defined: SCANF_LDBL_IS_DBL is the mode used by __nldbl_ scanf variants, and SCANF_ISOC99_A is the mode used by __isoc99_ scanf variants. In this patch, the new functions honor these flag bits if they're set, but they still also look at the corresponding bits of environmental state, and callers all pass zero. The new functions do *not* have the "errp" argument possessed by _IO_vfscanf and _IO_vfwscanf. All internal callers passed NULL for that argument. External callers could theoretically exist, so I preserved wrappers, but they are flagged as compat symbols and they don't preserve the three-way distinction among types of errors that was formerly exposed. These functions probably should have been in the list of deprecated _IO_ symbols in 2.27 NEWS -- they're not just aliases for vfscanf and vfwscanf. (It was necessary to introduce ldbl_compat_symbol for _IO_vfscanf. Please check that part of the patch very carefully, I am still not confident I understand all of the details of ldbl-opt.) This patch also introduces helper inlines in libio/strfile.h that encapsulate the process of initializing an _IO_strfile object for reading. This allows us to call __vfscanf_internal directly from sscanf, and __vfwscanf_internal directly from swscanf, without duplicating the initialization code. (Previously, they called their v-counterparts, but that won't work if we want to control *both* C99 mode and ldbl-is-dbl mode using the flags argument to__vfscanf_internal.) It's still a little awkward, especially for wide strfiles, but it's much better than what we had. Tested for powerpc and powerpc64le.
* Disable -Wformat-overflow= warnings for some printf tests.Joseph Myers2018-11-012-0/+29
| | | | | | | | | | | | | | | | | | Recent GCC -Wformat-overflow= changes result in some printf tests failing to build, because those tests are deliberately testing the handling of formats writing more than INT_MAX characters and the handling of NULL arguments to the %s format, which GCC now warns about. This patch duly disables -Wformat-overflow= for the relevant calls to printf functions. Tested with build-many-glibcs.py with GCC mainline for aarch64-linux-gnu. * stdio-common/bug22.c: Include <libc-diag.h>. (do_test): Disable -Wformat-overflow= warnings around fprintf calls outputting more than INT_MAX characters. * stdio-common/tst-printf.c: Disable -Wformat-overflow= warnings around printf call with NULL %s argument.
* Don't reduce test timeout to less than defaultAndreas Schwab2018-10-172-2/+0
| | | | | This removes all overrides of TIMEOUT that are less than or equal to the default timeout.
* error, warn, warnx: Use __fxprintf for wide printing [BZ #23519]Florian Weimer2018-08-141-6/+10
| | | | Also introduce the __vfxprintf function.
* Avoid insecure usage of tmpnam in tests.Joseph Myers2018-07-183-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various glibc testcases use tmpnam in ways subject to race conditions (generate a temporary file name, then later open that file without O_EXCL). This patch fixes those tests to use mkstemp - generally a minimal local fix to use mkstemp instead of tmpnam, rather than a larger fix to use other testsuite infrastructure for temporary files. The unchanged use of tmpnam in posix/wordexp-test.c would fail safe in the event of a race (it's generating a name for use with mkdir rather than for a file to be opened for writing). Tested for x86_64. * grp/tst_fgetgrent.c: Include <unistd.h>. (main): Use mkstemp instead of tmpnam. * io/test-utime.c (main): Likewise. * posix/annexc.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here. * posix/bug-getopt1.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt2.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt3.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt4.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt5.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * stdio-common/bug7.c: Include <stdlib.h> and <unistd.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-fdopen.c: Include <stdlib.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-ungetc.c: Include <stdlib.h>. (main): use mkstemp instead of tmpnam. * stdlib/isomac.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here.
* Add renameat2 function [BZ #17662]Florian Weimer2018-07-055-3/+242
| | | | | | | The implementation falls back to renameat if renameat2 is not available in the kernel (or in the kernel headers) and the flags argument is zero. Without kernel support, a non-zero argument returns EINVAL, not ENOSYS. This mirrors what the kernel does for invalid renameat2 flags.
* stdio-common/tst-printf.c: Remove part under a non-free license [BZ #23363]Florian Weimer2018-07-032-114/+2
| | | | | | The license does not allow modification. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* ldbl-128ibm-compat: Add printf_sizeGabriel F. T. Gomes2018-07-023-2/+97
| | | | | | | | | | | | | | | | | | | | | Since the addition of the _Float128 API, strfromf128 and printf_size use __printf_fp to print _Float128 values. This is achieved by setting the 'is_binary128' member of the 'printf_info' structure to one. Now that the format of long double on powerpc64le is getting a third option, this mechanism is reused for long double values that have binary128 format (i.e.: when -mabi=ieeelongdouble). This patch adds __printf_sizeieee128 as an exported symbol, but doesn't provide redirections from printf_size, yet. All redirections will be installed in a future commit, once all other functions that print or read long double values with binary128 format are ready. In __printf_fp, when 'is_binary128' is one, the floating-point argument is treated as if it was of _Float128 type, regardless of the value of 'is_long_double', thus __printf_sizeieee128 sets 'is_binary128' to the same value of 'is_long_double'. Otherwise, double values would not be printed correctly. Tested for powerpc64le.
* Fix hardcoded /tmp paths in testing (bug 13888).Joseph Myers2018-06-267-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in bug 13888, and as I noted previously in <https://sourceware.org/ml/libc-alpha/2000-10/msg00111.html>, various tests used hardcoded paths in /tmp, so posing issues for simultaneous test runs from different build directories. This patch fixes such uses of hardcoded file names to put them in the build directory instead (in the case of stdio-common/bug5 the file names are changed as well, to avoid a conflict with the name bug5.out also used for the automatic test output redirection). It also fixes test-installation.pl likewise (that was using filenames with $$ in them rather than strictly hardcoded names, but that's still not good practice for temporary file naming). Note that my list of files changed is not identical to that in bug 13888. I added tst-spawn3.c and test-installation.pl, and removed some tests that seem to me (now) to create temporary files securely (simply using /tmp is not itself a problem if the temporary files are handled properly with mkstemp; I haven't checked whether those tests used to do things insecurely). conformtest is not changed because the makefiles always pass a --tmpdir option so the /tmp default is irrelevant, and for the same reason there is no actual problem with nptl/tst-umask1.c because again the makefiles always override the default. nptl/sockperf.c is ignored because there is no code to run it; probably that file should actually be removed. Some tests use the mktemp function, but I think they all use it in a way that *is* secure (for generating names for directories / sockets / fifos / symlinks, where the operation using the name will not follow symlinks and so there is no potential for a symlink attack on the account running the testsuite). Some tests use the tmpnam function to generate temporary file names. This is in principle insecure, but not addressed by this patch (I consider it a separate issue from the fully hardcoded paths). Tested for x86_64. [BZ #13888] * posix/Makefile (CFLAGS-tst-spawn3.c): New variable. * posix/tst-spawn3.c (do_test): Put tst-spwan3.pid in OBJPFX, not /tmp. * scripts/test-installation.pl: Put temporary files in build directory, not /tmp. * stdio-common/Makefile (CFLAGS-bug3.c): New variable. (CFLAGS-bug4.c): Likewise. (CFLAGS-bug5.c): Likewise. (CFLAGS-test-fseek.c): Likewise. (CFLAGS-test-popen.c): Likewise. (CFLAGS-test_rdwr.c): Likewise. * stdio-common/bug3.c (main): Put temporary file in OBJPFX, not /tmp. * stdio-common/bug4.c (main): Likewise. * stdio-common/bug5.c (main): Likewise. * stdio-common/test-fseek.c (TESTFILE): Likewise. * stdio-common/test-popen.c (do_test): Likewise. * stdio-common/test_rdwr.c (main): Likewise.
* Fix scanf rounding of negative floating-point numbers (bug 23280).Joseph Myers2018-06-193-17/+71
| | | | | | | | | | | | | | | | | | | | | | | As reported in bug 23280, scanf functions produce incorrectly rounded result for floating-point formats in FE_UPWARD and FE_DOWNWARD modes, because they pass the input with sign removed to strtod functions, and then negate the result if there was a '-' at the start of the input. This patch fixes this by arranging for the sign to be passed to strtod rather than scanf doing the negation itself. In turn, keeping the sign around in the buffer being built up for strtod requires updating places that examine char_buffer_size (&charbuf) to allow for the sign being there as an extra character. Tested for x86_64. [BZ #23280] * stdio-common/vfscanf.c (_IO_vfscanf_internal): Pass sign of floating-point number to strtod functions rather than possibly negating result of those functions. * stdio-common/tst-scanf-round.c: New file. * stdio-common/Makefile (tests): Add tst-scanf-round. ($(objpfx)tst-scanf-round): Depend on $(libm).
* Remove miscellaneous debris from libio.Zack Weinberg2018-02-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros that are never used, macros that provide portability to substrates that lack basic things like EINVAL and off_t, and other such debris. I preserved IO_DEBUG and CHECK_FILE, even though as far as I can tell IO_DEBUG is never defined and therefore CHECK_FILE never does anything, because it seems like we might actually want to turn it _on_. Installed stripped libraries and executables are unchanged, except, again, that the line number of an assertion changes (this time it's somewhere in fileops.c). * libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Define here, unconditionally. * libio/iolibio.h (_IO_pos_BAD): Don't define here. * libio/libioP.h: Remove #if 0 blocks. (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here. (_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define. (CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE. Fix style. * libio/clearerr.c, libio/fputc.c, libio/getchar.c: Assume weak_alias is always defined. * libio/fileops.c, libio/genops.c, libio/oldfileops.c * libio/oldpclose.c, libio/pclose.c, libio/wfileops.c: Remove #if 0 and #ifdef TODO blocks. Assume text_set_element is always defined. * libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL. * libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.
* Remove _IO_file_flags define.Zack Weinberg2018-02-211-2/+2
| | | | | | | | | | This entirely mechanical (except for some indentation fixups) patch replaces all uses of _IO_file_flags with _flags and removes the #define. Installed stripped libraries and executables are unchanged by this patch. * libio/libio.h (_IO_file_flags): Remove macro. All uses changed to _flags.
* Mechanically remove _IO_ name aliases for types and constants.Zack Weinberg2018-02-2110-50/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch mechanically removes all remaining uses, and the definitions, of the following libio name aliases: name replaced with ---- ------------- _IO_FILE FILE _IO_fpos_t __fpos_t _IO_fpos64_t __fpos64_t _IO_size_t size_t _IO_ssize_t ssize_t or __ssize_t _IO_off_t off_t _IO_off64_t off64_t _IO_pid_t pid_t _IO_uid_t uid_t _IO_wint_t wint_t _IO_va_list va_list or __gnuc_va_list _IO_BUFSIZ BUFSIZ _IO_cookie_io_functions_t cookie_io_functions_t __io_read_fn cookie_read_function_t __io_write_fn cookie_write_function_t __io_seek_fn cookie_seek_function_t __io_close_fn cookie_close_function_t I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because the definitions of fpos_t and fpos64_t depend on the largefile mode. I used __ssize_t and __gnuc_va_list in a handful of headers where namespace cleanliness might be relevant even though they're internal-use-only. In all other cases, I used the public-namespace name. There are a tiny handful of places where I left a use of 'struct _IO_FILE' alone, because it was being used together with 'struct _IO_FILE_plus' or 'struct _IO_FILE_complete' in the same arithmetic expression. Because this patch was almost entirely done with search and replace, I may have introduced indentation botches. I did proofread the diff, but I may have missed something. The ChangeLog below calls out all of the places where this was not a pure search-and-replace change. Installed stripped libraries and executables are unchanged by this patch, except that some assertions in vfscanf.c change line numbers. * libio/libio.h (_IO_FILE): Delete; all uses changed to FILE. (_IO_fpos_t): Delete; all uses changed to __fpos_t. (_IO_fpos64_t): Delete; all uses changed to __fpos64_t. (_IO_size_t): Delete; all uses changed to size_t. (_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t. (_IO_off_t): Delete; all uses changed to off_t. (_IO_off64_t): Delete; all uses changed to off64_t. (_IO_pid_t): Delete; all uses changed to pid_t. (_IO_uid_t): Delete; all uses changed to uid_t. (_IO_wint_t): Delete; all uses changed to wint_t. (_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list. (_IO_BUFSIZ): Delete; all uses changed to BUFSIZ. (_IO_cookie_io_functions_t): Delete; all uses changed to cookie_io_functions_t. (__io_read_fn): Delete; all uses changed to cookie_read_function_t. (__io_write_fn): Delete; all uses changed to cookie_write_function_t. (__io_seek_fn): Delete; all uses changed to cookie_seek_function_t. (__io_close_fn): Delete: all uses changed to cookie_close_function_t. * libio/iofopncook.c: Remove unnecessary forward declarations. * libio/iolibio.h: Correct outdated commentary. * malloc/malloc.c (__malloc_stats): Remove unnecessary casts. * stdio-common/fxprintf.c (__fxprintf_nocancel): Remove unnecessary casts. * stdio-common/getline.c: Use _IO_getdelim directly. Don't redefine ssize_t. * stdio-common/printf_fp.c, stdio_common/printf_fphex.c * stdio-common/printf_size.c: Don't redefine size_t or FILE. Remove outdated comments. * stdio-common/vfscanf.c: Don't redefine va_list.
* Remove some unnecessary redefinitions of std symbols.Zack Weinberg2018-02-052-8/+1
| | | | | | | | Two files in stdio-common were unnecessarily redefining some standard symbols as their _IO_ aliases. * stdio-common/vfprintf.c: Don't redefine FILE, va_list, or BUFSIZ. * stdio-common/tstgetln.c: Don't redefine ssize_t.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-0196-96/+96
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Deprecate external use of libio.h and _G_config.h.Zack Weinberg2017-12-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libio.h was originally the header for a set of supported GNU extensions, but they have not been maintained as such in many years, they are now standing in the way of improvements to stdio, and we don't think there are any remaining external users. _G_config.h was never intended for public use, but predates the bits convention. Move both of these headers into the bits directory and provide stubs at top level which issue deprecation warnings. The contents of (bits/)libio.h and (bits/)_G_config.h are still exposed to external software via stdio.h; changing that requires more complex surgery than I have time to attempt right now. * libio/libio.h, libio/_G_config.h: New stub headers which issue a deprecation warning and then include <bits/libio.h>, <bits/_G_config.h> respectively. * libio/libio.h: Rename the original version of this file to libio/bits/libio.h. Error out if not included by stdio.h or the stub libio.h. * include/libio.h: Move to include/bits. Forward to libio/bits/libio.h. * sysdeps/generic/_G_config.h: Move to top-level bits/. Error out if not included by bits/libio.h or the stub _G_config.h. * sysdeps/unix/sysv/linux/_G_config.h: Move to sysdeps/unix/sysv/linux/bits. Error out if not included by bits/libio.h or the stub _G_config.h. * libio/stdio.h: Include bits/libio.h, not libio.h. * libio/Makefile: Install bits/libio.h and bits/_G_config.h as well as libio.h and _G_config.h. * csu/init.c, libio/fmemopen.c, libio/iolibio.h, libio/oldfmemopen.c * libio/strfile.h, stdio-common/vfscanf.c * sysdeps/pthread/flockfile.c, sysdeps/pthread/funlockfile.c Include stdio.h, not _G_config.h nor libio.h. * libio/iofgetpos.c: Also rename fgetpos64 out of the way. * libio/iofsetpos.c: Also rename fsetpos64 out of the way. * scripts/check-installed-headers.sh: Skip libio.h and _G_config.h.
* Replace = with += in CFLAGS-xxx.c/CPPFLAGS-xxx.cH.J. Lu2017-12-111-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace = with += in CFLAGS-xxx.c and CPPFLAGS-xxx.c to allow Makefile under sysdeps to define CFLAGS-xx.c and CPPFLAGS-xxx.c. * argp/Makefile (CFLAGS-argp-help.c): Replace = with +=. (CFLAGS-argp-parse.c): Likewise. (CFLAGS-argp-fmtstream.c): Likewise. * crypt/Makefile (CPPFLAGS-sha256-crypt.c): Likewise. (CPPFLAGS-sha512-crypt.c): Likewise. (CPPFLAGS-md5-crypt.c): Likewise. * debug/Makefile (CFLAGS-stack_chk_fail.c): Likewise. (CFLAGS-stack_chk_fail_local.c): Likewise. (CFLAGS-backtrace.c): Likewise. (CFLAGS-sprintf_chk.c): Likewise. (CFLAGS-snprintf_chk.c): Likewise. (CFLAGS-vsprintf_chk.c): Likewise. (CFLAGS-vsnprintf_chk.c): Likewise. (CFLAGS-asprintf_chk.c): Likewise. (CFLAGS-vasprintf_chk.c): Likewise. (CFLAGS-obprintf_chk.c): Likewise. (CFLAGS-dprintf_chk.c): Likewise. (CFLAGS-vdprintf_chk.c): Likewise. (CFLAGS-printf_chk.c): Likewise. (CFLAGS-fprintf_chk.c): Likewise. (CFLAGS-vprintf_chk.c): Likewise. (CFLAGS-vfprintf_chk.c): Likewise. (CFLAGS-gets_chk.c): Likewise. (CFLAGS-fgets_chk.c): Likewise. (CFLAGS-fgets_u_chk.c): Likewise. (CFLAGS-fread_chk.c): Likewise. (CFLAGS-fread_u_chk.c): Likewise. (CFLAGS-swprintf_chk.c): Likewise. (CFLAGS-vswprintf_chk.c): Likewise. (CFLAGS-wprintf_chk.c): Likewise. (CFLAGS-fwprintf_chk.c): Likewise. (CFLAGS-vwprintf_chk.c): Likewise. (CFLAGS-vfwprintf_chk.c): Likewise. (CFLAGS-fgetws_chk.c): Likewise. (CFLAGS-fgetws_u_chk.c): Likewise. (CFLAGS-read_chk.c): Likewise. (CFLAGS-pread_chk.c): Likewise. (CFLAGS-pread64_chk.c): Likewise. (CFLAGS-recv_chk.c): Likewise. (CFLAGS-recvfrom_chk.c): Likewise. (CFLAGS-tst-longjmp_chk.c): Likewise. (CPPFLAGS-tst-longjmp_chk.c): Likewise. (CFLAGS-tst-longjmp_chk2.c): Likewise. (CPPFLAGS-tst-longjmp_chk2.c): Likewise. (CFLAGS-tst-longjmp_chk3.c): Likewise. (CPPFLAGS-tst-longjmp_chk3.c): Likewise. (CFLAGS-tst-chk1.c): Likewise. (CFLAGS-tst-chk2.c): Likewise. (CFLAGS-tst-chk3.c): Likewise. (CFLAGS-tst-chk4.cc): Likewise. (CFLAGS-tst-chk5.cc): Likewise. (CFLAGS-tst-chk6.cc): Likewise. (CFLAGS-tst-lfschk1.c): Likewise. (CFLAGS-tst-lfschk2.c): Likewise. (CFLAGS-tst-lfschk3.c): Likewise. (CFLAGS-tst-lfschk4.cc): Likewise. (CFLAGS-tst-lfschk5.cc): Likewise. (CFLAGS-tst-lfschk6.cc): Likewise. (CFLAGS-tst-ssp-1.c): Likewise. * dirent/Makefile (CFLAGS-scandir.c): Likewise. (CFLAGS-scandir64.c): Likewise. (CFLAGS-scandir-tail.c): Likewise. (CFLAGS-scandir64-tail.c): Likewise. * elf/Makefile (CPPFLAGS-dl-tunables.c): Likewise. (CFLAGS-dl-tunables.c): Likewise. (CFLAGS-dl-runtime.c): Likewise. (CFLAGS-dl-lookup.c): Likewise. (CFLAGS-dl-iterate-phdr.c): Likewise. (CFLAGS-vismain.c): Likewise. (CFLAGS-tst-linkall-static.c): Likewise. (CFLAGS-tst-linkall-static.c): Likewise. (CPPFLAGS-dl-load.c): Likewise. (CFLAGS-ldconfig.c): Likewise. (CFLAGS-dl-cache.c): Likewise. (CFLAGS-cache.c): Likewise. (CFLAGS-rtld.c): Likewise. (CFLAGS-multiload.c): Likewise. (CFLAGS-filtmod1.c): Likewise. (CFLAGS-tst-align.c): Likewise. (CFLAGS-tst-align2.c): Likewise. (CFLAGS-tst-alignmod.c): Likewise. (CFLAGS-tst-alignmod2.c): Likewise. (CPPFLAGS-tst-execstack.c): Likewise. (CFLAGS-tst-ptrguard1-static.c): Likewise. (CFLAGS-tst-latepthreadmod.c): Likewise. * grp/Makefile (CFLAGS-getgrgid_r.c): Likewise. (CFLAGS-getgrnam_r.c): Likewise. (CFLAGS-getgrent_r.c): Likewise. (CFLAGS-getgrent.c): Likewise. (CFLAGS-fgetgrent.c): Likewise. (CFLAGS-fgetgrent_r.c): Likewise. (CFLAGS-putgrent.c): Likewise. (CFLAGS-initgroups.c): Likewise. (CFLAGS-getgrgid.c): Likewise. * gshadow/Makefile (CFLAGS-getsgent_r.c): Likewise. (CFLAGS-getsgent.c): Likewise. (CFLAGS-fgetsgent.c): Likewise. (CFLAGS-fgetsgent_r.c): Likewise. (CFLAGS-putsgent.c): Likewise. (CFLAGS-getsgnam.c): Likewise. (CFLAGS-getsgnam_r.c): Likewise. * iconv/Makefile (CFLAGS-iconv_prog.c): Likewise. (CFLAGS-iconv_charmap.c): Likewise. (CFLAGS-dummy-repertoire.c): Likewise. (CFLAGS-charmap.c): Likewise. (CFLAGS-linereader.c): Likewise. (CFLAGS-simple-hash.c): Likewise. (CFLAGS-gconv_conf.c): Likewise. (CFLAGS-iconvconfig.c): Likewise. * inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise. (CFLAGS-gethstbyad.c): Likewise. (CFLAGS-gethstbynm_r.c): Likewise. (CFLAGS-gethstbynm.c): Likewise. (CFLAGS-gethstbynm2_r.c): Likewise. (CFLAGS-gethstbynm2.c): Likewise. (CFLAGS-gethstent_r.c): Likewise. (CFLAGS-gethstent.c): Likewise. (CFLAGS-rcmd.c): Likewise. (CFLAGS-getnetbynm_r.c): Likewise. (CFLAGS-getnetbynm.c): Likewise. (CFLAGS-getnetbyad_r.c): Likewise. (CFLAGS-getnetbyad.c): Likewise. (CFLAGS-getnetent_r.c): Likewise. (CFLAGS-getnetent.c): Likewise. (CFLAGS-getaliasent_r.c): Likewise. (CFLAGS-getaliasent.c): Likewise. (CFLAGS-getrpcent_r.c): Likewise. (CFLAGS-getrpcent.c): Likewise. (CFLAGS-getservent_r.c): Likewise. (CFLAGS-getservent.c): Likewise. (CFLAGS-getprtent_r.c): Likewise. (CFLAGS-getprtent.c): Likewise. (CFLAGS-either_ntoh.c): Likewise. (CFLAGS-either_hton.c): Likewise. (CFLAGS-getnetgrent.c): Likewise. (CFLAGS-getnetgrent_r.c): Likewise. (CFLAGS-tst-checks-posix.c): Likewise. (CFLAGS-tst-sockaddr.c): Likewise. * intl/Makefile (CFLAGS-tst-gettext.c): Likewise. (CFLAGS-tst-translit.c): Likewise. (CFLAGS-tst-gettext2.c): Likewise. (CFLAGS-tst-codeset.c): Likewise. (CFLAGS-tst-gettext3.c): Likewise. (CFLAGS-tst-gettext4.c): Likewise. (CFLAGS-tst-gettext5.c): Likewise. (CFLAGS-tst-gettext6.c): Likewise. * io/Makefile (CFLAGS-open.c): Likewise. (CFLAGS-open64.c): Likewise. (CFLAGS-creat.c): Likewise. (CFLAGS-creat64.c): Likewise. (CFLAGS-fcntl.c): Likewise. (CFLAGS-poll.c): Likewise. (CFLAGS-ppoll.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-statfs.c): Likewise. (CFLAGS-fstatfs.c): Likewise. (CFLAGS-statvfs.c): Likewise. (CFLAGS-fstatvfs.c): Likewise. (CFLAGS-fts.c): Likewise. (CFLAGS-fts64.c): Likewise. (CFLAGS-ftw.c): Likewise. (CFLAGS-ftw64.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-posix_fallocate.c): Likewise. (CFLAGS-posix_fallocate64.c): Likewise. (CFLAGS-fallocate.c): Likewise. (CFLAGS-fallocate64.c): Likewise. (CFLAGS-read.c): Likewise. (CFLAGS-write.c): Likewise. (CFLAGS-test-stat.c): Likewise. (CFLAGS-test-lfs.c): Likewise. * libio/Makefile (CFLAGS-fileops.c): Likewise. (CFLAGS-fputc.c): Likewise. (CFLAGS-fputwc.c): Likewise. (CFLAGS-freopen64.c): Likewise. (CFLAGS-freopen.c): Likewise. (CFLAGS-fseek.c): Likewise. (CFLAGS-fseeko64.c): Likewise. (CFLAGS-fseeko.c): Likewise. (CFLAGS-ftello64.c): Likewise. (CFLAGS-ftello.c): Likewise. (CFLAGS-fwide.c): Likewise. (CFLAGS-genops.c): Likewise. (CFLAGS-getc.c): Likewise. (CFLAGS-getchar.c): Likewise. (CFLAGS-getwc.c): Likewise. (CFLAGS-getwchar.c): Likewise. (CFLAGS-iofclose.c): Likewise. (CFLAGS-iofflush.c): Likewise. (CFLAGS-iofgetpos64.c): Likewise. (CFLAGS-iofgetpos.c): Likewise. (CFLAGS-iofgets.c): Likewise. (CFLAGS-iofgetws.c): Likewise. (CFLAGS-iofputs.c): Likewise. (CFLAGS-iofputws.c): Likewise. (CFLAGS-iofread.c): Likewise. (CFLAGS-iofsetpos64.c): Likewise. (CFLAGS-iofsetpos.c): Likewise. (CFLAGS-ioftell.c): Likewise. (CFLAGS-iofwrite.c): Likewise. (CFLAGS-iogetdelim.c): Likewise. (CFLAGS-iogetline.c): Likewise. (CFLAGS-iogets.c): Likewise. (CFLAGS-iogetwline.c): Likewise. (CFLAGS-ioputs.c): Likewise. (CFLAGS-ioseekoff.c): Likewise. (CFLAGS-ioseekpos.c): Likewise. (CFLAGS-iosetbuffer.c): Likewise. (CFLAGS-iosetvbuf.c): Likewise. (CFLAGS-ioungetc.c): Likewise. (CFLAGS-ioungetwc.c): Likewise. (CFLAGS-oldfileops.c): Likewise. (CFLAGS-oldiofclose.c): Likewise. (CFLAGS-oldiofgetpos64.c): Likewise. (CFLAGS-oldiofgetpos.c): Likewise. (CFLAGS-oldiofsetpos64.c): Likewise. (CFLAGS-oldiofsetpos.c): Likewise. (CFLAGS-peekc.c): Likewise. (CFLAGS-putc.c): Likewise. (CFLAGS-putchar.c): Likewise. (CFLAGS-putwc.c): Likewise. (CFLAGS-putwchar.c): Likewise. (CFLAGS-rewind.c): Likewise. (CFLAGS-wfileops.c): Likewise. (CFLAGS-wgenops.c): Likewise. (CFLAGS-oldiofopen.c): Likewise. (CFLAGS-iofopen.c): Likewise. (CFLAGS-iofopen64.c): Likewise. (CFLAGS-oldtmpfile.c): Likewise. (CFLAGS-tst_putwc.c): Likewise. * locale/Makefile (CFLAGS-md5.c): Likewise. (CFLAGS-charmap.c): Likewise. (CFLAGS-locfile.c): Likewise. (CFLAGS-charmap-dir.c): Likewise. * login/Makefile (CFLAGS-grantpt.c): Likewise. (CFLAGS-getpt.c): Likewise. (CFLAGS-pt_chown.c): Likewise. * malloc/Makefile (CFLAGS-mcheck-init.c): Likewise. (CFLAGS-obstack.c): Likewise. * math/Makefile (CFLAGS-test-tgmath3.c): Likewise. (CFLAGS-test-double-vlen4-wrappers.c): Likewise. (CFLAGS-test-double-vlen8-wrappers.c): Likewise. (CFLAGS-test-float-vlen8-wrappers.c): Likewise. (CFLAGS-test-float-vlen16-wrappers.c): Likewise. (CFLAGS-test-tgmath.c): Likewise. (CFLAGS-test-tgmath2.c): Likewise. (CFLAGS-test-tgmath-ret.c): Likewise. (CFLAGS-test-powl.c): Likewise. (CFLAGS-test-snan.c): Likewise. (CFLAGS-test-signgam-finite.c): Likewise. (CFLAGS-test-signgam-finite-c99.c): Likewise. (CFLAGS-test-signgam-finite-c11.c): Likewise. (CFLAGS-test-signgam-uchar.c): Likewise. (CFLAGS-test-signgam-uchar-init.c): Likewise. (CFLAGS-test-signgam-uchar-static.c): Likewise. (CFLAGS-test-signgam-uchar-init-static.c): Likewise. (CFLAGS-test-signgam-uint.c): Likewise. (CFLAGS-test-signgam-uint-init.c): Likewise. (CFLAGS-test-signgam-uint-static.c): Likewise. (CFLAGS-test-signgam-uint-init-static.c): Likewise. (CFLAGS-test-signgam-ullong.c): Likewise. (CFLAGS-test-signgam-ullong-init.c): Likewise. (CFLAGS-test-signgam-ullong-static.c): Likewise. (CFLAGS-test-signgam-ullong-init-static.c): Likewise. (CFLAGS-test-math-cxx11.cc): Likewise. (CFLAGS-test-math-isinff.cc): Likewise. (CFLAGS-test-math-iszero.cc): Likewise. (CFLAGS-test-math-issignaling.cc): Likewise. (CFLAGS-test-math-iscanonical.cc): Likewise. (CFLAGS-test-iszero-excess-precision.c): Likewise. (CFLAGS-test-iseqsig-excess-precision.c): Likewise. (CFLAGS-test-flt-eval-method.c): Likewise. (CFLAGS-test-fe-snans-always-signal.c): Likewise. (CFLAGS-test-finite-macros.c): Likewise. * misc/Makefile (CFLAGS-select.c): Likewise. (CFLAGS-tsearch.c): Likewise. (CFLAGS-lsearch.c): Likewise. (CFLAGS-pselect.c): Likewise. (CFLAGS-readv.c): Likewise. (CFLAGS-writev.c): Likewise. (CFLAGS-preadv.c): Likewise. (CFLAGS-preadv64.c): Likewise. (CFLAGS-pwritev.c): Likewise. (CFLAGS-pwritev64.c): Likewise. (CFLAGS-preadv2.c): Likewise. (CFLAGS-preadv64v2.c): Likewise. (CFLAGS-pwritev2.c): Likewise. (CFLAGS-pwritev64v2.c): Likewise. (CFLAGS-usleep.c): Likewise. (CFLAGS-syslog.c): Likewise. (CFLAGS-error.c): Likewise. (CFLAGS-getpass.c): Likewise. (CFLAGS-mkstemp.c): Likewise. (CFLAGS-mkstemp64.c): Likewise. (CFLAGS-getsysstats.c): Likewise. (CFLAGS-getusershell.c): Likewise. (CFLAGS-err.c): Likewise. (CFLAGS-tst-tsearch.c): Likewise. (CFLAGS-msync.c): Likewise. (CFLAGS-fdatasync.c): Likewise. (CFLAGS-fsync.c): Likewise. * nptl/Makefile (CFLAGS-nptl-init.c): Likewise. (CFLAGS-unwind.c): Likewise. (CFLAGS-unwind-forcedunwind.c): Likewise. (CFLAGS-pthread_cancel.c): Likewise. (CFLAGS-pthread_setcancelstate.c): Likewise. (CFLAGS-pthread_setcanceltype.c): Likewise. (CFLAGS-cancellation.c): Likewise. (CFLAGS-libc-cancellation.c): Likewise. (CFLAGS-pthread_exit.c): Likewise. (CFLAGS-forward.c): Likewise. (CFLAGS-pthread_testcancel.c): Likewise. (CFLAGS-pthread_join.c): Likewise. (CFLAGS-pthread_timedjoin.c): Likewise. (CFLAGS-pthread_once.c): Likewise. (CFLAGS-pthread_cond_wait.c): Likewise. (CFLAGS-sem_wait.c): Likewise. (CFLAGS-sem_timedwait.c): Likewise. (CFLAGS-fcntl.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-pread.c): Likewise. (CFLAGS-pread64.c): Likewise. (CFLAGS-pwrite.c): Likewise. (CFLAGS-pwrite64.c): Likewise. (CFLAGS-wait.c): Likewise. (CFLAGS-waitpid.c): Likewise. (CFLAGS-sigwait.c): Likewise. (CFLAGS-msgrcv.c): Likewise. (CFLAGS-msgsnd.c): Likewise. (CFLAGS-tcdrain.c): Likewise. (CFLAGS-open.c): Likewise. (CFLAGS-open64.c): Likewise. (CFLAGS-pause.c): Likewise. (CFLAGS-recv.c): Likewise. (CFLAGS-send.c): Likewise. (CFLAGS-accept.c): Likewise. (CFLAGS-sendto.c): Likewise. (CFLAGS-connect.c): Likewise. (CFLAGS-recvfrom.c): Likewise. (CFLAGS-recvmsg.c): Likewise. (CFLAGS-sendmsg.c): Likewise. (CFLAGS-close.c): Likewise. (CFLAGS-read.c): Likewise. (CFLAGS-write.c): Likewise. (CFLAGS-nanosleep.c): Likewise. (CFLAGS-sigsuspend.c): Likewise. (CFLAGS-msync.c): Likewise. (CFLAGS-fdatasync.c): Likewise. (CFLAGS-fsync.c): Likewise. (CFLAGS-pt-system.c): Likewise. (CFLAGS-tst-cleanup2.c): Likewise. (CFLAGS-tst-cleanupx2.c): Likewise. (CFLAGS-flockfile.c): Likewise. (CFLAGS-ftrylockfile.c): Likewise. (CFLAGS-funlockfile.c): Likewise. (CFLAGS-tst-initializers1.c): Likewise. (CFLAGS-tst-initializers1-c89.c): Likewise. (CFLAGS-tst-initializers1-c99.c): Likewise. (CFLAGS-tst-initializers1-c11.c): Likewise. (CFLAGS-tst-initializers1-gnu89.c): Likewise. (CFLAGS-tst-initializers1-gnu99.c): Likewise. (CFLAGS-tst-initializers1-gnu11.c): Likewise. * nscd/Makefile (CFLAGS-nscd_getpw_r.c): Likewise. (CFLAGS-nscd_getgr_r.c): Likewise. (CFLAGS-nscd_gethst_r.c): Likewise. (CFLAGS-nscd_getai.c): Likewise. (CFLAGS-nscd_initgroups.c): Likewise. * posix/Makefile (CFLAGS-getaddrinfo.c): Likewise. (CFLAGS-pause.c): Likewise. (CFLAGS-pread.c): Likewise. (CFLAGS-pread64.c): Likewise. (CFLAGS-pwrite.c): Likewise. (CFLAGS-pwrite64.c): Likewise. (CFLAGS-sleep.c): Likewise. (CFLAGS-wait.c): Likewise. (CFLAGS-waitid.c): Likewise. (CFLAGS-waitpid.c): Likewise. (CFLAGS-getopt.c): Likewise. (CFLAGS-wordexp.c): Likewise. (CFLAGS-sysconf.c): Likewise. (CFLAGS-pathconf.c): Likewise. (CFLAGS-fpathconf.c): Likewise. (CFLAGS-spawn.c): Likewise. (CFLAGS-spawnp.c): Likewise. (CFLAGS-spawni.c): Likewise. (CFLAGS-glob.c): Likewise. (CFLAGS-glob64.c): Likewise. (CFLAGS-getconf.c): Likewise. (CFLAGS-nanosleep.c): Likewise. * pwd/Makefile (CFLAGS-getpwent_r.c): Likewise. (CFLAGS-getpwent.c): Likewise. (CFLAGS-getpw.c): Likewise. (CFLAGS-fgetpwent_r.c): Likewise. * resolv/Makefile (CFLAGS-res_hconf.c): Likewise. * rt/Makefile (CFLAGS-aio_suspend.c): Likewise. (CFLAGS-mq_timedreceive.c): Likewise. (CFLAGS-mq_timedsend.c): Likewise. (CFLAGS-clock_nanosleep.c): Likewise. (CFLAGS-librt-cancellation.c): Likewise. * shadow/Makefile (CFLAGS-getspent_r.c): Likewise. (CFLAGS-getspent.c): Likewise. (CFLAGS-fgetspent.c): Likewise. (CFLAGS-fgetspent_r.c): Likewise. (CFLAGS-putspent.c): Likewise. (CFLAGS-getspnam.c): Likewise. (CFLAGS-getspnam_r.c): Likewise. * signal/Makefile (CFLAGS-sigpause.c): Likewise. (CFLAGS-sigsuspend.c): Likewise. (CFLAGS-sigtimedwait.c): Likewise. (CFLAGS-sigwait.c): Likewise. (CFLAGS-sigwaitinfo.c): Likewise. (CFLAGS-sigreturn.c): Likewise. * stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise. (CFLAGS-vfwprintf.c): Likewise. (CFLAGS-tmpfile.c): Likewise. (CFLAGS-tmpfile64.c): Likewise. (CFLAGS-tempname.c): Likewise. (CFLAGS-psignal.c): Likewise. (CFLAGS-vprintf.c): Likewise. (CFLAGS-cuserid.c): Likewise. (CFLAGS-errlist.c): Likewise. (CFLAGS-siglist.c): Likewise. (CFLAGS-scanf15.c): Likewise. (CFLAGS-scanf17.c): Likewise. * stdlib/Makefile (CFLAGS-bsearch.c): Likewise. (CFLAGS-msort.c): Likewise. (CFLAGS-qsort.c): Likewise. (CFLAGS-system.c): Likewise. (CFLAGS-fmtmsg.c): Likewise. (CFLAGS-strfmon.c): Likewise. (CFLAGS-strfmon_l.c): Likewise. (CFLAGS-strfromd.c): Likewise. (CFLAGS-strfromf.c): Likewise. (CFLAGS-strfroml.c): Likewise. (CFLAGS-tst-bsearch.c): Likewise. (CFLAGS-tst-qsort.c): Likewise. (CFLAGS-tst-makecontext2.c): Likewise. * sunrpc/Makefile (CFLAGS-xbootparam_prot.c): Likewise. (CFLAGS-xnlm_prot.c): Likewise. (CFLAGS-xrstat.c): Likewise. (CFLAGS-xyppasswd.c): Likewise. (CFLAGS-xklm_prot.c): Likewise. (CFLAGS-xrex.c): Likewise. (CFLAGS-xsm_inter.c): Likewise. (CFLAGS-xmount.c): Likewise. (CFLAGS-xrusers.c): Likewise. (CFLAGS-xspray.c): Likewise. (CFLAGS-xnfs_prot.c): Likewise. (CFLAGS-xrquota.c): Likewise. (CFLAGS-xkey_prot.c): Likewise. (CFLAGS-auth_unix.c): Likewise. (CFLAGS-key_call.c): Likewise. (CFLAGS-pmap_rmt.c): Likewise. (CFLAGS-clnt_perr.c): Likewise. (CFLAGS-openchild.c): Likewise. * sysvipc/Makefile (CFLAGS-msgrcv.c): Likewise. (CFLAGS-msgsnd.c): Likewise. * termios/Makefile (CFLAGS-tcdrain.c): Likewise. * time/Makefile (CFLAGS-tzfile.c): Likewise. (CFLAGS-tzset.c): Likewise. (CFLAGS-getdate.c): Likewise. (CFLAGS-test_time.c): Likewise. (CPPFLAGS-tst-tzname.c): Likewise. * timezone/Makefile (CFLAGS-zdump.c): Likewise. (CFLAGS-zic.c): Likewise. * wcsmbs/Makefile (CFLAGS-wcwidth.c): Likewise. (CFLAGS-wcswidth.c): Likewise. (CFLAGS-wcstol.c): Likewise. (CFLAGS-wcstoul.c): Likewise. (CFLAGS-wcstoll.c): Likewise. (CFLAGS-wcstoull.c): Likewise. (CFLAGS-wcstod.c): Likewise. (CFLAGS-wcstold.c): Likewise. (CFLAGS-wcstof128.c): Likewise. (CFLAGS-wcstof.c): Likewise. (CFLAGS-wcstol_l.c): Likewise. (CFLAGS-wcstoul_l.c): Likewise. (CFLAGS-wcstoll_l.c): Likewise. (CFLAGS-wcstoull_l.c): Likewise. (CFLAGS-wcstod_l.c): Likewise. (CFLAGS-wcstold_l.c): Likewise. (CFLAGS-wcstof128_l.c): Likewise. (CFLAGS-wcstof_l.c): Likewise. (CPPFLAGS-tst-wchar-h.c): Likewise. (CPPFLAGS-wcstold_l.c): Likewise. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
* Prefer https for Sourceware linksSiddhesh Poyarekar2017-11-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Update all sourceware links to https. The website redirects everything to https anyway so let the web server do a bit less work. The only reference that remains unchanged is the one in the old ChangeLog, since it didn't seem worth changing it. * NEWS: Update sourceware link to https. * configure.ac: Likewise. * crypt/md5test-giant.c: Likewise. * dlfcn/bug-atexit1.c: Likewise. * dlfcn/bug-atexit2.c: Likewise. * localedata/README: Likewise. * malloc/tst-mallocfork.c: Likewise. * manual/install.texi: Likewise. * nptl/tst-pthread-getattr.c: Likewise. * stdio-common/tst-fgets.c: Likewise. * stdio-common/tst-fwrite.c: Likewise. * sunrpc/Makefile: Likewise. * sysdeps/arm/armv7/multiarch/memcpy_impl.S: Likewise. * wcsmbs/tst-mbrtowc2.c: Likewise. * configure: Regenerate. * INSTALL: Regenerate.
* stdio-common: Use array_length and array_end macrosFlorian Weimer2017-11-0214-42/+47
|
* [BZ #22142] powerpc: Fix the carry bit on mpn_[add|sub]_n on POWER7Tulio Magno Quites Machado Filho2017-10-132-0/+12
| | | | | | | | | | | | | | | | | Fix the ifdef clause that was being used in the opposite way, setting a wrong value of the carry bit. This is also correcting 2 memory accesses that were mistakenly referring to r0 while they were supposed to mean the immediate value 0. [BZ #22142] * stdio-common/tst-printf.c (fp_test): Add tests for DBL_MAX and -DBL_MAX. (do_test): Likewise. * stdio-common/tst-printf.sh: Likewise. * sysdeps/powerpc/powerpc64/power7/add_n.S: Invert the initial ifdef clause in order to set the carry bit right. Replace r0 by 0 without changing the behavior.
* linux: Implement tmpfile with O_TMPFILE (BZ#21530)Adhemerval Zanella2017-09-013-10/+44
| | | | | | | | | | | | | | | | | | | | | | This patch adds O_TMPFILE support to tmpfile on Linux. This is similar to the previous suggestion by Andreas Schwab [1] with the difference the file descriptor creation is parameterized to compartmentalize Linux only open flags (O_TMPFILE) on sysdeps. Checked on x86_64-linux-gnu. Adhemerval Zanella <adhemerval.zanella@linaro.org> Andreas Schwab <schwab@suse.de> [BZ #21530] * include/stdio.h (__gen_tempfd): New function. * stdio-common/Makefile (routines): Add gentempfd. * stdio-common/gentempfd.c: New file. * sysdeps/unix/sysv/linux/gentempfd.c: Likewise. * stdio-common/tmpfile.c (tmpfile): First try to use a system specific unnamed file first. [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01293.html
* stdio-common: Remove internal_function attributeFlorian Weimer2017-08-312-5/+2
|
* Hide internal printf functions [BZ #18822/21986]H.J. Lu2017-08-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Hide internal printf functions to allow direct access within libc.so and libc.a without using GOT nor PLT. Since __guess_grouping has been changed to take 2 arguments by commit a1d84548c8aa7023cd039c85f81b831eef6d4a4c Author: Ulrich Drepper <drepper@redhat.com> Date: Fri Feb 11 18:50:36 2000 +0000 the third argument passed to __guess_grouping is removed. [BZ #18822] [BZ #21986] * include/printf.h (__printf_fphex): Add attribute_hidden. (__guess_grouping): New prototype. * stdio-common/printf_fp.c (__guess_grouping): Removed. * stdio-common/reg-printf.c (__register_printf_specifier): Add libc_hidden_proto and libc_hidden_def. * stdlib/strfmon_l.c (__guess_grouping): Removed. (__vstrfmon_l): Remove the third argument passed to __guess_grouping.
* Consolidate non cancellable write callAdhemerval Zanella2017-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all the non cancellable write calls to use the __write_nocancel identifier. For non cancellable targets it will be just a macro to call the default respective symbol while on Linux will be a internal one. Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. * sysdeps/generic/not-cancel.h (write_not_cancel): Remove macro. (__write_nocancel): New macro. * sysdeps/unix/sysv/linux/not-cancel.h (__write_nocancel): Rewrite as a function prototype. (write_not_cancel): Remove macro. * sysdeps/unix/sysv/linux/write.c (__write_nocancel): New function. * gmon/gmon.c (ERR): Replace write_not_cancel with __write_nocancel. (write_gmon): Likewise. * libio/fileops.c (_IO_new_file_write): Likewise. * login/utmp_file.c (pututline_file): Likewise. (updwtmp_file): Likewise. * stdio-common/psiginfo.c (psiginfo): Likewise. * sysdeps/posix/spawni.c (__spawni_child): Likewise. * sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise. * sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise. * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np): Likewise.
* Remove __long_double_t.Joseph Myers2017-08-071-1/+1
| | | | | | | | | | | | | | | | | sys/cdefs.h has a macro __long_double_t used in two places in glibc. long double is a standard part of C since C89; there is no need for such an alias for it. This patch removes that macro and uses long double directly everywhere. As an implementation-namespace, undocumented symbol, it should not be considered part of the API for users, and codesearch.debian.net shows no sign of it being used outside glibc in a way that would break with this patch. Tested for x86_64. * misc/sys/cdefs.h (__long_double_t): Remove. * stdio-common/printf_fp.c (__printf_fp_l): Use long double instead of __long_double_t, * stdlib/strfmon_l.c (__vstrfmon_l): Likewise.
* Fix missing redirects in testsuite targetsAndreas Schwab2017-08-071-2/+2
|