[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: iCloud directory access issue on macOS Catalina
From: |
Perry Smith |
Subject: |
Re: iCloud directory access issue on macOS Catalina |
Date: |
Fri, 11 Oct 2019 09:09:04 -0500 |
Someone at the EmacsForMacOS GitHub discovered a few things about
this. (Not exactly solved but a relatively simple work around)
Add Emacs.app to "Full Disk Access", then inside Emacs, use
ns-open-file-using-panel (bound to Cmd-o by default) to open an
arbitrary **file** directly inside ~/Documents. The GUI won't let you
open a directory. I bet that could be enhanced a little. After that
emacs can dired in ~/Documents.
There seems to be three of these: ~/Documents, ~/Desktop, and
~/Downloads. I'm surprised ~/Downloads is in there because its not
copied to iCloud.
The ns-open-file-using-panel must be done once for each of these
three. After that, it appears to work forever and ever. I even
rebooted and it still worked.
> On Oct 10, 2019, at 11:23 AM, Perry Smith <pedz@easesoftware.com> wrote:
>
>
>
>> On Oct 10, 2019, at 2:06 AM, Pankaj Jangid <pankaj.jangid@gmail.com> wrote:
>>
>> Hi,
>>
>> macOS is increasingly making it difficult to access directories. Even
>> its own terminal required permission for CDing into icloud directories.
>>
>> I am facing the same in dired. Just wanted to know if anyone has got this
>> fixed. I tried to gave "Full Disk Access" to Emacs but still getting
>> this error.
>>
>> ```
>> Debugger entered--Lisp error: (error "Listing directory failed but
>> ‘access-file’ worked")
>> signal(error ("Listing directory failed but ‘access-file’ worked"))
>> error("Listing directory failed but `access-file' worked")
>> insert-directory("/Users/pankaj/Documents/" "-al" nil t)
>> dired-insert-directory("/Users/pankaj/Documents/" "-al" nil nil t)
>> dired-readin-insert()
>> dired-readin()
>> dired-internal-noselect("~/Documents/" nil)
>> dired-noselect("/Users/pankaj/Documents/" nil)
>> dired-other-window("/Users/pankaj/Documents/" nil)
>> funcall-interactively(dired-other-window "/Users/pankaj/Documents/" nil)
>> call-interactively(dired-other-window nil nil)
>> command-execute(dired-other-window)
>> ```
>
> I can confirm this. I’m using EmacsForMacOS latest so emacs version reports:
>
> GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1894.00
> Version 10.15 (Build 19A583)) of 2019-10-10
>
> I have my Documents and Desktop in iCloud. I’ve never tried this before.
> The issue seems specific to these two directories.
>
> I added Emacs to the list of “Full Disk Access” which causes it to show up in
> “Files and Folders” and I also added it to “Developer Tools”.
>
> The problem can be seen (I think) easier by starting M-x shell:
>
>> pedz@MysticSlate / % cd
>> cd
>> pedz@MysticSlate ~ % ls
>> ls
>> Desktop Downloads Movies Pictures Source
>> d word-search.rb
>> Documents Library Music Public bin
>> new-gnupg
>> pedz@MysticSlate ~ % ls ~/Documents
>> ls ~/Documents
>> ls: Documents: Operation not permitted
>> pedz@MysticSlate ~ % cd Documents/
>> cd Documents/
>> pedz@MysticSlate Documents % ls
>> ls
>> ls: .: Operation not permitted
>> pedz@MysticSlate Documents % pwd
>> pwd
>> /Users/pedz/Documents
>> pedz@MysticSlate Documents %
>
> I piddled around a bit but never succeeded. I discovered that all the files
> and directories under /Applications/Emacs.app have the com.apple.quarantine
> xattr so I removed that
>
> sudo xattr -dr com.apple.quarantine /Applications/Emacs.app
>
> … no effect
>
> I thought perhaps it was a lineage type deal. This version of emacs actually
> starts up a small ruby shell and then does an exec so the final executable
> running is not the original Emacs.app that the finder spawned. You can see
> this below:
>
> This is the process tree before any changes (this is done at the shell prompt
> inside a “*shell*” buffer inside Emacs)
>
>> pstree -p $$
>> -+= 00001 root /sbin/launchd
>> \-+= 07613 pedz /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14
>> \-+= 07620 pedz /bin/zsh -i
>> \-+= 07624 pedz pstree -p 7620
>> \--- 07625 root ps -axwwo user,pid,ppid,pgid,command
>
> I modified the script to not do an exec but just do a “system” and so now the
> process stack looks like this:
>
>> pstree -p $$
>> -+= 00001 root /sbin/launchd
>> \-+= 07655 pedz /usr/bin/ruby /Applications/Emacs.app/Contents/MacOS/Emacs
>> <<<<<<<
>> \-+- 07661 pedz /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14
>> \-+= 07663 pedz /bin/zsh -i
>> \-+= 07665 pedz pstree -p 7663
>> \--- 07666 root ps -axwwo user,pid,ppid,pgid,command
>
> but it still does not work.
>
> This clearly isn’t an emacs problem. I’m going to go beat the bushes in a
> few other places and see if I can find a solution.
>
> I also opened an issue on the EmacsForMacOS GitHub repository
> <https://github.com/caldwell/build-emacs/issues/84>
>
> pedz
>