From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FFF9385626E; Mon, 23 May 2022 20:47:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FFF9385626E From: "adhemerval.zanella at linaro dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/29147] getconf: Wrong values for symbolic constants defined in limits.h Date: Mon, 23 May 2022 20:47:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.34 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: adhemerval.zanella at linaro dot org 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: Message-ID: In-Reply-To: References: 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 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2022 20:47:43 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29147 --- Comment #4 from Adhemerval Zanella --- (In reply to cquike from comment #3) > Thanks Adhemerval for your comments. >=20 > I agree that the documentation of getconf is not very clear on what the t= ool > is supposed to deliver. >=20 > So I see three possible options for this isse: >=20 > 1. Keep the status quo. The current GNU getconf is not POSIX compliant wi= th > the command of the same name (although to be fair the documentation doesn= 't > claim it is). The problem I see is that according to the documentation (m= an > getconf) the value returned by getconf corresponds to a system configurat= ion > var as defined by pathconfig. However, pathconfig in Linux does not define > _POSIX_PIPE_BUF. It is simply not possible to get the value of > _POSIX_PIPE_BUF using pathconfig. Interestingly, the Linux pathconfig > manpage does actually refer to _POSIX_PIPE_BUF as the minimum value that = can > be used for a pipe buffer, clearly distinguishing it from _PC_PIPE_BUF, > which is the value that applications might want to use get "more liberal > values". So in that sense, at least under Linux, the behaviour of GNU > version of getconf is inconsistent with the documentation (man getconf, m= an > pathconfig). Keep in mind that man-pages is not the canonical documentation. POSIX standard also defines that for getconf each configuration variable=20 shall be determined as if it were obtained by calling the function from which it is defined to be available (either fpathconf, sysconf, or confstr) [1]. And for fpathconf, POSIX only defines a handfull of symbolic constants an=20 implementation should support (which _POSIX_PIPE_BUF is not listed). Also= =20 for _POSIX_PIPE_BUF, it means the 'Maximum number of bytes that is guarante= ed=20 to be atomic when writing to a pipe'. So I do not agree that glibc getconf is not POSIX compliant with current PO= SIX=20 requirements, neither that returning a value different than _PC_PIPE_BUF for _POSIX_PIPE_BUF makes much sense, since it is the system obtained value the= one=20 that actually matters. >=20 > 2. Change the behaviour to follow the POSIX standard. As you pointed out > this might be a bit tricky since it could break expectations from existing > applications. However, it could be argued, that applications that request > the value of _POSIX_PIPE_BUF do really care about getting the POSIX > behaviour. They are basically requesting the minimum value of the pipe > buffer for _any_ POSIX compliant implementation. So in that sense that > variable is quite related to POSIX, otherwise there is no much point on > asking for it rather than _PC_PIPE_BUF. In the case this change takes pla= ce, > the documentation should clearly state the differences with previous > behaviour under the section BUGS. This does not make sense, if user issues 'getconf _POSIX_PIPE_BUF ' and the system defined a minimum value that is larger than what POSIX defin= es as the minimum value; the implementation does follow POSIX since 'conforming implementation shall provide a value at least this large or=20 shall have no limit' [1]. I am still not really convinced that getconf should return any value defined in limits.h, since for the users perspective what really matters is the=20 implementation-defined one and whether it supports the minimal POSIX values or not (for the limits.h a conforming implementation should support the minimum set anyway). >=20 > 3. Similar to other GNU utilities, change the behaviour to either 1. or 2. > depending on POSIXLY_CORRECT environmental variable being defined or not. And I don't think this will make getconf more POSIX compliant, since POSIX does not state POSIXLY_CORRECT as an affecting environment variable.=20 >=20 > Let me know your thoughts on that. [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/getconf.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.ht= ml [3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html --=20 You are receiving this mail because: You are on the CC list for the bug.=