tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
237 stars 42 forks source link

rmstar hangs #5

Closed fanto666 closed 5 years ago

fanto666 commented 6 years ago

when "set rmstar" is set and user issues "rm *", tcsh asks for confirmation and nothing more happens.

Apparently effect of https://github.com/tcsh-org/tcsh/commit/b3933b3364549c0ea451b918e0d20185444ef29

reported as debian bug 878442 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878442

strace reports:

% strace -f -p 15115 strace: Process 15115 attached read(16, "\n", 1) = 1 write(17, "\r\n", 2) = 2 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2338, ...}) = 0 rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0 ioctl(16, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0 ioctl(16, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0 ioctl(16, TCGETS, {B38400 opost isig icanon echo ...}) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 alarm(0) = 0 write(17, "Do you really want to delete all"..., 46) = 46 read(16, "y", 1) = 1 read(16, "\n", 1) = 1 read(16, "y", 1) = 1 read(16, "\n", 1) = 1 read(16,

zoulasc commented 6 years ago

Can't reproduce it:

./tcsh -f

@ addsuffix anyerror argv () cdtohome csubstnonl cwd /home/christos/src/tcsh dirstack /home/christos/src/tcsh echo_style both edit euid 1000 euser christos gid 1000 group christos history 100 home /home/christos killring 30 owd path (. /home/christos/bin/common /home/christos/bin/x86_64-linux /usr/local/bin /usr/bin/X11 /usr/bin /bin /etc /usr/local/etc /usr/local/sbin /sbin /usr/sbin /usr/local/games /usr/games) prompt %# prompt2 %R? prompt3 CORRECT>%R (y|n|e|a)? shell /bin/tcsh shlvl 4 status 0 tcsh 6.20.00 term xterm tty pts/0 uid 1000 user christos version tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec set rmstar mkdir test cd test touch bla rm * Do you really want to delete all files? [N/y] y ls uname -a Linux mb1 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

sthen commented 6 years ago

Also seen in OpenBSD, though strangely if I backout cc952ed342f6 in tc.func.c, so it uses in-function code rather than the separate getYN() function which is essentially the same code, it does work.

zoulasc commented 6 years ago

Can you add some debugging to getYN() then and see where it hangs?

sthen commented 6 years ago

Oh here we go - applying this post-6.20.00 commit fixes it. d8b47bd193

sthen commented 6 years ago

@fanto666, can you see if applying d8b47bd helps you too?

fanto666 commented 6 years ago

the patch helps, thank you.

zoulasc commented 5 years ago

Patch applied a while ago, thanks!