Re: [Bug-readline] [readline patch, gdb-7.3?] Avoid free from a signal handler [Re: [PATCH] Make interrupting tab-completion safe.]

Jan Kratochvil
2011-07-06T15:46:49Z

On Thu, 30 Jun 2011 16:38:21 +0200, Chet Ramey wrote:
> I have seen cases where the user hits ^C while readline or a filename
> completion function is attempting to traverse a file system on a dead
> NFS server, the signal handler gets hit, but the system call doesn't
> get interrupted. I haven't seen those cases in a while, though.

I have tried to reproduce it but I think it is outside of the scope of
readline and/or gdb.

Running
ip6tables -I INPUT 1 -i lo -p tcp --dport 2049 -j DROP
before rl_filename_completion_function's readdir() call will cause (in strace):

rt_sigaction(SIGINT, {0x6518cb=handle_sigint, [INT], SA_RESTORER|SA_RESTART, 0x7f79cf0bd490}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x65196e=handle_sigquit, [QUIT], SA_RESTORER|SA_RESTART, 0x7f79cf0bd490}, NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[...]
getdents(5, <hang>

and no CTRL-C makes any change. It was mounted
on kernel-2.6.35.13-92.fc14.x86_64 with options:
localhost:/... /... nfs ro,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,soft,proto=tcp6,timeo=600,retrans=2,sec=sys,mountaddr=::1,mountvers=3,mountport=59099,mountproto=udp6,addr=::1 0 0

where I used "intr" but "intr" / "nointr" is not listed at all and man says:
The intr / nointr mount option is deprecated after kernel 2.6.25.
Only SIGKILL can interrupt a pending NFS operation on these kernels,
and if specified, this mount option is ignored to provide backwards
compatibility with older kernels.

> remove the references to _rl_interrupt_immediately

I think _rl_interrupt_immediately should never exist as you cannot do anything
much from the signal handler anyway.
man 7 signak "Async-signal-safe functions"

Thanks,
Jan