From 6c8cc2d3042d0585741452006c29cb21fbba39ea Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 11 Feb 2007 16:21:43 +0000 Subject: Updated to fedora-glibc-20070211T1607 --- ChangeLog | 50 +++++++++++++++ fedora/branch.mk | 4 +- fedora/glibc.spec.in | 8 ++- include/locale.h | 1 + include/resolv.h | 3 + locale/uselocale.c | 3 +- nptl/ChangeLog | 6 ++ nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 2 +- nscd/nscd_helper.c | 16 ++--- po/sv.po | 74 ++++++++++----------- posix/Makefile | 3 +- posix/bug-regex27.c | 64 ++++++++++++++++++ posix/bug-regex28.c | 75 ++++++++++++++++++++++ posix/regcomp.c | 8 +-- resolv/res_init.c | 2 + resolv/res_mkquery.c | 46 +++++++++++++ resolv/res_query.c | 29 +++++++-- resolv/res_send.c | 18 ++++++ resolv/resolv.h | 2 + sysdeps/unix/sysv/linux/x86_64/sysdep.h | 1 - time/Makefile | 5 +- time/strptime_l.c | 11 +++- time/tst-strptime3.c | 55 ++++++++++++++++ 23 files changed, 416 insertions(+), 70 deletions(-) create mode 100644 posix/bug-regex27.c create mode 100644 posix/bug-regex28.c create mode 100644 time/tst-strptime3.c diff --git a/ChangeLog b/ChangeLog index 55f92a09af..1015265873 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +2007-02-09 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Remove incorrect comment. + + * resolv/res_init.c (res_setoptions): Recognize edns0 option. + * resolv/res_mkquery.c: Define __res_nopt. + * resolv/res_query.c (__libc_res_nquery): If RES_USE_EDNS0 is set + try adding EDNS0 record. + * resolv/res_send.c (send_dg): If request failed with FORMERR and + EDNS0 record was send make sure we don't try it again. + * resolv/resolv.h: Define RES_F_EDNS0ERR and RES_USE_EDNS0. + * include/resolv.h: Declare __res_nopt. + +2007-02-08 Jakub Jelinek + + [BZ #3944] + * time/strptime_l.c (__strptime_internal): Set have_mon for + %b/%B/%h. Set have_mon and have_mday if tm_mon and tm_mday + have been computed from tm_yday and tm_year. Don't crash + in day_of_the_week or day_of_the_year if not have_mon + and tm_mon contains bogus value. + * time/Makefile (tests): Add tst-strptime3. + * time/tst-strptime3.c: New test. + +2007-02-05 Jakub Jelinek + + [BZ #3957] + * posix/regcomp.c (parse_bracket_exp): Set '\n' bit rather than '\0' + bit for RE_HAT_LISTS_NOT_NEWLINE. + (build_charclass_op): Remove bogus comment. + * posix/Makefile (tests): Add bug-regex27 and bug-regex28. + * posix/bug-regex27.c: New test. + * posix/bug-regex28.c: New test. + +2007-02-03 Ulrich Drepper + + * po/sv.po: Update from translation team. + +2007-02-02 Ulrich Drepper + + * nscd/nscd_helper.c (open_socket): Minor size optimization. + +2007-02-02 Jakub Jelinek + + * include/locale.h (__uselocale): Add libc_hidden_proto. + * locale/uselocale.c (__uselocale): Add libc_hidden_def. + + * nscd/nscd_helper.c (open_socket): Use __gettimeofday instead of + gettimeofday. + 2007-02-01 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/sysdep.h (PTR_MANGLE): Roll value before diff --git a/fedora/branch.mk b/fedora/branch.mk index 37e8ff5e8f..2270fe47de 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc7 -fedora-sync-date := 2007-02-02 09:23 UTC -fedora-sync-tag := fedora-glibc-20070202T0923 +fedora-sync-date := 2007-02-11 16:07 UTC +fedora-sync-tag := fedora-glibc-20070211T1607 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 14015daa1d..0bb837f848 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 16 +%define glibcrelease 17 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define xenarches i686 athlon %ifarch %{xenarches} @@ -1546,6 +1546,12 @@ rm -f *.filelist* %endif %changelog +* Sun Feb 11 2007 Jakub Jelinek 2.5.90-17 +- RFC2671 support in resolver (#205842) +- fix strptime (BZ#3944) +- fix regcomp with REG_NEWLINE (BZ#3957) +- fix pthread_mutex_timedlock on x86_64 (#228103) + * Fri Feb 2 2007 Jakub Jelinek 2.5.90-16 - add strerror_l - fix application crashes when doing NSS lookups through nscd diff --git a/include/locale.h b/include/locale.h index 5226001929..a296a5f8f6 100644 --- a/include/locale.h +++ b/include/locale.h @@ -4,6 +4,7 @@ extern __typeof (uselocale) __uselocale; libc_hidden_proto (setlocale) +libc_hidden_proto (__uselocale) /* This has to be changed whenever a new locale is defined. */ #define __LC_LAST 13 diff --git a/include/resolv.h b/include/resolv.h index 189e4fb58b..c1c89f0ada 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -48,6 +48,8 @@ extern void res_send_setrhook (res_send_rhook __hook); extern int res_ourserver_p (const res_state __statp, const struct sockaddr_in6 *__inp); extern void __res_iclose (res_state statp, bool free_addr); +extern int __res_nopt(res_state statp, int n0, u_char *buf, int buflen, + int anslen); libc_hidden_proto (__res_ninit) libc_hidden_proto (__res_maybe_init) libc_hidden_proto (__res_nclose) @@ -100,6 +102,7 @@ libresolv_hidden_proto (__ns_name_ntop) libresolv_hidden_proto (__ns_name_unpack) libresolv_hidden_proto (__ns_get16) libresolv_hidden_proto (__ns_get32) +libresolv_hidden_proto (__res_nopt) extern const char *_res_opcodes[]; libresolv_hidden_proto (_res_opcodes) diff --git a/locale/uselocale.c b/locale/uselocale.c index 4e63dabd8e..6a54b58a27 100644 --- a/locale/uselocale.c +++ b/locale/uselocale.c @@ -1,5 +1,5 @@ /* uselocale -- fetch and set the current per-thread locale - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2007 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 @@ -70,4 +70,5 @@ __uselocale (locale_t newloc) return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc; } +libc_hidden_def (__uselocale) weak_alias (__uselocale, uselocale) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 9ee7f8d47d..e78e57c5b9 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2007-02-09 Jakub Jelinek + + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S + (__lll_mutex_timedlock_wait): Use correct pointer when we don't + call into the kernel to delay. + 2007-01-18 Ulrich Drepper * tst-initializers1.c: We want to test the initializers as seen diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index 3783f1ccee..6724ded762 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -164,7 +164,7 @@ __lll_mutex_timedlock_wait: 8: /* NB: %edx == 2 */ xorl %eax, %eax LOCK - cmpxchgl %edx, (%rdi) + cmpxchgl %edx, (%r12) jnz 7f 6: addq $16, %rsp diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index 394b2f86e6..577c6a052a 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -127,6 +127,8 @@ open_socket (request_type type, const char *key, size_t keylen) bool first_try = true; struct timeval tvend; + /* Fake initializing tvend. */ + asm ("" : "=m" (tvend)); while (1) { #ifndef MSG_NOSIGNAL @@ -145,20 +147,18 @@ open_socket (request_type type, const char *key, size_t keylen) /* The daemon is busy wait for it. */ int to; + struct timeval now; + (void) __gettimeofday (&now, NULL); if (first_try) { - gettimeofday (&tvend, NULL); - tvend.tv_sec += 5; + tvend.tv_usec = now.tv_usec; + tvend.tv_sec = now.tv_sec + 5; to = 5 * 1000; first_try = false; } else - { - struct timeval now; - gettimeofday (&now, NULL); - to = ((tvend.tv_sec - now.tv_sec) * 1000 - + (tvend.tv_usec - now.tv_usec) / 1000); - } + to = ((tvend.tv_sec - now.tv_sec) * 1000 + + (tvend.tv_usec - now.tv_usec) / 1000); struct pollfd fds[1]; fds[0].fd = sock; diff --git a/po/sv.po b/po/sv.po index 6aeb308fe5..07d28095b9 100644 --- a/po/sv.po +++ b/po/sv.po @@ -1,13 +1,13 @@ # GNU libc message catalog for swedish # Copyright © 1996, 1998, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. # Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006. -# Revision: 1.52 +# Revision: 1.54 # msgid "" msgstr "" "Project-Id-Version: libc 2.5\n" "POT-Creation-Date: 2006-09-29 11:38-0700\n" -"PO-Revision-Date: 2006-11-09 13:51+0100\n" +"PO-Revision-Date: 2006-12-30 18:53+0100\n" "Last-Translator: Jan Djärv \n" "Language-Team: Swedish \n" "MIME-Version: 1.0\n" @@ -1407,7 +1407,7 @@ msgstr "misslyckades ta status (fstat)" #: inet/rcmd.c:492 msgid "bad owner" -msgstr "olämplig ägare" +msgstr "felaktig ägare" #: inet/rcmd.c:494 msgid "writeable by other than owner" @@ -1451,7 +1451,7 @@ msgstr "teckenuppsättningsfil \"%s\" finns inte" #: locale/programs/charmap.c:194 #, c-format msgid "default character map file `%s' not found" -msgstr "standardteckenuppsättningsfil \"%s\" inte hittad" +msgstr "standardteckenuppsättningsfil \"%s\" finns inte" #: locale/programs/charmap.c:257 #, c-format @@ -1540,7 +1540,7 @@ msgstr "definition av \"%1$s\" slutar inte med \"END %1$s\"" #: locale/programs/charmap.c:642 msgid "only WIDTH definitions are allowed to follow the CHARMAP definition" -msgstr "endast definition av \"WIDTH\" får följa definitionen av \"CHARMAP\"" +msgstr "endast definition av \"WIDTH\" får komma efter definitionen av \"CHARMAP\"" #: locale/programs/charmap.c:650 locale/programs/charmap.c:713 #, c-format @@ -1630,7 +1630,7 @@ msgstr "%s: fält \"%s\" är inte definierat" #: locale/programs/ld-name.c:116 locale/programs/ld-telephone.c:116 #, c-format msgid "%s: field `%s' must not be empty" -msgstr "%s: fält \"%s\" kan inte vara tomt" +msgstr "%s: fält \"%s\" får inte vara tomt" #: locale/programs/ld-address.c:167 #, c-format @@ -1640,7 +1640,7 @@ msgstr "%s: ogiltig kontrollsekvens \"%%%c\" i fält \"%s\" " #: locale/programs/ld-address.c:218 #, c-format msgid "%s: terminology language code `%s' not defined" -msgstr "%s: terminologilandskod \"%s\" inte definierad" +msgstr "%s: terminologispråkkod \"%s\" inte definierad" #: locale/programs/ld-address.c:243 #, c-format @@ -1800,12 +1800,12 @@ msgstr "%s: bytesekvens för första tecknet är inte mindre än den för sista #: locale/programs/ld-collate.c:1273 #, c-format msgid "%s: symbolic range ellipsis must not directly follow `order_start'" -msgstr "%s: symboliskt intervall kan inte vara omedelbart efter \"order_start\"" +msgstr "%s: symboliskt intervall får inte vara omedelbart efter \"order_start\"" #: locale/programs/ld-collate.c:1277 #, c-format msgid "%s: symbolic range ellipsis must not be directly followed by `order_end'" -msgstr "%s: symboliskt intervall kan inte omedelbart följas av \"order_end\"" +msgstr "%s: symboliskt intervall får inte omedelbart följas av \"order_end\"" #: locale/programs/ld-collate.c:1297 locale/programs/ld-ctype.c:1475 #, c-format @@ -2119,7 +2119,7 @@ msgstr "%s: dubbla definitioner av \"default_missing\"" #: locale/programs/ld-ctype.c:2863 msgid "previous definition was here" -msgstr "föregående definition var här" +msgstr "här var föregående definition" #: locale/programs/ld-ctype.c:2885 #, c-format @@ -2354,7 +2354,7 @@ msgstr "avslutande skräp vid radslutet" #: locale/programs/linereader.c:297 msgid "garbage at end of number" -msgstr "skräp i slutet av nummer" +msgstr "skräp i slutet av tal" #: locale/programs/linereader.c:409 msgid "garbage at end of character code specification" @@ -2567,9 +2567,9 @@ msgid "" " locale path : %s\n" "%s" msgstr "" -"Systemets kataloger för teckentabeller: %s\n" -" repertoartabeller: %s\n" -" lokal-sökväg : %s\n" +"Systemets kataloger för teckentabeller : %s\n" +" repertoartabeller: %s\n" +" lokal-sökväg : %s\n" "%s" #: locale/programs/localedef.c:566 @@ -2673,7 +2673,7 @@ msgstr "kan inte lägga till till lokalarkiv" #: locale/programs/locarchive.c:977 #, c-format msgid "locale alias file `%s' not found" -msgstr "fil \"%s\" för lokalalias hittas inte" +msgstr "fil \"%s\" för lokalalias finns inte" #: locale/programs/locarchive.c:1121 #, c-format @@ -2717,7 +2717,7 @@ msgstr "argumentet till \"%s\" måste vara ett enskilt tecken" #: locale/programs/locfile.c:251 msgid "syntax error: not inside a locale definition section" -msgstr "syntaxfel: inte inne i en lokaldefinition" +msgstr "syntaxfel: inte inne i en lokalsektion" #: locale/programs/locfile.c:625 #, c-format @@ -2764,7 +2764,7 @@ msgstr "kan inte spara ny repertoartabell" #: locale/programs/repertoire.c:342 #, c-format msgid "repertoire map file `%s' not found" -msgstr "hittar inte repertoartabell \"%s\"" +msgstr "hittar inte repertoarfiltabell \"%s\"" #: locale/programs/repertoire.c:449 #, c-format @@ -2859,7 +2859,7 @@ msgid "" "For bug reporting instructions, please see:\n" "." msgstr "" -"UsageAnvändning: memusage [FLAGGA]... PROGRAM [PROGRAMFLAGGA]...\n" +"Användning: memusage [FLAGGA]... PROGRAM [PROGRAMFLAGGA]...\n" "Spåra minnesanvändning för PROGRAM.\n" "\n" " -n,--progname=NAMN Namn på program att spåra\n" @@ -2922,7 +2922,7 @@ msgstr "Titelsträng att använda i resultatgrafiken" #: malloc/memusagestat.c:55 msgid "Generate output linear to time (default is linear to number of function calls)" -msgstr "Generera utdata linjär i tiden (standardvärde är linjär mot anta funktionsanrop)" +msgstr "Generera utdata linjär i tiden (standardvärde är linjär mot antal funktionsanrop)" #: malloc/memusagestat.c:57 msgid "Also draw graph for total memory consumption" @@ -2930,11 +2930,11 @@ msgstr "Visa också en graf av totala minnesåtgången" #: malloc/memusagestat.c:58 msgid "make output graphic VALUE pixel wide" -msgstr "gör resultatgrafiken VALUE pixlar bred" +msgstr "gör resultatgrafiken ANTAL pixlar bred" #: malloc/memusagestat.c:59 msgid "make output graphic VALUE pixel high" -msgstr "gör resultatgrafiken VALUE pixlar hög" +msgstr "gör resultatgrafiken ANTAL pixlar hög" #: malloc/memusagestat.c:64 msgid "Generate graphic from memory profiling data" @@ -3016,7 +3016,7 @@ msgstr "Objekt med samma namn existerar" #: nis/nis_error.h:16 msgid "Not master server for this domain" -msgstr "Ingen huvudserver för denna domän" +msgstr "Inte huvudserver för denna domän" #: nis/nis_error.h:17 msgid "Invalid object for operation" @@ -3207,7 +3207,7 @@ msgstr "Huvudserver:\n" #: nis/nis_print.c:175 msgid "Replicate :\n" -msgstr "Replikerad:\n" +msgstr "Replikera:\n" #: nis/nis_print.c:176 #, c-format @@ -3404,7 +3404,7 @@ msgstr "Antal objekt : %u\n" #: nis/nis_print.c:377 #, c-format msgid "Object #%d:\n" -msgstr "Objekt #%d:\n" +msgstr "Objekt nr %d:\n" #: nis/nis_print_group_entry.c:117 #, c-format @@ -3437,7 +3437,7 @@ msgstr " Inga rekursiva medlemmar\n" #: nis/nis_print_group_entry.c:149 nis/nis_print_group_entry.c:165 msgid " Explicit nonmembers:\n" -msgstr " Explicit icke-medlemmar:\n" +msgstr " Explicita icke-medlemmar:\n" #: nis/nis_print_group_entry.c:154 msgid " No explicit nonmembers\n" @@ -3609,7 +3609,7 @@ msgstr "beskär %s cache; tid %ld" #: nscd/cache.c:289 #, c-format msgid "considering %s entry \"%s\", timeout %" -msgstr "överväger %s post \"%s\", tidsgräns %" +msgstr "överväger %s-post \"%s\", tidsgräns %" #: nscd/connections.c:469 nscd/connections.c:481 nscd/connections.c:493 #: nscd/connections.c:512 @@ -3692,7 +3692,7 @@ msgstr "ge åtkomst till FD %d, för %s" #: nscd/connections.c:904 #, c-format msgid "cannot handle old request version %d; current version is %d" -msgstr "Kan inte hantera äldre förfrågansversion %d, nuvarande version är %d" +msgstr "kan inte hantera äldre förfrågansversion %d, nuvarande version är %d" #: nscd/connections.c:954 nscd/connections.c:1007 #, c-format @@ -3851,7 +3851,7 @@ msgstr "Invalidera den angivna cachen" #: nscd/nscd.c:105 msgid "TABLE,yes" -msgstr "TABELL,yes" +msgstr "TABELL,ja" #: nscd/nscd.c:106 msgid "Use separate cache for each user" @@ -5073,7 +5073,7 @@ msgstr "Avbruten (SIGABRT)" #: sysdeps/generic/siglist.h:35 sysdeps/unix/siglist.c:34 msgid "Floating point exception" -msgstr "Aritmetiskt fel" +msgstr "Flyttalsfel" #: sysdeps/generic/siglist.h:36 sysdeps/unix/siglist.c:35 msgid "Killed" @@ -5359,7 +5359,7 @@ msgstr "Kodfil upptagen" #. TRANS File too big; the size of a file would be larger than allowed by the system. #: sysdeps/gnu/errlist.c:307 msgid "File too large" -msgstr "Fil för stor" +msgstr "För stor fil" #. TRANS No space left on device; write operation on a file failed because the #. TRANS disk is full. @@ -5514,7 +5514,7 @@ msgstr "Adressfamiljen stöds inte av protokollet" #. TRANS The requested socket address is already in use. @xref{Socket Addresses}. #: sysdeps/gnu/errlist.c:555 msgid "Address already in use" -msgstr "Adressen upptagen" +msgstr "Adressen redan upptagen" #. TRANS The requested socket address is not available; for example, you tried #. TRANS to give a socket a name that doesn't match the local host name. @@ -5577,7 +5577,7 @@ msgstr "Transportslutpunkten är inte förbunden" #. TRANS without first specifying a destination for the data with @code{connect}. #: sysdeps/gnu/errlist.c:658 msgid "Destination address required" -msgstr "Destination krävs" +msgstr "Destinationsadress krävs" #. TRANS The socket has already been shut down. #: sysdeps/gnu/errlist.c:667 @@ -5612,7 +5612,7 @@ msgstr "För många nivåer av symboliska länkar" #. TRANS @code{sethostname}; @pxref{Host Identification}). #: sysdeps/gnu/errlist.c:717 msgid "File name too long" -msgstr "Filnamn för långt" +msgstr "För långt filnamn" #. TRANS The remote host for a requested network connection is down. #: sysdeps/gnu/errlist.c:726 @@ -6147,7 +6147,7 @@ msgstr "%s: användning är %s [ --version ] [ -v ] [ -c [startår,}slutår ] zo #: timezone/zdump.c:301 #, c-format msgid "%s: wild -c argument %s\n" -msgstr "%s: flaggan -c har okänt argument %s\n" +msgstr "%s: argument \"%s\" till flaggan -c har fel format\n" #: timezone/zdump.c:392 msgid "Error writing to standard output" @@ -6226,7 +6226,7 @@ msgstr "%s: Kan inte länka från %s till %s: %s\n" #: timezone/zic.c:774 timezone/zic.c:776 msgid "same rule name in multiple files" -msgstr "samma regel i flera filer" +msgstr "samma regelnamn i flera filer" #: timezone/zic.c:817 msgid "unruly zone" @@ -6262,7 +6262,7 @@ msgstr "%s: \"Leap\"-rad i fil %s som inte är skottsekundsfil\n" #: timezone/zic.c:904 timezone/zic.c:1325 timezone/zic.c:1350 #, c-format msgid "%s: panic: Invalid l_value %d\n" -msgstr "%s: panik: ogiltigt l_value %d\n" +msgstr "%s: panik: Ogiltigt l_value %d\n" #: timezone/zic.c:912 #, c-format @@ -6292,7 +6292,7 @@ msgstr "namnlös regel" #: timezone/zic.c:991 msgid "invalid saved time" -msgstr "ogiltigt sparad tid" +msgstr "ogiltig sparad tid" #: timezone/zic.c:1010 msgid "wrong number of fields on Zone line" diff --git a/posix/Makefile b/posix/Makefile index 8407ede093..74571cd036 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -81,7 +81,8 @@ tests := tstgetopt testfnm runtests runptests \ bug-regex13 bug-regex14 bug-regex15 bug-regex16 \ bug-regex17 bug-regex18 bug-regex19 bug-regex20 \ bug-regex21 bug-regex22 bug-regex23 bug-regex24 \ - bug-regex25 bug-regex26 tst-nice tst-nanosleep tst-regex2 \ + bug-regex25 bug-regex26 bug-regex27 bug-regex28 \ + tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf \ diff --git a/posix/bug-regex27.c b/posix/bug-regex27.c new file mode 100644 index 0000000000..327acd8684 --- /dev/null +++ b/posix/bug-regex27.c @@ -0,0 +1,64 @@ +/* Test REG_NEWLINE. + Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2007. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +struct tests +{ + const char *regex; + const char *string; + int cflags; + int retval; +} tests[] = { + { "a.b", "a\nb", REG_EXTENDED | REG_NEWLINE, REG_NOMATCH }, + { "a.b", "a\nb", REG_EXTENDED, 0 }, + { "a[^x]b", "a\nb", REG_EXTENDED | REG_NEWLINE, REG_NOMATCH }, + { "a[^x]b", "a\nb", REG_EXTENDED, 0 } +}; + +int +main (void) +{ + regex_t r; + size_t i; + int ret = 0; + + for (i = 0; i < sizeof (tests) / sizeof (tests[i]); ++i) + { + memset (&r, 0, sizeof (r)); + if (regcomp (&r, tests[i].regex, tests[i].cflags)) + { + printf ("regcomp %zd failed\n", i); + ret = 1; + continue; + } + int rv = regexec (&r, tests[i].string, 0, NULL, 0); + if (rv != tests[i].retval) + { + printf ("regexec %zd unexpected value %d != %d\n", + i, rv, tests[i].retval); + ret = 1; + } + regfree (&r); + } + return ret; +} diff --git a/posix/bug-regex28.c b/posix/bug-regex28.c new file mode 100644 index 0000000000..e58a08fabe --- /dev/null +++ b/posix/bug-regex28.c @@ -0,0 +1,75 @@ +/* Test RE_HAT_LISTS_NOT_NEWLINE and RE_DOT_NEWLINE. + Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2007. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +struct tests +{ + const char *regex; + const char *string; + reg_syntax_t syntax; + int retval; +} tests[] = { +#define EGREP RE_SYNTAX_EGREP +#define EGREP_NL (RE_SYNTAX_EGREP | RE_DOT_NEWLINE) & ~RE_HAT_LISTS_NOT_NEWLINE + { "a.b", "a\nb", EGREP, -1 }, + { "a.b", "a\nb", EGREP_NL, 0 }, + { "a[^x]b", "a\nb", EGREP, -1 }, + { "a[^x]b", "a\nb", EGREP_NL, 0 }, + /* While \S and \W are internally handled as [^[:space:]] and [^[:alnum:]_], + RE_HAT_LISTS_NOT_NEWLINE did not make any difference, so ensure + it doesn't change. */ + { "a\\Sb", "a\nb", EGREP, -1 }, + { "a\\Sb", "a\nb", EGREP_NL, -1 }, + { "a\\Wb", "a\nb", EGREP, 0 }, + { "a\\Wb", "a\nb", EGREP_NL, 0 } +}; + +int +main (void) +{ + struct re_pattern_buffer r; + size_t i; + int ret = 0; + + for (i = 0; i < sizeof (tests) / sizeof (tests[i]); ++i) + { + re_set_syntax (tests[i].syntax); + memset (&r, 0, sizeof (r)); + if (re_compile_pattern (tests[i].regex, strlen (tests[i].regex), &r)) + { + printf ("re_compile_pattern %zd failed\n", i); + ret = 1; + continue; + } + size_t len = strlen (tests[i].string); + int rv = re_search (&r, tests[i].string, len, 0, len, NULL); + if (rv != tests[i].retval) + { + printf ("re_search %zd unexpected value %d != %d\n", + i, rv, tests[i].retval); + ret = 1; + } + regfree (&r); + } + return ret; +} diff --git a/posix/regcomp.c b/posix/regcomp.c index 78a1218cf8..e99fd74924 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc. + Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -3019,7 +3019,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, #endif /* not RE_ENABLE_I18N */ non_match = 1; if (syntax & RE_HAT_LISTS_NOT_NEWLINE) - bitset_set (sbcset, '\0'); + bitset_set (sbcset, '\n'); re_string_skip_bytes (regexp, token_len); /* Skip a token. */ token_len = peek_token_bracket (token, regexp, syntax); if (BE (token->type == END_OF_RE, 0)) @@ -3549,10 +3549,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, if (non_match) { #ifdef RE_ENABLE_I18N - /* - if (syntax & RE_HAT_LISTS_NOT_NEWLINE) - bitset_set(cset->sbcset, '\0'); - */ mbcset->non_match = 1; #endif /* not RE_ENABLE_I18N */ } diff --git a/resolv/res_init.c b/resolv/res_init.c index b5a03d1883..640e087920 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -510,6 +510,8 @@ res_setoptions(res_state statp, const char *options, const char *source) { } else if (!strncmp(cp, "no-check-names", sizeof("no-check-names") - 1)) { statp->options |= RES_NOCHECKNAME; + } else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) { + statp->options |= RES_USE_EDNS0; } else { /* XXX - print a warning here? */ } diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c index fd80569fe2..3fa597fecd 100644 --- a/resolv/res_mkquery.c +++ b/resolv/res_mkquery.c @@ -208,3 +208,49 @@ res_nmkquery(res_state statp, return (cp - buf); } libresolv_hidden_def (res_nmkquery) + + +/* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */ +#ifndef T_OPT +#define T_OPT 41 +#endif + +int +__res_nopt(res_state statp, + int n0, /* current offset in buffer */ + u_char *buf, /* buffer to put query */ + int buflen, /* size of buffer */ + int anslen) /* UDP answer buffer size */ +{ + u_int16_t flags = 0; + +#ifdef DEBUG + if ((statp->options & RES_DEBUG) != 0U) + printf(";; res_nopt()\n"); +#endif + + HEADER *hp = (HEADER *) buf; + u_char *cp = buf + n0; + u_char *ep = buf + buflen; + + if ((ep - cp) < 1 + RRFIXEDSZ) + return -1; + + *cp++ = 0; /* "." */ + + ns_put16(T_OPT, cp); /* TYPE */ + cp += INT16SZ; + ns_put16(anslen & 0xffff, cp); /* CLASS = UDP payload size */ + cp += INT16SZ; + *cp++ = NOERROR; /* extended RCODE */ + *cp++ = 0; /* EDNS version */ + /* XXX Once we support DNSSEC we change the flag value here. */ + ns_put16(flags, cp); + cp += INT16SZ; + ns_put16(0, cp); /* RDLEN */ + cp += INT16SZ; + hp->arcount = htons(ntohs(hp->arcount) + 1); + + return cp - buf; +} +libresolv_hidden_def (__res_nopt) diff --git a/resolv/res_query.c b/resolv/res_query.c index 85bad97d2d..4371af5b05 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -120,10 +120,13 @@ __libc_res_nquery(res_state statp, u_char *buf; HEADER *hp = (HEADER *) answer; int n, use_malloc = 0; + u_int oflags = statp->_flags; - hp->rcode = NOERROR; /* default */ + size_t bufsize = QUERYSIZE; + buf = alloca (bufsize); - buf = alloca (QUERYSIZE); + again: + hp->rcode = NOERROR; /* default */ #ifdef DEBUG if (statp->options & RES_DEBUG) @@ -131,18 +134,30 @@ __libc_res_nquery(res_state statp, #endif n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL, - buf, QUERYSIZE); - if (__builtin_expect (n <= 0, 0)) { + buf, bufsize); + if (n > 0 + && (oflags & RES_F_EDNS0ERR) == 0 + && (statp->options & RES_USE_EDNS0) != 0) + n = __res_nopt(statp, n, buf, bufsize, anslen); + if (__builtin_expect (n <= 0, 0) && !use_malloc) { /* Retry just in case res_nmkquery failed because of too short buffer. Shouldn't happen. */ - buf = malloc (MAXPACKET); + bufsize = MAXPACKET; + buf = malloc (bufsize); if (buf != NULL) { use_malloc = 1; - n = res_nmkquery(statp, QUERY, name, class, type, NULL, - 0, NULL, buf, MAXPACKET); + goto again; } } if (__builtin_expect (n <= 0, 0)) { + /* If the query choked with EDNS0, retry without EDNS0. */ + if ((statp->options & RES_USE_EDNS0) != 0 + && ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) { + statp->_flags |= RES_F_EDNS0ERR; + if (statp->options & RES_DEBUG) + printf(";; res_nquery: retry without EDNS0\n"); + goto again; + } #ifdef DEBUG if (statp->options & RES_DEBUG) printf(";; res_query: mkquery failed\n"); diff --git a/resolv/res_send.c b/resolv/res_send.c index 887d048e19..f38c399ffd 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -986,6 +986,24 @@ send_dg(res_state statp, ans, (resplen > anssiz) ? anssiz : resplen); goto wait; } +#ifdef RES_USE_EDNS0 + if (anhp->rcode == FORMERR + && (statp->options & RES_USE_EDNS0) != 0U) { + /* + * Do not retry if the server do not understand + * EDNS0. The case has to be captured here, as + * FORMERR packet do not carry query section, hence + * res_queriesmatch() returns 0. + */ + DprintQ(statp->options & RES_DEBUG, + (stdout, + "server rejected query with EDNS0:\n"), + ans, (resplen > anssiz) ? anssiz : resplen); + /* record the error */ + statp->_flags |= RES_F_EDNS0ERR; + goto err_out; + } +#endif if (!(statp->options & RES_INSECURE2) && !res_queriesmatch(buf, buf + buflen, ans, ans + anssiz)) { diff --git a/resolv/resolv.h b/resolv/resolv.h index d7cda117fd..9aa09b8701 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -180,6 +180,7 @@ struct res_sym { */ #define RES_F_VC 0x00000001 /* socket is TCP */ #define RES_F_CONN 0x00000002 /* socket is connected */ +#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ /* res_findzonecut() options */ #define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ @@ -209,6 +210,7 @@ struct res_sym { strings */ #define RES_NOIP6DOTINT 0x00080000 /* Do not use .ip6.int in IPv6 reverse lookup */ +#define RES_USE_EDNS0 0x00100000 /* Use EDNS0. */ #define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 3a0a632aab..1d9a68a046 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -182,7 +182,6 @@ The Linux kernel uses and destroys internally these registers: return address from syscall rcx - additionally clobered: r12-r15,rbx,rbp eflags from syscall r11 Normal function call, including calls to the system call stub diff --git a/time/Makefile b/time/Makefile index d93b84bb2f..8ce34e4565 100644 --- a/time/Makefile +++ b/time/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1991-2003, 2004, 2005, 2007 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 @@ -35,7 +35,8 @@ distribute := datemsk tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \ tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \ - tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 + tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \ + tst-strptime3 include ../Rules diff --git a/time/strptime_l.c b/time/strptime_l.c index dc0cc686fd..443a6fa88e 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004, 2005, 2007 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 @@ -400,6 +400,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM) /* Does not match a month name. */ return NULL; tm->tm_mon = cnt; + have_mon = 1; want_xday = 1; break; case 'c': @@ -1085,11 +1086,15 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM) tm->tm_mday = (tm->tm_yday - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1); + have_mon = 1; + have_mday = 1; } - day_of_the_week (tm); + /* Don't crash in day_of_the_week if tm_mon is uninitialized. */ + if (have_mon || (unsigned) tm->tm_mon <= 11) + day_of_the_week (tm); } - if (want_xday && !have_yday) + if (want_xday && !have_yday && (have_mon || (unsigned) tm->tm_mon <= 11)) day_of_the_year (tm); if ((have_uweek || have_wweek) && have_wday) diff --git a/time/tst-strptime3.c b/time/tst-strptime3.c new file mode 100644 index 0000000000..9a8c6485e7 --- /dev/null +++ b/time/tst-strptime3.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include + + +int +main (void) +{ + int result = 0; + struct tm tm; + + memset (&tm, 0xaa, sizeof (tm)); + + /* Test we don't crash on uninitialized struct tm. + Some fields might contain bogus values until everything + needed is initialized, but we shouldn't crash. */ + if (strptime ("2007", "%Y", &tm) == NULL + || strptime ("12", "%d", &tm) == NULL + || strptime ("Feb", "%b", &tm) == NULL + || strptime ("13", "%M", &tm) == NULL + || strptime ("21", "%S", &tm) == NULL + || strptime ("16", "%H", &tm) == NULL) + { + puts ("strptimes failed"); + result = 1; + } + + if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 + || tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107 + || tm.tm_wday != 1 || tm.tm_yday != 42) + { + puts ("unexpected tm content"); + result = 1; + } + + if (strptime ("8", "%d", &tm) == NULL) + { + puts ("strptime failed"); + result = 1; + } + + if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 + || tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107 + || tm.tm_wday != 4 || tm.tm_yday != 38) + { + puts ("unexpected tm content"); + result = 1; + } + + if (result == 0) + puts ("all OK"); + + return 0; +} -- cgit v1.2.3