After bug 25538, after a koha-shell we are not longer in the current directory: root@cec7bffd8100:koha(master)$ pwd /kohadevbox/koha root@cec7bffd8100:koha(master)$ sudo koha-shell kohadev kohadev-koha@cec7bffd8100:~$ pwd /var/lib/koha/kohadev
Created attachment 105884 [details] [review] Bug 25752: Stay in cwd after koha-shell After bug 25538, after a koha-shell we are not longer in the current directory: root@cec7bffd8100:koha(master)$ pwd /kohadevbox/koha root@cec7bffd8100:koha(master)$ sudo koha-shell kohadev kohadev-koha@cec7bffd8100:~$ pwd /var/lib/koha/kohadev Test plan: Repeat the commands above and confirm that with this version of the script you get /kohadevbox/koha inside the koha-shell Search for possible regressions
Created attachment 106386 [details] [review] Bug 25752: Stay in cwd after koha-shell After bug 25538, after a koha-shell we are not longer in the current directory: root@cec7bffd8100:koha(master)$ pwd /kohadevbox/koha root@cec7bffd8100:koha(master)$ sudo koha-shell kohadev kohadev-koha@cec7bffd8100:~$ pwd /var/lib/koha/kohadev Test plan: Repeat the commands above and confirm that with this version of the script you get /kohadevbox/koha inside the koha-shell Search for possible regressions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works as expected, no obvious regressions. Signing off
I need it ASAP, maybe it will fix 00-testcritic (?)
(In reply to Jonathan Druart from comment #4) > I need it ASAP, maybe it will fix 00-testcritic (?) Not related, forget that.
With this patch, $ koha-shell $ pwd and $ koha-shell -c 'pwd' will return different results. Is that expected ?
Looks ok for me With sudo: root@f62733f90b41:koha(BZ25752)$ sudo koha-shell kohadev kohadev-koha@f62733f90b41:/kohadevbox/koha$ pwd /kohadevbox/koha kohadev-koha@f62733f90b41:/kohadevbox/koha$ exit root@f62733f90b41:koha(BZ25752)$ sudo koha-shell kohadev -c pwd /kohadevbox/koha Without sudo: root@f62733f90b41:koha(BZ25752)$ koha-shell kohadev kohadev-koha@f62733f90b41:/kohadevbox/koha$ pwd /kohadevbox/koha root@f62733f90b41:koha(BZ25752)$ koha-shell kohadev -c pwd /kohadevbox/koha
Created attachment 106515 [details] [review] Bug 25752: Stay in cwd after koha-shell After bug 25538, after a koha-shell we are not longer in the current directory: root@cec7bffd8100:koha(master)$ pwd /kohadevbox/koha root@cec7bffd8100:koha(master)$ sudo koha-shell kohadev kohadev-koha@cec7bffd8100:~$ pwd /var/lib/koha/kohadev Test plan: Repeat the commands above and confirm that with this version of the script you get /kohadevbox/koha inside the koha-shell Search for possible regressions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(In reply to Jonathan Druart from comment #7) > Looks ok for me > > With sudo: > root@f62733f90b41:koha(BZ25752)$ sudo koha-shell kohadev > kohadev-koha@f62733f90b41:/kohadevbox/koha$ pwd > /kohadevbox/koha > kohadev-koha@f62733f90b41:/kohadevbox/koha$ exit > root@f62733f90b41:koha(BZ25752)$ sudo koha-shell kohadev -c pwd > /kohadevbox/koha > > Without sudo: > root@f62733f90b41:koha(BZ25752)$ koha-shell kohadev > kohadev-koha@f62733f90b41:/kohadevbox/koha$ pwd > /kohadevbox/koha > root@f62733f90b41:koha(BZ25752)$ koha-shell kohadev -c pwd > /kohadevbox/koha Well, of course if you are running koha-shell from the home directory of kohadev-koha, the result will be the same. Try: # cd /tmp # koha-shell -c pwd # koha-shell # pwd
Also, why are you using sudo when you are already root ?
(In reply to Julian Maurice from comment #9) > Try: > # cd /tmp > # koha-shell -c pwd > # koha-shell > # pwd Forgot the instance name. I meant: root@localhost# cd /tmp root@localhost# koha-shell -c pwd kohadev root@localhost# koha-shell kohadev koahdev-koha@localhost$ pwd
Sorry Julian I cannot retest right now. $HOME for kohadev-koha is /var/lib/koha/kohadev, that's why we are landing there without this patch. I tried with sudo to test the behaviour of the 'kshell' alias.
root@615331e1369d:koha(master)$ cd /tmp root@615331e1369d:tmp$ koha-shell -c pwd kohadev /tmp root@615331e1369d:tmp$ koha-shell kohadev kohadev-koha@615331e1369d:/tmp$ pwd /tmp
Pushed to master for 20.11, thanks to everybody involved!
(In reply to Jonathan Druart from comment #13) > root@615331e1369d:koha(master)$ cd /tmp > root@615331e1369d:tmp$ koha-shell -c pwd kohadev > /tmp > root@615331e1369d:tmp$ koha-shell kohadev > kohadev-koha@615331e1369d:/tmp$ pwd > /tmp Sorry, I misread the patch. The problem is with the --login option: # cwd is /home/koha/env/master/src # user test-koha created by hand so $HOME is different than with package install % debian/scripts/koha-shell --login -c pwd test /home/test-koha % debian/scripts/koha-shell --login test % pwd /home/koha/env/master/src Compare with sudo: # cwd is /home/koha/env/master/src % sudo --login -u test-koha pwd /home/test-koha % sudo --login -u test-koha % pwd /home/test-koha
backported to 20.05.x for 20.05.02
I can't seem to reproduce the bug in 19.11.x so I won't backport. Let me know if it does need to be backported.
I think I remember not having this bug in 19.11.x when I tried it once. But anyone now it's affected. Backported to 19.11.x branch for 19.11.13