Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: precmd: write error: interrupted

On Apr 25, 10:05pm, Yuri D'Elia wrote:
} I actually tried to set SA_RESTART only when installing the handler for 
} SIGWINCH when debugging [1]. It works in this case, but I'm not entirely 
} sure it is side-effect free (is doing an ioctl on the tty safe while 
} mid-write?).
} What other syscalls would be interrupted by SIGWINCH that shouldn't be 
} restarted? Right now I cannot think of anything that SIGWINCH should 
} interrupt.

I've been thinking about this, and the problem with using SA_RESTART is

(1) [Minor] Some platforms don't have restartable syscalls, so this won't
work everywhere.  But perhaps the intersection of non-restarable syscalls
and support for SIGWINCH is empty.

(2) [Potentially major] A user-defined trap can be installed for the
SIGWINCH signal.  That means arbitrary shell code might execute during
handling of the signal, so all sorts of things might happen mid-write,
not just the default ioctls.

We're not especially POSIX-beholden but it would also be best if we can
preserve the POSIX rules governing trap handlers.  There may not be any
conflict with that here, but it needs to be kept in mind.

} [1] interestingly enough, why "interact" is tested for the Sunos4 case?

I have a vague recollection that it has something to do with the way
STREAMS i/o drivers interoperate with terminals, but I could be entirely

Messages sorted by: Reverse Date, Date, Thread, Author