From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16FED3858C5F; Tue, 12 Dec 2023 02:00:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16FED3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702346434; bh=5NWqmXmNADPrZSvWZq2hSfTBK3Q7awOasv3oDYxCNCs=; h=From:To:Subject:Date:From; b=drBhOQwWzgmfUgp8H0QwLPTLZ8y9PEYiBnRQwHC3OMxOoZJrJwU0kI/aB3ZfHlysk WDhx2kGTXNTWxmYKdaa/EwaDvg0CgSRQ9uU5G6LxvHFfh0Zeum8/upWSQvtEonXMEw 6/BCTytbG1aHoI3xiNkHn9KrO0xzDQb9ypWevRPg= From: "jengelh at inai dot de" To: glibc-bugs@sourceware.org Subject: [Bug locale/31143] New: Let iconv_open return EMFILE if RLIMIT_NOFILE is hit Date: Tue, 12 Dec 2023 02:00:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: locale X-Bugzilla-Version: 2.38 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jengelh at inai dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31143 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 happe= ns to stay just barely under the limit, and at some point uses iconv_open. Pathalogical testcase: #include #include #include int main() { struct rlimit rl =3D {3,3}; if (setrlimit(RLIMIT_NOFILE, &rl) !=3D 0)=20 perror("setrlimit"); iconv_t cd =3D iconv_open("UTF-8", "windows-1254//IGNORE"); if (cd =3D=3D (iconv_t)-1) perror("iconv_open"); } =3D=3D Observed behavior On a typical linux-glibc system, this will report: iconv_open: Invalid argument =3D=3D 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 se= e an EMFILE errno. --=20 You are receiving this mail because: You are on the CC list for the bug.=