[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [annoyance/non-feature] On OS X, every process is "occupying" CWD, m

From: Ángel
Subject: Re: [annoyance/non-feature] On OS X, every process is "occupying" CWD, making disk ejects impossible after cd'ing into them.
Date: Wed, 17 Jan 2018 00:43:22 +0100

On 2018-01-16 at 22:36 +0800, Danyel Bayraktar wrote:
> This is my first e-mail here — I would love to help implement this if you 
> give me some pointers and a contribution guide.
> Best regards,
> Danyel.

As Greg mentions, this is the same on other Unix systems too.
Now, as you mention, this has the drawback that you can't eject a disk
while you are at that folder. This is why [traditional] daemons chdir
to / as part of the usual procedure of going into background.

However, there may be cases where you want to keep that reference open.
For instance, the folder could be on an autofs mount, or you could be
working on a deleted folder.
The simpler use case for needing this however, would be a rename in the
folder path. Suppose you were working on /home/danyel/myfiles/
2017bugrports/bash/cwdspoof  Then you notice that there is a typo in the
path, and should be named "bugreports". You will find that you can
externally rename that folder with no ill-effects to the running bash.
$PWD will be wrong, but you can continue working in bash and launching
programs. Whereas with cwdspoof trying to use that console would fail.

There's also the efficiency argument about needing to traverse the
folder path before every command, which won't be that fast when network
is involved, or even a simple cdrom (although in that case it
could/should have been cached by the kernel).

Best regards

reply via email to

[Prev in Thread] Current Thread [Next in Thread]