Re: git: fd9e09cb2ab0 - main - kern: replace several EBADF with EINVAL
- In reply to: Konstantin Belousov : "Re: git: fd9e09cb2ab0 - main - kern: replace several EBADF with EINVAL"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Sep 2025 07:35:41 UTC
On Sat, Sep 13, 2025 at 10:27 PM Konstantin Belousov <kostikbel@gmail.com> wrote: > > On Sat, Sep 13, 2025 at 09:55:52PM +0300, Gleb Popov wrote: > > This change affects following code inside the Qt library: > > https://github.com/qt/qtbase/blob/d6cc7562689d8a07bc933178ea367706ca38e4ac/src/3rdparty/forkfd/forkfd.c#L902 > > > > The code in question expects to receive EBADF when being fed a wrong > > type of the descriptor. Returning EINVAL makes sense to me, so maybe > > we should patch Qt rather than revert this change? > > It is really weird code, calling pdgetpid(2) on random fds. Anyway, please > confirm that the following revert makes the problem go away. It does! > BTW, would it be useful to implement something like waitid(P_PROCDESC) > to eliminate the ugly code you pointed to? From what I gather, yes. The pdgetpid() call there is only used to obtain a PID to pass to wait4. Having waitid(P_PROCDESC) would save us from calling pdgetpid() > commit 4b47521ce2bc4ede52611c268d00ceb1608d959e > Author: Konstantin Belousov <kib@FreeBSD.org> > Date: Sat Sep 13 22:23:27 2025 +0300 > > pdgetpid(2): switch back returning EBADF for non-procdesc fd > > This partially reverts fd9e09cb2ab0, since apparently QT depends on this > specific error code. It seems that it applies pdgetpid() to random fds > and filters non-procdescs by checking errno for EBADF. > > Reported by: gleb That's a different Gleb, my freefall handle is arrowd. But anyways, the original report came from "Kenneth Raplee <kenrap@kennethraplee.com>".