public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug locale/31143] New: Let iconv_open return EMFILE if RLIMIT_NOFILE is hit
@ 2023-12-12  2:00 jengelh at inai dot de
  2023-12-12  9:26 ` [Bug locale/31143] " fweimer at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jengelh at inai dot de @ 2023-12-12  2:00 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 31143
           Summary: Let iconv_open return EMFILE if RLIMIT_NOFILE is hit
           Product: glibc
           Version: 2.38
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: jengelh at inai dot de
  Target Milestone: ---

Consider a program that opens a lot of file descriptors, by chance so happens
to stay just barely under the limit, and at some point uses iconv_open.
Pathalogical testcase:

#include <iconv.h>
#include <sys/resource.h>
#include <stdio.h>
int main()
{
        struct rlimit rl = {3,3};
        if (setrlimit(RLIMIT_NOFILE, &rl) != 0) 
                perror("setrlimit");

        iconv_t cd = iconv_open("UTF-8", "windows-1254//IGNORE");
        if (cd == (iconv_t)-1)
                perror("iconv_open");
}

== Observed behavior

On a typical linux-glibc system, this will report:

       iconv_open: Invalid argument

== Expected

       iconv_open: Too many files open

glibc iconv is implemented with shared plugins (/usr/lib/gconv), thus the
implementation is susceptible to fd limits. Though EINVAL is not incorrect per
se (no module loaded - no charset available), it could help the admin to see an
EMFILE errno.

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

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

* [Bug locale/31143] Let iconv_open return EMFILE if RLIMIT_NOFILE is hit
  2023-12-12  2:00 [Bug locale/31143] New: Let iconv_open return EMFILE if RLIMIT_NOFILE is hit jengelh at inai dot de
@ 2023-12-12  9:26 ` fweimer at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: fweimer at redhat dot com @ 2023-12-12  9:26 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |22040
                 CC|                            |fweimer at redhat dot com

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
This depends on accurate tracking of errno values from system calls during
dlopen (and, ugh, dlsym).


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=22040
[Bug 22040] dlopen: Provide more information on the root cause of a failure
-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-12-12  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12  2:00 [Bug locale/31143] New: Let iconv_open return EMFILE if RLIMIT_NOFILE is hit jengelh at inai dot de
2023-12-12  9:26 ` [Bug locale/31143] " fweimer 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).