[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: Danyel Bayraktar
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:20:44 +0800

True, I did mention that in the stackexchange. Not sure it’s a bug, but it’s 
definitely a design flaw in my opinion.

However, Apple probably has no interest in fixing this as apps already depend 
on the behaviour. And in principle, as you do mention hacking, I’m not sure if 
disabling this “"feature”” by hacking it would even be desirable. I would want 
the OS to stop me from ejecting a disk when I’m currently in the process of 
e.g. writing to a file.

Altogether, the `cwdspoof` shopt flag seems to me the only viable solution, 
everything considered.

> On 17. Jan 2018, at 00:11, isabella parakiss <address@hidden> wrote:
> hack the kernel and fix the bug in osx where it's supposed to be fixed
> On 1/16/18, Danyel Bayraktar <address@hidden> wrote:
>> I asked on StackExchange prior to this:
>> https://apple.stackexchange.com/questions/310965/stop-iterm2-from-using-disk-disk-cannot-be-ejected
>> <https://apple.stackexchange.com/questions/310965/stop-iterm2-from-using-disk-disk-cannot-be-ejected>
>> Initially I thought it was specific to the terminal emulator, but it is
>> actually due to the design of OS X. My problem is that when cd’ing into the
>> external drive to run an `ls`, I’m not really “using” it and should be able
>> to eject it. The eject should only be impossible for the time span a process
>> is actually running.
>> So my proposal would be to get rid of this annoyance:
>> Bash should idle in (e.g.) /tmp or /var/folders/xyz, i.e. occupy that file
>> as ‘CWD’ towards the OS, but obviously not expose this to depending code, so
>> still spawn every child process/builtin/keyword inside the (memory-stored)
>> cwd which will be updated with `cd` and used throughout.
>> The drawbacks of this are apparent: `lsof` would show a random irrelevant
>> folder as `cwd` for bash and as such, would be backward incompatible. This
>> could be mitigated by 1) only enabling this in OS X (I do remember disks can
>> be ejected even if bash is occupying them), or (ill-performing), 2) only for
>> external drives. Ill-performing because this will require checks after
>> almost every CWD modification.
>> 3) Honestly, the most obvious and backward-compatible solution would be to
>> put this behind a shopt option, e.g. ‘shopt -s cwdspoof’. I don’t see any
>> reason why this wouldn’t be feasible…
>> 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.

reply via email to

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