GNU bug report logs - #70411
[bug] install(1) fails to read /dev/stdin on Darwin

Previous Next

Package: coreutils;

Reported by: Alejandro Colomar <alx <at> kernel.org>

Date: Tue, 16 Apr 2024 05:03:03 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Sergei Trofimovich <slyich <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, Pádraig Brady <P <at> draigBrady.com>, Alejandro Colomar <alx <at> kernel.org>, 70411 <at> debbugs.gnu.org, Eli Schwartz <eschwartz93 <at> gmail.com>
Subject: bug#70411: [bug] install(1) fails to read /dev/stdin on Darwin
Date: Fri, 19 Apr 2024 22:33:00 +0100
On Fri, 19 Apr 2024 00:33:52 -0700
Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 2024-04-18 14:52, Sergei Trofimovich wrote:
> > $ clang simple.c -o simple && echo 42 | ./simple
> > 1: ino=3009428657538693161
> > 2: ino=3009428657538693161
> > 3: ino=1568241705
> > 
> > Note how stat() and fstat() don't agree on inode.
> > 
> > Apparently it's documented in
> > https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fstat.2.html
> > as
> > 
> >    BUGS
> >       Applying fstat to a socket (and thus to a pipe) returns a zero'd buffer,
> >       except for the blocksize field, and a unique device and inode number.  
> 
> The BUGS note simply means that a pipe has a unique inode number, which 
> is what we want. So that's not indicating any problem.
> 
> 
> Oh, I see the problem now.  For a socket or pipe, macOS fstat returns 
> the full 64-bit inode number, whereas macOS stat returns only the low 
> order 32 bits.  In your example, 3009428657538693161 % (2**32) == 
> 1568241705.
> 
> This is a kernel bug in macOS. Can you report it or otherwise arrange to 
> have the kernel bug fixed? I expect that you have better connections 
> with Apple than I do. A proposed patch (relative to xnu-10063.101.15) is 
> attached; I have not tested it as I don't use macOS. Thanks.

I reported it via https://www.apple.com/feedback/macos.html

> Also, I am documenting this macOS bug in Gnulib by installing the second 
> attached patch to Gnulib, and am cc'ing this email to bug-gnulib.

Thank you, Paul!

-- 

  Sergei




This bug report was last modified 1 year and 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.