[OT] strange interaction between open and cwd

Grant Edwards invalid at invalid.invalid
Mon May 3 22:25:54 EDT 2010


On 2010-05-04, Charles <C.Sanders at DeleteThis.Bom.GOV.AU> wrote:

>> I don't see how it's inelegant at all.  Perhaps it's
>> counter-intuitive if you don't understand how a Unix filesystem
>> works, but the underlying filesystem model is very simple, regular,
>> and elegant.
>>
>>> but probably makes some bit of the OS's job slightly easier and is
>>> usually good enough in practice. Pragmatism is a bitch sometimes. :-)
>>
>
> I agree that the Unix file system is quite elegant, but can be 
> counter-intuitive for people who are used to the "one file, one name"
> paradigm.

I guess I've been using Unix for too long (almost 30 years).  I don't
think I was consciously aware of a "one file, one name" paradigm.  Is
that a characteristic of Dos, Windows or Mac filesystems?

> [...]

> In the OP's case, references to the directory have been removed from
> the file system, but his process still has the current working
> directory reference to it, so it has not actually been deleted. When
> he opens "../abc.txt", the OS searches the current directory for ".."
> and finds the inode for /home/baz/tmp, then searches that directory
> (/home/baz/tmp) for abc.txt and finds it.

Exactly.  I probably should have taken the time to explain that as
well as you did.  One forgets that there are a log of new Unix users
who've never been taught how the filesystem works.

-- 
Grant




More information about the Python-list mailing list