On Wed, Mar 4, 2020 at 4:09 PM Ian Lance Taylor <i...@golang.org> wrote:
>
> The links that I looked at were speculating about behavior, not
> demonstrating real behavior in kernels.  I don't know how to judge
> whether those speculations about hypothetical behavior are correct or
> not.  Many things are hypothetically possible.  I'm just saying that
> before changing any code I would need to see actual evidence that some
> kernel behaves in that way, not just speculation that it might.

If they were demonstrating real behavior in kernels, I wouldn't be asking.
I had already wrapped all of my dup2's inside retry loops when I came
across that part of the python source which recommends not to do it
because it would cause problems; then I started having doubts.
I reiterated their theory here in response to the feedback only
because I was trying to make my question understood. I'm not
suggesting to change any code nor to act on speculation.

> In practice, if you don't use a FUSE file system, I bet that you will
> never see an EINTR error from dup2.

In Linux it seems that it can't happen regardless of the filesystem,
but I would prefer to leave a little slack if the man page says
otherwise.
I would also like to handle FUSE file systems as gracefully as possible.

> That goes double for Go programs, as the Go runtime installs all
> signal handlers with SA_RESTART set.

Unfortunately the signal(7) man page doesn't tell if dup2 (or even
close) are affected by SA_RESTART.

> This isn't worth all that much, but using the os/exec package to start
> a new program will use dup2 to set up file descriptors.

Good to know. I did try to search for "syscall.Dup2" in the Go source
but that's not how dup2 is called; now I've found some.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEvMKD_OtXm-kQtda346DsUNcx%3Duj4ygZbDZRL7m%2Br%3DFrWexhg%40mail.gmail.com.

Reply via email to