all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Perry Smith <pedz@easesoftware.com>
To: Pankaj Jangid <pankaj.jangid@gmail.com>
Cc: Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: iCloud directory access issue on macOS Catalina
Date: Fri, 11 Oct 2019 09:09:04 -0500	[thread overview]
Message-ID: <4EFEE550-90AA-44F9-B226-C5D05C63AAD2@easesoftware.com> (raw)
In-Reply-To: <B29C82B8-6651-426D-944E-7C3846F5DE89@easesoftware.com>

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
> 




  reply	other threads:[~2019-10-11 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  7:06 iCloud directory access issue on macOS Catalina Pankaj Jangid
2019-10-10 16:23 ` Perry Smith
2019-10-11 14:09   ` Perry Smith [this message]
2019-10-12  7:13     ` Pankaj Jangid
2019-10-31 13:39 ` Pankaj Jangid
2019-10-31 14:51   ` Perry Smith
2019-10-31 16:30     ` Pankaj Jangid
2019-10-31 16:53       ` Pankaj Jangid
2019-10-31 18:05         ` Perry Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EFEE550-90AA-44F9-B226-C5D05C63AAD2@easesoftware.com \
    --to=pedz@easesoftware.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pankaj.jangid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.