summary refs log tree commit diff
path: root/iconv
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates not handled by scripts/update-copyrights.Paul Eggert2022-01-012-2/+2
| | | | | | | | | | | | | | I've updated copyright dates in glibc for 2022. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. As well as the usual annual updates, mainly dates in --version output (minus csu/version.c which previously had to be handled manually but is now successfully updated by update-copyrights), there is a small change to the copyright notice in NEWS which should let NEWS get updated automatically next year. Please remember to include 2022 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them).
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-0142-42/+42
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* iconv: Use TIMEOUTFACTOR for iconv test timeoutStafford Horne2021-10-211-1/+4
| | | | | | | | | | | Currently the timeout for each iconv test is hard coded to 3 seconds. On my OpenRISC test platform this is too slow and the test fails with a HANG error. This change uses the available TIMEOUTFACTOR to compute the timeout. The default value is still 3. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* iconvconfig: Fix behaviour with --prefix [BZ #28199]Siddhesh Poyarekar2021-09-133-12/+28
| | | | | | | | | | | | | | The consolidation of configuration parsing broke behaviour with --prefix, where the prefix bled into the modules cache. Accept a prefix which, when non-NULL, is prepended to the path when looking for configuration files but only the original directory is added to the modules cache. This has no effect on the codegen of gconv_conf since it passes NULL. Reported-by: Patrick McCarty <patrick.mccarty@intel.com> Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
* Add generic C.UTF-8 locale (Bug 17318)Carlos O'Donell2021-09-062-3/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We add a new C.UTF-8 locale. This locale is not builtin to glibc, but is provided as a distinct locale. The locale provides full support for UTF-8 and this includes full code point sorting via STRCMP-based collation (strcmp or wcscmp). The collation uses a new keyword 'codepoint_collation' which drops all collation rules and generates an empty zero rules collation to enable STRCMP usage in collation. This ensures that we get full code point sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE structure information and ASCII collating tables). The new locale is added to SUPPORTED. Minimal test data for specific code points (minus those not supported by collate-test) is provided in C.UTF-8.in, and this verifies code point sorting is working reasonably across the range. The locale was tested manually with the full set of code points without failure. The locale is harmonized with locales already shipping in various downstream distributions. A new tst-iconv9 test is added which verifies the C.UTF-8 locale is generally usable. Testing for fnmatch, regexec, and recomp is provided by extending bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch, tst-regcomp-truncated, and tst-regex to use C.UTF-8. Tested on x86_64 or i686 without regression. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Remove "Contributed by" linesSiddhesh Poyarekar2021-09-0329-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix iconv build with GCC mainlineJoseph Myers2021-08-231-0/+6
| | | | | | | | | | | | | | | Current GCC mainline produces -Wstringop-overflow errors building some iconv converters, as discussed at <https://gcc.gnu.org/pipermail/gcc/2021-July/236943.html>. Add an __builtin_unreachable call as suggested so that GCC can see the case that would involve a buffer overflow is unreachable; because the unreachability depends on valid conversion state being passed into the function from previous conversion steps, it's not something the compiler can reasonably deduce on its own. Tested with build-many-glibcs.py that, together with <https://sourceware.org/pipermail/libc-alpha/2021-August/130244.html>, it restores the glibc build for powerpc-linux-gnu.
* iconv_charmap: Close output file when doneSiddhesh Poyarekar2021-08-031-0/+2
| | | | Reviewed-by: Arjun Shankar <arjun@redhat.com>
* gconv_parseconfdir: Fix memory leakSiddhesh Poyarekar2021-08-031-5/+4
| | | | | | | The allocated `conf` would leak if we have to skip over the file due to the underlying filesystem not supporting dt_type. Reviewed-by: Arjun Shankar <arjun@redhat.com>
* libio: Replace internal _IO_getdelim symbol with __getdelimFlorian Weimer2021-07-071-1/+1
| | | | | | | __getdelim is exported, _IO_getdelim is not. Add a hidden prototype for __getdelim. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* iconvconfig: Use the public feof_unlockedSiddhesh Poyarekar2021-07-021-1/+2
| | | | | | | | | Build of iconvconfig failed with CFLAGS=-Os since __feof_unlocked is not a public symbol. Replace with feof_unlocked (defined to __feof_unlocked when IS_IN (libc)) to fix this. Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com> Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* iconvconfig: Fix multiple issuesSiddhesh Poyarekar2021-06-282-16/+10
| | | | | | | | | | | | | | | | | | | | | It was noticed on big-endian systems that msgfmt would fail with the following error: msgfmt: gconv_builtin.c:70: __gconv_get_builtin_trans: Assertion `cnt < sizeof (map) / sizeof (map[0])' failed. Aborted (core dumped) This is only seen on installed systems because it was due to a corrupted gconv-modules.cache. iconvconfig had the following issues (it was specifically freeing fulldir that caused this issue, but other cleanups are also needed) that this patch fixes. - Add prefix only if dir starts with '/' - Use asprintf instead of mempcpy so that the directory string is NULL terminated - Make a copy of the directory reference in new_module so that fulldir can be freed within the same scope in handle_dir. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Handle DT_UNKNOWN in gconv-modules.dSiddhesh Poyarekar2021-06-231-1/+8
| | | | | | | | On filesystems that do not support dt_type, a regular file shows up as DT_UNKNOWN. Fall back to using lstat64 to read file properties in such cases. Reviewed-by: DJ Delorie <dj@redhat.com>
* iconvconfig: Use common gconv module parsing functionSiddhesh Poyarekar2021-06-231-115/+13
| | | | | | | | Drop local copy of gconv file parsing and use the one in gconv_parseconfdir.h instead. Now there is a single implementation of configuration file parsing. Reviewed-by: DJ Delorie <dj@redhat.com>
* gconv_conf: Split out configuration file processingSiddhesh Poyarekar2021-06-232-126/+164
| | | | | | | | Split configuration file processing into a separate header file and include it. Macroize all calls that need to go through internal interfaces so that iconvconfig can also use them. Reviewed-by: DJ Delorie <dj@redhat.com>
* gconv_conf: Remove unused variablesSiddhesh Poyarekar2021-06-231-14/+10
| | | | | | | | | The modules and nmodules parameters passed to add_modules, add_alias, etc. are not used and are hence unnecessary. Remove them so that their signatures match the functions in iconvconfig. Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
* iconv: Remove alloca use in gconv-modules configuration parsingSiddhesh Poyarekar2021-06-232-14/+20
| | | | | | | | | | The alloca sizes ought to be constrained to PATH_MAX, but replace them with dynamic allocation to be safe. A static PATH_MAX array would have worked too but Hurd does not have PATH_MAX and the code path is not hot enough to micro-optimise this allocation. Revisit if any of those realities change. Reviewed-by: DJ Delorie <dj@redhat.com>
* Use 64 bit time_t stat internallyAdhemerval Zanella2021-06-221-2/+2
| | | | | | | | | | For the legacy ABI with supports 32-bit time_t it calls the 64-bit time directly, since the LFS symbols calls the 64-bit time_t ones internally. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* gconv_conf: Read configuration files in gconv-modules.dSiddhesh Poyarekar2021-06-091-6/+43
| | | | | | | | Read configuration files with names ending in .conf in GCONV_PATH/gconv-modules.d to mirror configuration flexibility in iconvconfig into the iconv program and function. Reviewed-by: DJ Delorie <dj@redhat.com>
* iconvconfig: Read configuration from gconv-modules.d subdirectorySiddhesh Poyarekar2021-06-091-6/+44
| | | | | | | | | | | | | | | In addition to GCONV_PATH/gconv-modules, also read module configuration from *.conf files in GCONV_PATH/gconv-modules.d. This allows a single gconv directory to have multiple sets of gconv modules but at the same time, a single modules cache. With this feature, one could separate the glibc supported gconv modules into a minimal essential set (ISO-8859-*, UTF, etc.) from the remaining modules. In future, these could be further segregated into langpack-associated sets with their own gconv-modules.d/someconfig.conf. Reviewed-by: DJ Delorie <dj@redhat.com>
* iconvconfig: Make file handling more general purposeSiddhesh Poyarekar2021-06-091-25/+40
| | | | | | | | Split out configuration file handling code from handle_dir into its own function so that it can be reused for multiple configuration files. Reviewed-by: DJ Delorie <dj@redhat.com>
* charmap_conversion: Free conversion table on exitSiddhesh Poyarekar2021-05-181-0/+7
| | | | | | The conversion table is allocated using xcalloc but never freed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Run $(objpfx)iconvconfig with $(run-program-prefix) [BZ #27477]H.J. Lu2021-05-071-2/+3
| | | | | | | | | | | | | | | When glibc is configured with --enable-hardcoded-path-in-tests, "make xcheck" failed with ... env GCONV_PATH=/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/iconvdata LOCPATH=/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/localedata LC_ALL=C /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/iconv/iconvconfig --output=$tmp --nostdlib /usr/lib64/gconv; ... /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/iconv/iconvconfig: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/iconv/iconvconfig) ... FAIL: iconv/test-iconvconfig Since $(objpfx)iconvconfig is an installed program, run it with $(run-program-prefix).
* Update copyright dates not handled by scripts/update-copyrights.Paul Eggert2021-01-022-2/+2
| | | | | | | | | | | | | | I've updated copyright dates in glibc for 2021. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. As well as the usual annual updates, mainly dates in --version output (minus csu/version.c which previously had to be handled manually but is now successfully updated by update-copyrights), there is a small change to the copyright notice in NEWS which should let NEWS get updated automatically next year. Please remember to include 2021 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them).
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-0240-40/+40
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* iconv add iconv_close before the function returned with bad value.liqingqing2020-12-211-0/+1
| | | | add iconv_close before the function returned with bad value.
* iconv: use iconv_close after iconv_openliqingqing2020-12-211-0/+2
|
* treewide: fix incorrect spelling of indices in commentsDmitry V. Levin2020-12-111-2/+2
| | | | | | Replace 'indeces' with 'indices', the most annoying of these typos were those found in elf.h which is a public header file copied to other projects.
* iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)Michael Colavita2020-12-073-13/+55
| | | | | | | | | | | | | | Previously, in UCS4 conversion routines we limit the number of characters we examine to the minimum of the number of characters in the input and the number of characters in the output. This is not the correct behavior when __GCONV_IGNORE_ERRORS is set, as we do not consume an output character when we skip a code unit. Instead, track the input and output pointers and terminate the loop when either reaches its limit. This resolves assertion failures when resetting the input buffer in a step of iconv, which assumes that the input will be fully consumed given sufficient output space.
* iconv: Accept redundant shift sequences in IBM1364 [BZ #26224]Arjun Shankar2020-11-041-6/+10
| | | | | | | | | | | | | | | The IBM1364, IBM1371, IBM1388, IBM1390 and IBM1399 character sets share converter logic (iconvdata/ibm1364.c) which would reject redundant shift sequences when processing input in these character sets. This led to a hang in the iconv program (CVE-2020-27618). This commit adjusts the converter to ignore redundant shift sequences and adds test cases for iconv_prog hangs that would be triggered upon their rejection. This brings the implementation in line with other converters that also ignore redundant shift sequences (e.g. IBM930 etc., fixed in commit 692de4b3960d). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* intl: Handle translation output codesets with suffixes [BZ #26383]Arjun Shankar2020-09-256-30/+36
| | | | | | | | | | | | | | Commit 91927b7c7643 (Rewrite iconv option parsing [BZ #19519]) did not handle cases where the output codeset for translations (via the `gettext' family of functions) might have a caller specified encoding suffix such as TRANSLIT or IGNORE. This led to a regression where translations did not work when the codeset had a suffix. This commit fixes the above issue by parsing any suffixes passed to __dcigettext and adds two new test-cases to intl/tst-codeset.c to verify correct behaviour. The iconv-internal function __gconv_create_spec and the static iconv-internal function gconv_destroy_spec are now visible internally within glibc and used in intl/dcigettext.c.
* Remove internal usage of extensible stat functionsAdhemerval Zanella2020-09-111-1/+1
| | | | | | | | | | | | It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Rewrite iconv option parsing [BZ #19519]Arjun Shankar2020-07-0710-138/+978
| | | | | | | | | | | | | | | | This commit replaces string manipulation during `iconv_open' and iconv_prog option parsing with a structured, flag based conversion specification. In doing so, it alters the internal `__gconv_open' interface and accordingly adjusts its uses. This change fixes several hangs in the iconv program and therefore includes a new test to exercise iconv_prog options that originally led to these hangs. It also includes a new regression test for option handling in the iconv function. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix stringop-overflow errors from gcc 10 in iconv.Stefan Liebler2020-07-072-9/+13
| | | | | | | On s390x, I've recognize various -Werror=stringop-overflow messages in iconv/loop.c and iconv/skeleton.c if build with gcc10 -O3. With this commit gcc knows the size and do not raise those errors anymore.
* Update copyright dates not handled by scripts/update-copyrights.Joseph Myers2020-01-012-2/+2
| | | | | | | | | | | | | | | I've updated copyright dates in glibc for 2020. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. As well as the usual annual updates, mainly dates in --version output (minus libc.texinfo which previously had to be handled manually but is now successfully updated by update-copyrights), there is a fix to sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in the copyright notice meant it failed to be updated automatically. Please remember to include 2020 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them).
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-0136-36/+36
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-0736-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* iconv: Revert steps array reference counting changesFlorian Weimer2019-07-311-6/+3
| | | | | | | | | | | | | | | The changes introduce a memory leak for gconv steps arrays whose first element is an internal conversion, which has a fixed reference count which is not decremented. As a result, after the change in commit 50ce3eae5ba304650459d4441d7d246a7cefc26f, the steps array is never freed, resulting in an unbounded memory leak. This reverts commit 50ce3eae5ba304650459d4441d7d246a7cefc26f ("gconv: Check reference count in __gconv_release_cache [BZ #24677]") and commit 7e740ab2e7be7d83b75513aa406e0b10875f7f9c ("libio: Fix gconv-related memory leak [BZ #24583]"). It reintroduces bug 24583. (Bug 24677 was just a regression caused by the second commit.)
* gconv: Check reference count in __gconv_release_cache [BZ #24677]Florian Weimer2019-07-261-3/+6
| | | | | | | | | | This fixes a regression introduced in commit 7e740ab2e7be7d83b75513aa406e0b10875f7f9c ("libio: Fix gconv-related memory leak [BZ #24583]"). __gconv_release_cache is only ever called with heap-allocated arrays which contain at least one member. The statically allocated ASCII steps are filtered out by __wcsmbs_close_conv.
* iconv: Use __twalk_r in __gconv_release_shlibFlorian Weimer2019-06-041-11/+3
|
* Fix iconv buffer handling with IGNORE error handler (bug #18830)Andreas Schwab2019-06-044-20/+104
|
* wcsmbs: Fix data race in __wcsmbs_clone_conv [BZ #24584]Florian Weimer2019-05-211-0/+2
| | | | | This also adds an overflow check and documents the synchronization requirement in <gconv.h>.
* iconv: Remove public declaration of __gconv_transliterateFlorian Weimer2019-05-154-11/+10
| | | | | | | | | | Commit ba7b4d294b01870ce3497971e9d07ee261cdc540 ("Complete the removal of __gconv_translit_find") added a declaration of the GLIBC_PRIVATE function, __gconv_transliterate, to the installed header <gconv.h>. It should have been added to the internal <gconv_int.h> header. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]Gabriel F. T. Gomes2019-03-211-1/+1
| | | | | | | | | | | | | | | | | | | When -Werror=parentheses is in use, iconvconfig.c builds fail with: iconvconfig.c: In function ‘write_output’: iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses] hash_size = next_prime (nnames + nnames >> 1); ~~~~~~~^~~~~~~~ This patch adds parentheses to the expression. Not where suggested by the compiler warning, but where it produces the expected result, i.e.: where it has the effect of multiplying nnames by 1.5. Likewise for elem_size in ld-collate.c. Tested for powerpc64le. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* iconv, localedef: avoid floating point rounding differences [BZ #24372]DJ Delorie2019-03-211-2/+2
| | | | | | | | | | | | | Two cases of "int * 1.4" may result in imprecise results, which in at least one case resulted in i686 and x86-64 producing different locale files. This replaced that floating point multiply with integer operations. While the hash table margin is increased from 40% to 50%, testing shows only 2% increase in overall size of the locale archive. https://bugzilla.redhat.com/show_bug.cgi?id=1311954 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Break more lines before not after operators.Joseph Myers2019-02-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes further coding style fixes where code was breaking lines after an operator, contrary to the GNU Coding Standards. As with the previous patch, it is limited to files following a reasonable approximation to GNU style already, and is not exhaustive; more such issues remain to be fixed. Tested for x86_64, and with build-many-glibcs.py. * dirent/dirent.h [!_DIRENT_HAVE_D_NAMLEN && _DIRENT_HAVE_D_RECLEN] (_D_ALLOC_NAMLEN): Break lines before rather than after operators. * elf/cache.c (print_cache): Likewise. * gshadow/fgetsgent_r.c (__fgetsgent_r): Likewise. * htl/pt-getattr.c (__pthread_getattr_np): Likewise. * hurd/hurdinit.c (_hurd_setproc): Likewise. * hurd/hurdkill.c (_hurd_sig_post): Likewise. * hurd/hurdlookup.c (__file_name_lookup_under): Likewise. * hurd/hurdsig.c (_hurd_internal_post_signal): Likewise. (reauth_proc): Likewise. * hurd/lookup-at.c (__file_name_lookup_at): Likewise. (__file_name_split_at): Likewise. (__directory_name_split_at): Likewise. * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise. * hurd/port2fd.c (_hurd_port2fd): Likewise. * iconv/gconv_dl.c (do_print): Likewise. * inet/netinet/in.h (struct sockaddr_in): Likewise. * libio/wstrops.c (_IO_wstr_seekoff): Likewise. * locale/setlocale.c (new_composite_name): Likewise. * malloc/memusagestat.c (main): Likewise. * misc/fstab.c (fstab_convert): Likewise. * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Likewise. * nss/nss_compat/compat-grp.c (getgrent_next_nss): Likewise. (getgrent_next_file): Likewise. (internal_getgrnam_r): Likewise. (internal_getgrgid_r): Likewise. * nss/nss_compat/compat-initgroups.c (getgrent_next_nss): Likewise. (internal_getgrent_r): Likewise. * nss/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Likewise. (getpwent_next_nss): Likewise. (getpwent_next_file): Likewise. (internal_getpwnam_r): Likewise. (internal_getpwuid_r): Likewise. * nss/nss_compat/compat-spwd.c (getspent_next_nss_netgr): Likewise. (getspent_next_nss): Likewise. (internal_getspnam_r): Likewise. * pwd/fgetpwent_r.c (__fgetpwent_r): Likewise. * shadow/fgetspent_r.c (__fgetspent_r): Likewise. * string/strchr.c (STRCHR): Likewise. * string/strchrnul.c (STRCHRNUL): Likewise. * sysdeps/aarch64/fpu/fpu_control.h (_FPU_FPCR_IEEE): Likewise. * sysdeps/aarch64/sfp-machine.h (_FP_CHOOSENAN): Likewise. * sysdeps/csky/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/generic/memcopy.h (PAGE_COPY_FWD_MAYBE): Likewise. * sysdeps/generic/symbol-hacks.h (__stack_chk_fail_local): Likewise. * sysdeps/gnu/netinet/ip_icmp.h (ICMP_INFOTYPE): Likewise. * sysdeps/gnu/updwtmp.c (TRANSFORM_UTMP_FILE_NAME): Likewise. * sysdeps/gnu/utmp_file.c (TRANSFORM_UTMP_FILE_NAME): Likewise. * sysdeps/hppa/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/mach/hurd/bits/stat.h (S_ISPARE): Likewise. * sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Likewise. (open_file): Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c (pthread_mutexattr_setprotocol): Likewise. * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise. * sysdeps/mach/hurd/mmap.c (__mmap): Likewise. * sysdeps/mach/hurd/ptrace.c (ptrace): Likewise. * sysdeps/mach/hurd/spawni.c (__spawni): Likewise. * sysdeps/microblaze/dl-machine.h (elf_machine_type_class): Likewise. (elf_machine_rela): Likewise. * sysdeps/mips/mips32/sfp-machine.h (_FP_CHOOSENAN): Likewise. * sysdeps/mips/mips64/sfp-machine.h (_FP_CHOOSENAN): Likewise. * sysdeps/mips/sys/asm.h (multiple #if conditionals): Likewise. * sysdeps/posix/rename.c (rename): Likewise. * sysdeps/powerpc/novmx-sigjmp.c (__novmx__sigjmp_save): Likewise. * sysdeps/powerpc/sigjmp.c (__vmx__sigjmp_save): Likewise. * sysdeps/s390/fpu/fenv_libc.h (FPC_VALID_MASK): Likewise. * sysdeps/s390/utf8-utf16-z9.c (gconv_end): Likewise. * sysdeps/unix/grantpt.c (grantpt): Likewise. * sysdeps/unix/sysv/linux/a.out.h (N_TXTOFF): Likewise. * sysdeps/unix/sysv/linux/updwtmp.c (TRANSFORM_UTMP_FILE_NAME): Likewise. * sysdeps/unix/sysv/linux/utmp_file.c (TRANSFORM_UTMP_FILE_NAME): Likewise. * sysdeps/x86/cpu-features.c (get_common_indices): Likewise. * time/tzfile.c (__tzfile_compute): Likewise.
* Update copyright dates not handled by scripts/update-copyrights.Joseph Myers2019-01-012-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've updated copyright dates in glibc for 2019. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. Please remember to include 2019 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them). * NEWS: Update copyright dates. * catgets/gencat.c (print_version): Likewise. * csu/version.c (banner): Likewise. * debug/catchsegv.sh: Likewise. * debug/pcprofiledump.c (print_version): Likewise. * debug/xtrace.sh (do_version): Likewise. * elf/ldconfig.c (print_version): Likewise. * elf/ldd.bash.in: Likewise. * elf/pldd.c (print_version): Likewise. * elf/sotruss.sh: Likewise. * elf/sprof.c (print_version): Likewise. * iconv/iconv_prog.c (print_version): Likewise. * iconv/iconvconfig.c (print_version): Likewise. * locale/programs/locale.c (print_version): Likewise. * locale/programs/localedef.c (print_version): Likewise. * login/programs/pt_chown.c (print_version): Likewise. * malloc/memusage.sh (do_version): Likewise. * malloc/memusagestat.c (print_version): Likewise. * malloc/mtrace.pl: Likewise. * manual/libc.texinfo: Likewise. * nptl/version.c (banner): Likewise. * nscd/nscd.c (print_version): Likewise. * nss/getent.c (print_version): Likewise. * nss/makedb.c (print_version): Likewise. * posix/getconf.c (main): Likewise. * scripts/test-installation.pl: Likewise. * sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-0135-35/+35
| | | | | | | * 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.
* Unconditionally call __gconv_get_path when reading iconv configurationArjun Shankar2018-11-051-2/+1
| | | | | | | | | __gconv_read_conf is only ever called once during the program's lifetime. This means that __gconv_path_elem is always uninitialized when the function begins executing. __gconv_get_path has an assert to ensure that this expected runtime behaviour is always exhibited. Given this, checking for a NULL value before calling __gconv_get_path is unnecessary. This commit drops the condition and calls __gconv_get_path unconditionally.
* Remove unnecessary locking when reading iconv configuration [BZ #22062]Arjun Shankar2018-10-175-108/+259
| | | | | | | | | | | | | | | | | | | | | | | | In iconv/gconv_conf.c, __gconv_get_path unnecessarily obtains a lock when populating the array pointed to by __gconv_path_elem. The locking is not necessary because all calls to __gconv_read_conf (which in turn calls __gconv_get_path) are serialized using __libc_once. This patch: - removes all locking in __gconv_get_path; - replaces all explicitly serialized __gconv_read_conf calls with calls to __gconv_load_conf, a new wrapper that is serialized internally; - adds a new test, iconv/tst-iconv_mt.c, to exercise iconv initialization, usage, and cleanup in a multi-threaded program; - indents __gconv_get_path correctly, removing tab characters (which makes the patch look a little bigger than it really is). After removing the unnecessary locking, it was confirmed that the test case fails if the relevant __libc_once is removed. Additionally, four localedata and iconvdata tests also fail. This gives confidence that the testsuite sufficiently guards against some regressions relating to multi-threading with iconv. Tested on x86_64 and i686.