Bug 7526

Summary: "exec /bin/sh" freezes when ^C from an interactive shell script with "set -m"
Product: Busybox Reporter: Explorer09
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Explorer09 2014-10-08 08:40:36 UTC
I cannot reproduce this bug in my Ubuntu host system, but it happens when I test my initramfs image for this project (https://github.com/Explorer09/cpustress-ubcd). So I have tried my best to narrow down the problem and report here.

1. Download the attached initrd.xz
2. Boot it with a Linux kernel from a Linux distro. For example in GRUB:

  linux (hd0,msdos1)/boot/vmlinuz-3.13.0-36-generic quiet
  initrd (hd0,msdos1)/home/username/initrd.xz
  boot

3. This initrd.xz will start a "/runonce" script that calls "/test.sh" and you will see this:

  + echo In /runonce
  In /runonce
  + /test.sh
  + echo In /test.sh
  In /test.sh
  + echo Press Ctrl+C now.
  Press Ctrl+C now.
  + read REPLY

4. Press Ctrl+C. Actual result:

  ^C+ exec /bin/sh
  (And it freezes here without any shell prompt.)

Expected result:

  ^C+ exec /bin/sh
  ~ # 

I also tested that, when I remove 'set -m' from the content of "test.sh", things will work as expected.
Comment 2 Explorer09 2014-10-09 02:20:11 UTC
(In reply to comment #0)
> Expected result:
> 
>   ^C+ exec /bin/sh
>   ~ # 
> 

Correction.
Comment 3 Explorer09 2014-10-09 02:39:58 UTC
(In reply to comment #0)
> Expected result:
> 
>   ^C+ exec /bin/sh
>   ~ # 
> 

Update. I am also satisfied if the shell running "/runonce" just terminates because of SIGINT, and let "/sbin/init" respawn it on tty1.

And by the way, my "/bin/sh" points to "/bin/busybox" and it's always BusyBox ash.