bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] retry opening startup files on EINTR


From: Chet Ramey
Subject: Re: [PATCH] retry opening startup files on EINTR
Date: Tue, 20 Feb 2024 11:46:55 -0500
User-agent: Mozilla Thunderbird

On 2/20/24 11:37 AM, Grisha Levit wrote:
On Tue, Feb 20, 2024 at 9:18 AM Chet Ramey <chet.ramey@case.edu> wrote:

Well, depending on when the terminal emulator sends the SIGWINCH, this is
probably a bug in Dropbox or the File Provider code. Bash installs its
SIGWINCH handler with SA_RESTART, and the default disposition is to
discard, so even if a SIGWINCH arrives before bash installs its handler it
should not interrupt open().

I suppose we'll have to work around it.

sigaction(2) says:

     The affected system calls include open(2), read(2), write(2),
     sendto(2), recvfrom(2), sendmsg(2) and recvmsg(2) on a communications
     channel or a slow device (such as a terminal, but not a regular file)

so I guess a SIGWINCH during the open(2) for ~/.bash_profile, etc. can
still get interrupted.

I went by POSIX:

"This flag affects the behavior of interruptible functions; that is, those
specified to fail with errno set to [EINTR]. If set, and a function
specified as interruptible is interrupted by this signal, the function shall restart and shall not fail with [EINTR] unless otherwise specified."

and POSIX does not otherwise specify for open. But I guess the macOS man
page falls under the "otherwise specified" part.

Still have to work around it.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]