rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
685 stars 126 forks source link

Trying to use exec to replace a not-interactive process with an interactive one doesn't work inside su #461

Open ale5000-git opened 1 day ago

ale5000-git commented 1 day ago

Trying to use exec to replace a not-interactive process with an interactive one doesn't work inside su.

Example: busybox su -c 'exec sh -s -c "echo 123"'

It should remain open but it didn't (even after adding -N).

rmyorston commented 1 day ago

It's a regression caused by 074ebfca2153bf4a1fc6bdf4f3430d989de503c8.

If you need this to work the previous prerelease (PRE-5462) is still available.

rmyorston commented 14 hours ago

The similar command sh -c "exec sh -s" didn't work either and has been broken since FRP-3532.

Try the latest prerelease (PRE-5487 or above).

ale5000-git commented 13 hours ago

Thanks but unfortunately it doesn't fix all cases. I first thought the problem was only with exec but instead the problem is also with su.

This is the behavior of the old PRE-5462 version:

CASE 1 busybox su -c 'exec sh -s -c "echo 123"' It remain interactive and when typing 'exit' it exit

CASE 2 busybox su -N -c 'exec sh -s -c "echo 123"' It remain interactive and when typing 'exit' it exit (not sure if it is correct to skip 'Press any key to exit...')

CASE 3 busybox su -c 'sh -s -c "echo 123"' It remain interactive and when typing 'exit' it exit

CASE 4 busybox su -N -c 'sh -s -c "echo 123"' It remain interactive and when typing 'exit' it display 'Press any key to exit...' and after pressing any key it exit


On the latest version the case 3 broke but strangely the case 4 is working.

ale5000-git commented 13 hours ago

@rmyorston

I noticed another issue, this: sh -c 'sh' should cause an increment to $SHLVL but it doesn't do it.