linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Bruno Haible <bruno@clisp.org>,
	linux-man@vger.kernel.org, Eric Blake <eblake@redhat.com>
Cc: mtk.manpages@gmail.com, Rich Felker <dalias@aerifal.cx>
Subject: Re: [patch] ptsname.3: Fix description of failure behaviour of ptsname_r
Date: Sat, 25 Apr 2020 21:24:02 +0200	[thread overview]
Message-ID: <f01aae6c-ddd0-ba15-5d6b-cd25d0bc7b4c@gmail.com> (raw)
In-Reply-To: <9623994.qWbdUN1Qb5@omega>

On 1/26/19 2:31 PM, Bruno Haible wrote:
> Hi,
> 
> The Linux man page for ptsname_r, when describing the behaviour in the error
> case, is
>   - not consistent with the future POSIX standard (POSIX Issue 8).
>   - not consistent with musl libc.
> 
> Find attached a patch to
>   - keep it consistent with what glibc does,
>   - make it consistent with musl libc,
>   - make it consistent with the future POSIX standard (POSIX Issue 8).
> 
> Details:
> 
> glibc's implementation of ptsname_r, when it fails, returns the error code
> as return value AND sets errno. See
> https://sourceware.org/git/?p=glibc.git;a=blob;f=login/ptsname.c
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mach/hurd/ptsname.c
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ptsname.c
> 
> musl's implementation of ptsname_r, when it fails, returns the error code
> but does NOT set errno. See
> https://git.musl-libc.org/cgit/musl/tree/src/misc/pty.c
> 
> The proposal to add ptsname_r to POSIX, with text
>   "If successful, the ptsname_r( ) function shall return zero. Otherwise,
>    an error number shall be returned to indicate the error."
> has been accepted for inclusion in POSIX Issue 8.
> http://austingroupbugs.net/view.php?id=508
> 
> Therefore a portable program should look at the return value from ptsname_r,
> NOT the errno value. The current text in the man page suggests to look at
> the errno value, which is wrong (because of musl libc) and not future-proof
> (because of future POSIX).

Thanks, Bruno. Patch (finally) applied.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

           reply	other threads:[~2020-04-25 19:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <9623994.qWbdUN1Qb5@omega>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f01aae6c-ddd0-ba15-5d6b-cd25d0bc7b4c@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=bruno@clisp.org \
    --cc=dalias@aerifal.cx \
    --cc=eblake@redhat.com \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).