From schwab@redhat.com Thu Aug 12 11:04:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Thu, 12 Aug 2010 11:04:00 -0000 Subject: [PATCH] Properly quote output of locale Message-ID: 2010-08-12 Andreas Schwab [BZ #11904] * locale/programs/locale.c (print_assignment): New function. (show_locale_vars): Use it. --- NEWS | 2 +- locale/programs/locale.c | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index d9cc5e4..e9fce83 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.13 * The following bugs are resolved with this release: - 11640, 11701, 11840, 11856, 11883, 11903 + 11640, 11701, 11840, 11856, 11883, 11903, 11904 * New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark diff --git a/locale/programs/locale.c b/locale/programs/locale.c index a3602cf..2005dec 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -762,6 +762,29 @@ write_charmaps (void) twalk (all_data, print_names); } +/* Print a properly quoted assignment of NAME with VAL, using double + quotes iff DQUOTE is true. */ +static void +print_assignment (const char *name, const char *val, bool dquote) +{ + printf ("%s=", name); + if (dquote) + putchar ('"'); + while (*val != '\0') + { + size_t segment + = strcspn (val, dquote ? "$`\"\\" : "~|&;<>()$`\\\"' \t\n"); + printf ("%.*s", (int) segment, val); + val += segment; + if (*val == '\0') + break; + putchar ('\\'); + putchar (*val++); + } + if (dquote) + putchar ('"'); + putchar ('\n'); +} /* We have to show the contents of the environments determining the locale. */ @@ -769,7 +792,7 @@ static void show_locale_vars (void) { size_t cat_no; - const char *lcall = getenv ("LC_ALL"); + const char *lcall = getenv ("LC_ALL") ? : ""; const char *lang = getenv ("LANG") ? : ""; auto void get_source (const char *name); @@ -778,15 +801,15 @@ show_locale_vars (void) { char *val = getenv (name); - if ((lcall ?: "")[0] != '\0' || val == NULL) - printf ("%s=\"%s\"\n", name, - (lcall ?: "")[0] ? lcall : (lang ?: "")[0] ? lang : "POSIX"); + if (lcall[0] != '\0' || val == NULL) + print_assignment (name, lcall[0] ? lcall : lang[0] ? lang : "POSIX", + true); else - printf ("%s=%s\n", name, val); + print_assignment (name, val, false); } /* LANG has to be the first value. */ - printf ("LANG=%s\n", lang); + print_assignment ("LANG", lang, false); /* Now all categories in an unspecified order. */ for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no) @@ -794,7 +817,7 @@ show_locale_vars (void) get_source (category[cat_no].name); /* The last is the LC_ALL value. */ - printf ("LC_ALL=%s\n", lcall ? : ""); + print_assignment ("LC_ALL", lcall, false); } -- 1.7.2.1 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From schwab@redhat.com Thu Aug 19 10:59:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Thu, 19 Aug 2010 10:59:00 -0000 Subject: [PATCH] Fix ifunc thunk for strspn on x86 in static libc Message-ID: 2010-08-19 Andreas Schwab * sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check. --- sysdeps/i386/i686/multiarch/strspn.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/i386/i686/multiarch/strspn.S b/sysdeps/i386/i686/multiarch/strspn.S index 7fe6f97..dbdf1af 100644 --- a/sysdeps/i386/i686/multiarch/strspn.S +++ b/sysdeps/i386/i686/multiarch/strspn.S @@ -1,5 +1,5 @@ /* Multiple versions of strspn - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009,2010 Free Software Foundation, Inc. Contributed by Intel Corporation. This file is part of the GNU C Library. @@ -65,7 +65,7 @@ ENTRY(strspn) jne 1f call __init_cpu_features 1: leal __strspn_ia32, %eax - testl $index_SSE2, CPUID_OFFSET+index_SSE4_2+__cpu_features + testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features jz 2f leal __strspn_sse42, %eax 2: ret -- 1.7.2.1 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From schwab@redhat.com Thu Aug 19 14:03:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Thu, 19 Aug 2010 14:03:00 -0000 Subject: [PATCH] powerpc32: add fanotify_mark syscall Message-ID: 2010-08-19 Andreas Schwab * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add fanotify_mark. --- .../sysv/linux/powerpc/powerpc32/syscalls.list | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list index 3012285..aaa3557 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list @@ -8,3 +8,4 @@ oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0 readahead - readahead i:iiiii __readahead readahead prlimit64 EXTRA prlimit64 i:iipp prlimit64 +fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark -- 1.7.2.1 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From drepper@redhat.com Thu Aug 19 14:45:00 2010 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Aug 2010 14:45:00 -0000 Subject: [PATCH] powerpc32: add fanotify_mark syscall In-Reply-To: References: Message-ID: <4C6D4363.7070407@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/19/2010 07:03 AM, Andreas Schwab wrote: > +fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark Are you sure? I didn't add anything like this because the kernel entry for 32-bit expects the mask in two halves. These are passed correctly for x86 but I don't think it works without a wrapper on big endian. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkxtQ2MACgkQ2ijCOnn/RHS5sQCfRfH/xRQHzFRIarU9XfKA1aXz 09kAn1gIfELhYWKn7HMHGahSUHOChVAa =/uWN -----END PGP SIGNATURE----- From schwab@redhat.com Thu Aug 19 14:49:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Thu, 19 Aug 2010 14:49:00 -0000 Subject: [PATCH] powerpc32: add fanotify_mark syscall In-Reply-To: <4C6D4363.7070407@redhat.com> (Ulrich Drepper's message of "Thu, 19 Aug 2010 07:44:51 -0700") References: <4C6D4363.7070407@redhat.com> Message-ID: Ulrich Drepper writes: > On 08/19/2010 07:03 AM, Andreas Schwab wrote: >> +fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark > > > Are you sure? I didn't add anything like this because the kernel entry > for 32-bit expects the mask in two halves. Which is exactly what it does. Count the letters. Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From drepper@redhat.com Thu Aug 19 14:54:00 2010 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Aug 2010 14:54:00 -0000 Subject: [PATCH] powerpc32: add fanotify_mark syscall In-Reply-To: References: <4C6D4363.7070407@redhat.com> Message-ID: <4C6D4583.2000900@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/19/2010 07:49 AM, Andreas Schwab wrote: > Which is exactly what it does. Count the letters. That's not what I meant. It's the order of the two halves. Works for little endian If I got it right and big endian needs a wrapper. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkxtRYMACgkQ2ijCOnn/RHSXcQCgpbaOuhD5JxaWJfh6/cJrE6+b huEAoKr5JcAGm5Bx3uLhh1kQkLoCdub/ =SHUy -----END PGP SIGNATURE----- From schwab@redhat.com Thu Aug 19 14:58:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Thu, 19 Aug 2010 14:58:00 -0000 Subject: [PATCH] powerpc32: add fanotify_mark syscall In-Reply-To: <4C6D4583.2000900@redhat.com> (Ulrich Drepper's message of "Thu, 19 Aug 2010 07:53:55 -0700") References: <4C6D4363.7070407@redhat.com> <4C6D4583.2000900@redhat.com> Message-ID: Ulrich Drepper writes: > big endian needs a wrapper. Since when is the kernel little endian? Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From schwab@redhat.com Fri Aug 20 11:41:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Fri, 20 Aug 2010 11:41:00 -0000 Subject: [PATCH] Fix spurious nop at start of __strspn_ia32 Message-ID: 2010-08-20 Andreas Schwab * sysdeps/i386/i686/multiarch/strspn.S (ENTRY): Add missing backslash. --- sysdeps/i386/i686/multiarch/strspn.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/i386/i686/multiarch/strspn.S b/sysdeps/i386/i686/multiarch/strspn.S index dbdf1af..cd26c80 100644 --- a/sysdeps/i386/i686/multiarch/strspn.S +++ b/sysdeps/i386/i686/multiarch/strspn.S @@ -76,8 +76,8 @@ END(strspn) # define ENTRY(name) \ .type __strspn_ia32, @function; \ .globl __strspn_ia32; \ - .p2align 4 - __strspn_ia32: cfi_startproc; \ + .p2align 4; \ +__strspn_ia32: cfi_startproc; \ CALL_MCOUNT # undef END # define END(name) \ -- 1.7.2.1 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From roland@redhat.com Wed Aug 25 19:16:00 2010 From: roland@redhat.com (Roland McGrath) Date: Wed, 25 Aug 2010 19:16:00 -0000 Subject: cruft patrol Message-ID: <20100825191622.DEA4940481@magilla.sf.frob.com> I just committed some fixes to eliminate compiler warnings in some of the new string code. There was also some poor indentation, sloppy typing, and a data definition gratuitously in assembly that I changed to C. Please try to get this stuff cleaner before committing in the future. Thanks, Roland From schwab@redhat.com Tue Aug 31 10:29:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Tue, 31 Aug 2010 10:29:00 -0000 Subject: [PATCH] Don't parse %s format argument as multibyte string Message-ID: The argument for the %s format is to be treated as an array of bytes. Andreas. 2010-08-31 Andreas Schwab [BZ #6530] * stdio-common/vfprintf.c (process_string_arg): Revert 2000-07-22 change. --- stdio-common/vfprintf.c | 40 ++++------------------------------------ 1 files changed, 4 insertions(+), 36 deletions(-) diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 6e0e85c..bd2609e 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1991-2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -1160,41 +1160,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) else if (!is_long && spec != L_('S')) \ { \ if (prec != -1) \ - { \ - /* Search for the end of the string, but don't search past \ - the length (in bytes) specified by the precision. Also \ - don't use incomplete characters. */ \ - if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX) == 1) \ - len = __strnlen (string, prec); \ - else \ - { \ - /* In case we have a multibyte character set the \ - situation is more complicated. We must not copy \ - bytes at the end which form an incomplete character. */\ - size_t ignore_size = (unsigned) prec > 1024 ? 1024 : prec;\ - wchar_t ignore[ignore_size]; \ - const char *str2 = string; \ - const char *strend = string + prec; \ - if (strend < string) \ - strend = (const char *) UINTPTR_MAX; \ - \ - mbstate_t ps; \ - memset (&ps, '\0', sizeof (ps)); \ - \ - while (str2 != NULL && str2 < strend) \ - if (__mbsnrtowcs (ignore, &str2, strend - str2, \ - ignore_size, &ps) == (size_t) -1) \ - { \ - done = -1; \ - goto all_done; \ - } \ - \ - if (str2 == NULL) \ - len = strlen (string); \ - else \ - len = str2 - string - (ps.__count & 7); \ - } \ - } \ + /* Search for the end of the string, but don't search past \ + the length (in bytes) specified by the precision. */ \ + len = __strnlen (string, prec); \ else \ len = strlen (string); \ } \ -- 1.7.2.2 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." From schwab@redhat.com Tue Aug 31 13:39:00 2010 From: schwab@redhat.com (Andreas Schwab) Date: Tue, 31 Aug 2010 13:39:00 -0000 Subject: [PATCH] Fix array overflow in floating point parser Message-ID: 2010-08-31 Andreas Schwab [BZ #7066] * stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix array overflow when shifting retval into place. --- stdlib/strtod_l.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index cde1280..537d1fb 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1491,7 +1491,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) register int i; (void) __mpn_lshift (&retval[used / BITS_PER_MP_LIMB], - retval, RETURN_LIMB_SIZE, + retval, + (RETURN_LIMB_SIZE + - used / BITS_PER_MP_LIMB), used % BITS_PER_MP_LIMB); for (i = used / BITS_PER_MP_LIMB - 1; i >= 0; --i) retval[i] = 0; -- 1.7.2.2 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different."