Subject: Re: bug#29038: df hangs on fifos/named pipes
From: Pádraig Brady <[email-masked]>
To: Paul Eggert <[email-masked]>, Stephane Chazelas <[email-masked]>, [email-masked]
Cc: Martijn Dekker <[email-masked]>
Date: Mon, 30 Oct 2017 09:53:01 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 29/10/17 23:16, Paul Eggert wrote:
> Pádraig Brady wrote:
> 
>> I suppose we could stat() and if that succeeds && !fifo, only then call open() ?
>> Patch to do that is attached.
> 
> Better is to use open with O_NONBLOCK, as this avoids interpreting the file name 
> twice in the usual case. Better yet is to use O_PATH if available, as this 
> avoids interpreting the file name twice even when the file is unreadable or is a 
> FIFO that would block. Also, the comment just before the code should be changed 
> to match the altered code. Proposed followup patch attached.
> 
> It is puzzling that df calls fstat or stat, when it should just be calling 
> fstatfs or statfs. But that is a different matter.

I pushed my change with the comments fixed up.

I thought about O_NONBLOCK and O_PATH but thought these might not
induce or wait for the auto mount to occur.

thanks for the review,
Pádraig

marking this as done...