From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.help Subject: Re: iCloud directory access issue on macOS Catalina Date: Fri, 11 Oct 2019 09:09:04 -0500 Message-ID: <4EFEE550-90AA-44F9-B226-C5D05C63AAD2@easesoftware.com> References: Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3594.4.19\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="167600"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Emacs mailing list To: Pankaj Jangid Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 11 16:20:40 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iIvmY-000hRu-Hh for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Oct 2019 16:20:38 +0200 Original-Received: from localhost ([::1]:51272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIvmX-00013l-9a for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Oct 2019 10:20:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42296) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIvbY-0004Hn-N4 for help-gnu-emacs@gnu.org; Fri, 11 Oct 2019 10:09:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIvbX-0005Rf-4H for help-gnu-emacs@gnu.org; Fri, 11 Oct 2019 10:09:16 -0400 Original-Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:46514) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iIvbW-0005QT-Mx for help-gnu-emacs@gnu.org; Fri, 11 Oct 2019 10:09:15 -0400 X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AC1243427F6; Fri, 11 Oct 2019 14:09:12 +0000 (UTC) Original-Received: from mi3-ss4.a2hosting.com (100-96-171-212.trex.outbound.svc.cluster.local [100.96.171.212]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id B593D3427C2; Fri, 11 Oct 2019 14:09:11 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com Original-Received: from mi3-ss4.a2hosting.com ([TEMPUNAVAIL]. [68.66.200.199]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Fri, 11 Oct 2019 14:09:12 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|pedz+easesoftware.com@mi3-ss4.a2hosting.com X-MailChannels-Auth-Id: a2hosting X-Hook-Spicy: 32d2edb855a3e748_1570802952374_3824175771 X-MC-Loop-Signature: 1570802952374:4208665770 X-MC-Ingress-Time: 1570802952374 Original-Received: from mobile-107-92-61-227.mycingular.net ([107.92.61.227]:16661 helo=mysticslate.wirelessinternet) by mi3-ss4.a2hosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iIvbN-008fvq-IM; Fri, 11 Oct 2019 10:09:05 -0400 In-Reply-To: X-Mailer: Apple Mail (2.3594.4.19) X-AuthUser: pedz+easesoftware.com@mi3-ss4.a2hosting.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.83.212.18 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121643 Archived-At: 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 = wrote: >=20 >=20 >=20 >> On Oct 10, 2019, at 2:06 AM, Pankaj Jangid = wrote: >>=20 >> Hi, >>=20 >> macOS is increasingly making it difficult to access directories. Even >> its own terminal required permission for CDing into icloud = directories. >>=20 >> 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. >>=20 >> ``` >> Debugger entered--Lisp error: (error "Listing directory failed but = =E2=80=98access-file=E2=80=99 worked") >> signal(error ("Listing directory failed but =E2=80=98access-file=E2=80=99= 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) >> ``` >=20 > I can confirm this. I=E2=80=99m using EmacsForMacOS latest so emacs = version reports: >=20 > 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 >=20 > I have my Documents and Desktop in iCloud. I=E2=80=99ve never tried = this before. The issue seems specific to these two directories. >=20 > I added Emacs to the list of =E2=80=9CFull Disk Access=E2=80=9D which = causes it to show up in =E2=80=9CFiles and Folders=E2=80=9D and I also = added it to =E2=80=9CDeveloper Tools=E2=80=9D. >=20 > The problem can be seen (I think) easier by starting M-x shell: >=20 >> 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 %=20 >=20 > 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=20 >=20 > sudo xattr -dr com.apple.quarantine /Applications/Emacs.app =20 >=20 > =E2=80=A6 no effect >=20 > 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: >=20 > This is the process tree before any changes (this is done at the shell = prompt inside a =E2=80=9C*shell*=E2=80=9D buffer inside Emacs) >=20 >> pstree -p $$ >> -+=3D 00001 root /sbin/launchd >> \-+=3D 07613 pedz = /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14 >> \-+=3D 07620 pedz /bin/zsh -i >> \-+=3D 07624 pedz pstree -p 7620 >> \--- 07625 root ps -axwwo user,pid,ppid,pgid,command >=20 > I modified the script to not do an exec but just do a =E2=80=9Csystem=E2= =80=9D and so now the process stack looks like this: >=20 >> pstree -p $$ >> -+=3D 00001 root /sbin/launchd >> \-+=3D 07655 pedz /usr/bin/ruby = /Applications/Emacs.app/Contents/MacOS/Emacs <<<<<<< >> \-+- 07661 pedz = /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_14 >> \-+=3D 07663 pedz /bin/zsh -i >> \-+=3D 07665 pedz pstree -p 7663 >> \--- 07666 root ps -axwwo user,pid,ppid,pgid,command >=20 > but it still does not work. >=20 > This clearly isn=E2=80=99t an emacs problem. I=E2=80=99m going to go = beat the bushes in a few other places and see if I can find a solution. >=20 > I also opened an issue on the EmacsForMacOS GitHub repository = >=20 > pedz >=20