Subject: bug#70411: [bug] install(1) fails to read /dev/stdin on Darwin

From: Pádraig Brady <[email-masked]>
Date: Tue, 16 Apr 2024 20:44:06 +0100

On 16/04/2024 15:47, Alejandro Colomar wrote:
> Hi Pádraig,
> 
> On Tue, Apr 16, 2024 at 03:25:22PM +0100, Pádraig Brady wrote:
>>> What version of darwin is this? I can't repro on Darwin 21.6.0 (MacOSX 12.6).
>>> The issue seems to be that /dev/stdin returns a varying inode which install(1) doesn't like currently
> 
> I don't know.  The reporter didn't tell.  I see you also asked on the
> Github original report.
> 
>> Note that check originally came from:
>> https://github.com/coreutils/coreutils/commit/dea4262fa
>>
>> I suppose we could relax the check as follows, for files of apparent size 0
>> which would cater for this, and others that may also have unstable inodes.
> 
> Hmmmm.  Since you couldn't reprodude it in a recent Darwin, maybe it's
> just a bug in an old Darwin.  And since noone else seems to have met
> this Darwin's bug, maybe we can just ignore it.  (And if it were a
> regression in a more recent Darwin, hopefully they should fix their
> kernel.)
> 
> I'm not happy relaxing a security check, without making sure that there
> are no implications at all.
> 
> I vote for claiming only limited support to such a Darwin system.  I
> already workarounded it in the Linux man-pages, by not piping to
> install(1) in a common task; and nobody else seems to be affected.
> 
> Unless you feel confident that it's perfectly fine to do it.  But I have
> no sympathy for workarounding Darwin bugs here.

I agree if it's older Darwin only, we can ignore.
The version I tested on is 3 years old now though,
so I'm not sure whether the issue is on newer or older.

Note we had similar issue on Solaris,
where we used an fstat() wrapper to adjust things:
https://bugs.gnu.org/35713

A related suggestion was from Marc Chantreux (CC'd)
to support '-' to imply stdin, which would be more portable.
There is some merit to that suggestion too.

cheers,
Pádraig