LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   root cannot cd out of already deleted directory using relative paths (https://www.linuxquestions.org/questions/slackware-14/root-cannot-cd-out-of-already-deleted-directory-using-relative-paths-643781/)

ppr:kut 05-21-2008 09:10 AM

root cannot cd out of already deleted directory using relative paths
 
Hi guys!

I'm having a really annoying problem which I can't find a cause for. My root user is unable to cd out of a already deleted directory using relative path definitions. For example, the following does work with my normal user, but not with root:

Code:

mkdir /tmp/test1
cd /tmp/test1
rmdir /tmp/test1
cd ..

Everything works fine for my normal user, but as root cd fails with

Code:

-sh: cd: ..: No such file or directory
This does work on a clean Slackware after install. I somehow manage to make it not work after some time and am now searching for the actual cause.

Anyone an idea?

MS3FGX 05-21-2008 09:20 AM

My first inclination was that it was due to the fact that root doesn't have the current working directory in it's PATH variable (for security reasons) but then you said it works in a clean install (which I can confirm) so obviously it is not a problem with the Slackware configuration itself. Have you done any shell modification that you are aware of, or are you using a different version of Bash?

Alien Bob 05-21-2008 09:36 AM

I can't reproduce this on my Slackware 10.0 box (the only Slackware I could get my hands on right now).

Eric

ppr:kut 05-21-2008 09:40 AM

I usually do not change my shell-settings. I do also have the standard bash of Slack-12.1 installed. However, I just tried something for good luck and probably found something.
It is a problem with sh, as it does work fine in bash. And using sh, it does also not work with the normal user. So, is it possible that sh is not capable of doing it?
If that would be the case, the only thing I would have to look for is why my root-user is using /bin/sh as default shell in konsole all of a sudden...

zux 05-21-2008 12:13 PM

same think here with 12.1 and sh
it doesn't happen in bash
you (or someone?) probably did it in /etc/passwd
mine looks like this:

Code:

root:x:0:0::/root:/bin/bash
you probably have /bin/sh instead of /bin/bash
use vipw to fix it
if you have no need to use /bin/sh as the shell for root the it's best to stick with the defaults
if this happens every time, but you don't do it yourself then it's probably some software you're installing. or maybe got lost somewhere in KDE's graphical configuration utility.

dive 05-21-2008 01:51 PM

I can confirm it happens with /bin/sh here also. /bin/bash is fine.

ppr:kut 05-22-2008 02:52 AM

Quote:

you probably have /bin/sh instead of /bin/bash
Yeah, I thought so too, but it's /bin/bash there. When I do a login on tty6 everything does work fine, it's bash there too. Also rxvt does start with bash. It seems just konsole is messing it up. So I compared the config files of my two users, and they are the same except for the font-settings (this can't be possible, can it?). Now, on to further investigation.


All times are GMT -5. The time now is 05:45 AM.