Strange behaviour of the "cd" command

Joel Rees joel.rees at gmail.com
Tue Jul 11 01:51:53 UTC 2017


One question occurs to me ...

On Mon, Jul 10, 2017 at 9:58 PM, Dr Rainer Woitok
<rainer.woitok at gmail.com> wrote:
> Greetings,
>
> On a rather fresh installation of Kubuntu 16.04 I ran into the following
> problem:
>
> General information:
>
> $ uname -a
> Linux tux 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> $ echo $SHELL
> /usr/bin/ksh
> $ unset CDPATH
> $ ls -la / | head -4
> total 116
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 .
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 ..
> drwx------   2 root root  4096 2016-05-25 11:19 .cache
> $ cd /.cache
> /usr/bin/ksh: hist[7]: cd: /.cache: [Permission denied]

What is that directory doing there?

Now, I have a /root/.cache even though I rarely enable root for even
local log in, and never log into a gui environment as root, and never
use lynx or such as root.

Having a /.cache might indicate that something succeeded half-way
at su-ing to root without enough permission to read root's login directory,
or something like that.

> The above message is exactly what one would expect, and thus ok.
>
> $ cd
> $ pwd
> /home/rainer
> $ ls -la ../../ | head -4
> total 116
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 .
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 ..
> drwx------   2 root root  4096 2016-05-25 11:19 .cache
> $ cd ../../.cache
> /usr/bin/ksh: hist[11]: cd: /cache: [No such file or directory]

I made a /.cache directory, just for grins, but I don't reproduce this. My
shell is bash. I didn't think to see what would happen if there were
a /.cache and a /cache which somehow were hard links to the same
inode. At least we know that your /.cache is not a symbolic link. What
does ls -i tell you?

Check whether you have an executable called "cd" somewhere in
your PATH. (You shouldn't, of course.)

If you don't find an executable called cd lying around in your path,
check that your shell has not been modified.

> $ pwd
> /home/rainer
>
> However, the error message above  is definitely not what I had expected!
> In the error message mind in particular the missing dot in "/cache".
>
> What's happening here?
>
> Sincerely,
>   Rainer
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



-- 
Joel Rees

One of these days I'll get someone to pay me
to design a language that combines the best of Forth and C.
Then I'll be able to leap wide instruction sets with a single #ifdef,
run faster than a speeding infinite loop with a #define,
and stop all integer size bugs with my bare cast.
http://defining-computers.blogspot.com/2017/06/reinventing-computers.html

More of my delusions:
http://reiisi.blogspot.com/2017/05/do-not-pay-modern-danegeld-ransomware.html
http://reiisi.blogspot.jp/p/novels-i-am-writing.html




More information about the ubuntu-users mailing list