public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
* [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return
@ 2012-06-15  3:49 law at redhat dot com
  2014-06-19 14:44 ` [Bug localedata/14247] " fweimer at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: law at redhat dot com @ 2012-06-15  3:49 UTC (permalink / raw)
  To: libc-locales

http://sourceware.org/bugzilla/show_bug.cgi?id=14247

             Bug #: 14247
           Summary: newlocale doesn't always set errno upon failure return
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: localedata
        AssignedTo: unassigned@sourceware.org
        ReportedBy: law@redhat.com
                CC: libc-locales@sources.redhat.com
    Classification: Unclassified


Created attachment 6449
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6449
Potential fix

newlocale() neglects to set errno to an appropriate value when failing, if it
has already been asked about the same incorrect locale name.

#include <stdio.h>
#include <errno.h>
#include <locale.h>

int
main(int argc, char **argv)
{
  locale_t loc;

  setlocale(LC_ALL, "C");

  errno = 0;
  loc = newlocale(LC_COLLATE_MASK | LC_CTYPE_MASK,
          "nb_no.utf8",
          0);
  printf("result = %p errno = %d\n", loc, errno);

  errno = 0;
  loc = newlocale(LC_COLLATE_MASK | LC_CTYPE_MASK,
          "nb_no.utf8",
          0);
  printf("result = %p errno = %d\n", loc, errno);

  return 0;
}


Actual results:
result = (nil) errno = 2
result = (nil) errno = 0

Expected results:
result = (nil) errno = 2
result = (nil) errno = 2     (or at least something other than 0)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug localedata/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
@ 2014-06-19 14:44 ` fweimer at redhat dot com
  2015-08-27 22:00 ` [Bug locale/14247] " jsm28 at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2014-06-19 14:44 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
  2014-06-19 14:44 ` [Bug localedata/14247] " fweimer at redhat dot com
@ 2015-08-27 22:00 ` jsm28 at gcc dot gnu.org
  2021-05-23 17:43 ` kristian.spangsege at gmail dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-08-27 22:00 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|localedata                  |locale

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
  2014-06-19 14:44 ` [Bug localedata/14247] " fweimer at redhat dot com
  2015-08-27 22:00 ` [Bug locale/14247] " jsm28 at gcc dot gnu.org
@ 2021-05-23 17:43 ` kristian.spangsege at gmail dot com
  2023-12-01 13:35 ` carlos at redhat dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kristian.spangsege at gmail dot com @ 2021-05-23 17:43 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

kristian.spangsege at gmail dot com <kristian.spangsege at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kristian.spangsege at gmail dot co
                   |                            |m

--- Comment #1 from kristian.spangsege at gmail dot com <kristian.spangsege at gmail dot com> ---
This bug is still present in GLIBC 2.31

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (2 preceding siblings ...)
  2021-05-23 17:43 ` kristian.spangsege at gmail dot com
@ 2023-12-01 13:35 ` carlos at redhat dot com
  2023-12-01 17:12 ` carlos at redhat dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2023-12-01 13:35 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |carlos at redhat dot com
                 CC|                            |carlos at redhat dot com
             Status|NEW                         |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (3 preceding siblings ...)
  2023-12-01 13:35 ` carlos at redhat dot com
@ 2023-12-01 17:12 ` carlos at redhat dot com
  2023-12-01 17:26 ` schwab@linux-m68k.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2023-12-01 17:12 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
The fix is incomplete since when multiple paths are part of the lookup the test
case still fails.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (4 preceding siblings ...)
  2023-12-01 17:12 ` carlos at redhat dot com
@ 2023-12-01 17:26 ` schwab@linux-m68k.org
  2023-12-01 17:39 ` carlos at redhat dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2023-12-01 17:26 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #6449|0                           |1
           is patch|                            |
   Attachment #6449|application/octet-stream    |text/plain
          mime type|                            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (5 preceding siblings ...)
  2023-12-01 17:26 ` schwab@linux-m68k.org
@ 2023-12-01 17:39 ` carlos at redhat dot com
  2024-02-27 15:36 ` carlos at redhat dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2023-12-01 17:39 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

--- Comment #3 from Carlos O'Donell <carlos at redhat dot com> ---
Created attachment 15233
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15233&action=edit
0001-locale-Handle-loading-a-missing-locale-twice-Bug-142.patch

Fixes both locations that need fixing.

Adds a test case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (6 preceding siblings ...)
  2023-12-01 17:39 ` carlos at redhat dot com
@ 2024-02-27 15:36 ` carlos at redhat dot com
  2024-02-27 15:39 ` carlos at redhat dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2024-02-27 15:36 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

--- Comment #4 from Carlos O'Donell <carlos at redhat dot com> ---
Final patch posted:
https://patchwork.sourceware.org/project/glibc/patch/20240227153513.1790813-1-carlos@redhat.com/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (7 preceding siblings ...)
  2024-02-27 15:36 ` carlos at redhat dot com
@ 2024-02-27 15:39 ` carlos at redhat dot com
  2024-02-27 15:40 ` carlos at redhat dot com
  2024-02-27 15:41 ` carlos at redhat dot com
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2024-02-27 15:39 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=827510

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (8 preceding siblings ...)
  2024-02-27 15:39 ` carlos at redhat dot com
@ 2024-02-27 15:40 ` carlos at redhat dot com
  2024-02-27 15:41 ` carlos at redhat dot com
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2024-02-27 15:40 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=2252433

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug locale/14247] newlocale doesn't always set errno upon failure return
  2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
                   ` (9 preceding siblings ...)
  2024-02-27 15:40 ` carlos at redhat dot com
@ 2024-02-27 15:41 ` carlos at redhat dot com
  10 siblings, 0 replies; 12+ messages in thread
From: carlos at redhat dot com @ 2024-02-27 15:41 UTC (permalink / raw)
  To: libc-locales

https://sourceware.org/bugzilla/show_bug.cgi?id=14247

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=832516

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-27 15:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15  3:49 [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return law at redhat dot com
2014-06-19 14:44 ` [Bug localedata/14247] " fweimer at redhat dot com
2015-08-27 22:00 ` [Bug locale/14247] " jsm28 at gcc dot gnu.org
2021-05-23 17:43 ` kristian.spangsege at gmail dot com
2023-12-01 13:35 ` carlos at redhat dot com
2023-12-01 17:12 ` carlos at redhat dot com
2023-12-01 17:26 ` schwab@linux-m68k.org
2023-12-01 17:39 ` carlos at redhat dot com
2024-02-27 15:36 ` carlos at redhat dot com
2024-02-27 15:39 ` carlos at redhat dot com
2024-02-27 15:40 ` carlos at redhat dot com
2024-02-27 15:41 ` carlos at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).