rmyorston / busybox-w32

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

$SHLVL in su is wrong #436

Closed ale5000-git closed 2 months ago

ale5000-git commented 2 months ago

From busybox ash I run su, then (inside the su window):

$ echo $SHLVL
1
$ exec "C:/Program Files/Git/usr/bin/bash.exe"
$ echo $SHLVL
2

Why $SHLVL became 2 if I use exec?

Edit: I get the same issue also with exec ash

rmyorston commented 2 months ago

Apart from the reference to su this seems to be a duplicate of #302.

As mentioned there, bash decrements SHLVL in exec while upstream BusyBox (and so busybox-w32) don't. I looked for a way to replicate the bash behaviour in BusyBox, but without success.

ale5000-git commented 2 months ago

I didn't remember the old ticket, I will ask upstream them.

EDIT: The upstream ticket is here => https://bugs.busybox.net/show_bug.cgi?id=16141