Weird CLI behaviour.

Ken D'Ambrosio ken at jots.org
Mon Feb 10 21:09:03 UTC 2020


On 2019-12-02 03:30, Owen Thomas wrote:

> On Mon, 2 Dec 2019 at 19:24, Colin Watson <cjwatson at ubuntu.com> wrote: 
> 
>> One problem that would be fixable, though, is that you are getting empty
>> output from "ls" (and even a zero exit status, when I test this
>> locally!) rather than an error message.  That seems to me like a clear
>> bug in coreutils and I think should be reported as such.
> 
> Hmmm... yes, I don't think I would have winged if what you suggest had actually been the case. Hence, I might just report it. 
> 
> Owen.

My guess: your directory tree has been deleted, *but you're still in
that directory* so it's not getting reaped.  So the directory still
exists.  Let me show: 

ken at strider:~ (QA)$ cd /tmp
ken at strider:/tmp (QA)$ mkdir foobar
ken at strider:/tmp (QA)$ cd foobar
ken at strider:/tmp/foobar (QA)$ rmdir -rf ../foobar
rmdir: invalid option -- 'r'
Try 'rmdir --help' for more information.
ken at strider:/tmp/foobar (QA)$ rmdir ../foobar
ken at strider:/tmp/foobar (QA)$ pwd
/tmp/foobar
ken at strider:/tmp/foobar (QA)$ ls /tmp | grep foobar
ken at strider:/tmp/foobar (QA)$ mkdir /tmp/foobar
ken at strider:/tmp/foobar (QA)$ touch /tmp/foobar/file
ken at strider:/tmp/foobar (QA)$ ls
ken at strider:/tmp/foobar (QA)$ ls /tmp/foobar/file
/tmp/foobar/file
ken at strider:/tmp/foobar (QA)$ ls /tmp/foobar/
file
ken at strider:/tmp/foobar (QA)$ date > /tmp/foobar/date
ken at strider:/tmp/foobar (QA)$ cat /tmp/foobar/date
Mon Feb 10 16:07:57 EST 2020
ken at strider:/tmp/foobar (QA)$ cat date
cat: date: No such file or directory 

Bottom line: there's a /tmp/foobar that the system generally knows
about, and there's a /tmp/foobar that *only my bash session* knows
about.  This is not a bug, but is expected behavior for
deleted-but-not-reaped files/directories. 

-Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20200210/20528c04/attachment.html>


More information about the ubuntu-users mailing list