neomacs icon indicating copy to clipboard operation
neomacs copied to clipboard

[Bug]: Find-file on directory on mac fails

Open UselessDetails opened this issue 1 month ago • 1 comments

Bug summary

Neomacs fails to run dired on a symlink to a directory.

Also fails on "~/Library/Mobile Documents" although it works on ~/Library.

Steps to reproduce

C-x C-f ~/iCloud

[email protected]> ls -las ~/iCloud 0 lrwxrwxr-x 1 rich staff 57 Jun 23 2025 /Users/rich/iCloud -> /Users/rich/Library/Mobile Documents/com~apple~CloudDocs/

Rather than running direc on the directory, it produces an error message: "~/iCloud is a directory".

Expected behavior

Runs dired on the directory or reports why not and perhaps walks me through the access request.

Neomacs --version output

[email protected]> neomacs --version
bash: neomacs: command not found

emacs-version reports 31.1

[email protected]> /Applications/neomacs.app/Contents/MacOS/neomacs --version
Neomacs 0.0.20
Git commit: 47fa15cc69ae8f8da1ca3fac25e0beb700e8c118
Source date: 2026-10-24T15:13:18.000000000-04:00
Build: release for aarch64-apple-darwin with rustc 1.96.1
Standalone Rust binary for Neomacs (no C dependency)

Platform

macOS

Install source

Prebuilt release asset (downloaded from Releases)

Extra context

If I manually add "full disk access" to neomacs, then it works. This is poor UX. The error message should lead to a request for access.

UselessDetails avatar Nov 01 '26 21:11 UselessDetails

Current main no longer reproduces the generic case: find-file-noselect opens dired for a plain directory, a trailing-slash name, a symlink to a directory, and with find-file-visit-truename set. That contract is pinned against GNU Emacs 31.1 (a360712c) by 7d2b3bbeba (crates/neovm-oracle-tests/tests/oracle_find_file_directory.rs), and I re-verified it on Linux with the current release binary — GNU and neomacs produce identical results for all four cases plus the find-directory-functions argument (plain name vs truename).

Your remaining report is macOS-specific: ~/iCloud is a symlink into ~/Library/Mobile Documents, which macOS gates behind TCC. Since the error text "~/iCloud is a directory" comes from find-file-noselect after find-directory-functions returned nil, the interesting failure is inside dired-noselect, not in directory detection. On a current build, could you paste:

neomacs --version
(list (file-directory-p "~/iCloud")
      (file-symlink-p "~/iCloud")
      (file-attributes "~/iCloud")
      (condition-case e (dired-noselect "~/iCloud") (error e))
      (with-temp-buffer
        (condition-case e (insert-directory "~/iCloud" "-al" nil t) (error e))
        (buffer-string)))
(let ((debug-on-error t))
  (condition-case e (find-file-noselect "~/iCloud") (error e)))

and whether the ls used by dired can read the path from the same app bundle (e.g. M-! ls -la ~/iCloud). Also: does the GNU Emacs you compare against have Files-and-Folders access to iCloud Drive, or Full Disk Access (System Settings → Privacy & Security), granted to Emacs.app, while neomacs.app has not been prompted/granted? Our entitlements file only carries com.apple.security.cs.allow-jit (scripts/macos-entitlements.plist); if the bundle is signed with a stable identifier and TCC has never prompted, the denial is silent and dired sees an unreadable directory. That part needs a macOS machine to confirm, so I am leaving this open with the narrowed scope.

eval-exec avatar Nov 13 '26 14:11 eval-exec