<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p id="reply-intro">On 2020-02-10 16:09, Ken D'Ambrosio wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<p><br /></p>
<p>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.</p>
<p>-Ken</p>
</blockquote>
<p>Extra fun for those playing at home: you can *see* this directory by cheating some:</p>
<p>First, we go and ask lsof for files open by bash with name foobar; then we look at the /proc filesystem to show us the cwd for that process:</p>
<p>ken@strider:/tmp/foobar (QA)$ lsof | grep bash | grep foobar<br />bash 8330 ken cwd DIR 0,28 0 1412320 /tmp/foobar (deleted)<br />ken@strider:/tmp/foobar (QA)$ ls -al /proc/8330/cwd<br />lrwxrwxrwx 1 ken ken 0 Feb 10 16:15 /proc/8330/cwd -> '/tmp/foobar (deleted)'</p>
<p>(Note you can actually ls the directory -- since I've got nothing in it, I get nothing back:</p>
<p>ken@strider:/tmp/foobar (QA)$ ls<br />ken@strider:/tmp/foobar (QA)$ ls /proc/8330/cwd<br />ken@strider:/tmp/foobar (QA)$ </p>
<p>Now, I'm going to cd to /tmp/foobar -- which is the "new", extant, undeleted directory (which has a file with the date in it that I created in the last e-mail), and repeat the exact same steps as above:</p>
<p>ken@strider:/tmp/foobar (QA)$ cd /tmp/foobar<br />ken@strider:/tmp/foobar (QA)$ ls<br />date file<br />ken@strider:/tmp/foobar (QA)$ ls /proc/8330/cwd<br />date file</p>
<p>E voila! There's your stuff -- and the old directory, now that the refcount has dropped to zero, has been reaped:</p>
<p>ken@strider:/tmp/foobar (QA)$ lsof | grep /tmp/foobar | grep bash<br />bash 8330 ken cwd DIR 0,28 16 1412321 /tmp/foobar<br />ken@strider:/tmp/foobar (QA)$ </p>
<p>-Ken</p>
</body></html>