Open rickardlind opened 4 years ago
Early guess, probably external (in other words recent emacs regress) like this. Not all Windows filesystems supports Windows ACLs, including our 9p.
I am running into this problem as well, on 2020-12-21, with this environment:
Windows 10 Version 1909 (OS Build 18363.1198) Ubuntu 20.04 LTS on WSL 2 Linux PALN34691146A 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
I also experienced that if I create a file that does not exist it can be saved, but any modification to an existing file gets this error.
Can confirm this is still an issue (OS Build 19042.1110, Emacs 27.2, using both WSL 1 and WSL 2).
Although this maybe should be reported to emacs-devel instead, I thought this might help some people when posted here: A very crude fix I came up with is to simply add advice around file-acl
:
(when (eq system-type 'windows-nt)
(defun fp/ignore-wsl-acls (orig-fun &rest args)
"Ignore ACLs on WSL. WSL does not provide an ACL, but emacs
expects there to be one before saving any file. Without this
advice, files on WSL can not be saved."
(if (string-match-p "^//wsl\$/" (car args))
(progn (message "ignoring wsl acls") "")
(apply orig-fun args)))
(advice-add 'file-acl :around 'fp/ignore-wsl-acls))
So far I have not encountered any issues with this, although one should always be careful when writing advice for "low-level" functions like file-acl
. Realistically, running emacs directly in wsl is a better option, but if you just want to make some quick edits in wsl while doing most of your work on the windows side of things, this might be a decent fix.
This is very strange. I have two files in the same directory, one of which generates this error, one of which doesn't (multiple saves).
Dominiksta's workaround worked for me. Thanks!
Dominiksta's workaround continues to work for me; I have not checked recently to see if it is still required.
OS Win 10 21H2 build 19044.1526 WSL2; Emacs 27.2, build 1, x86_64-w64-mingw32 of 2021-03-26. Linux-r: 5.10.16.3-microsoft-standard-WSL2 Linux-v: #1 SMP Fri Apr 2 22:23:49 UTC 2021
Thanks!
Can confirm this is still an issue (OS Build 19042.1110, Emacs 27.2, using both WSL 1 and WSL 2).
Although this maybe should be reported to emacs-devel instead, I thought this might help some people when posted here: A very crude fix I came up with is to simply add advice around
file-acl
:(when (eq system-type 'windows-nt) (defun fp/ignore-wsl-acls (orig-fun &rest args) "Ignore ACLs on WSL. WSL does not provide an ACL, but emacs expects there to be one before saving any file. Without this advice, files on WSL can not be saved." (if (string-match-p "^//wsl\$/" (car args)) (progn (message "ignoring wsl acls") "") (apply orig-fun args))) (advice-add 'file-acl :around 'fp/ignore-wsl-acls))
So far I have not encountered any issues with this, although one should always be careful when writing advice for "low-level" functions like
file-acl
. Realistically, running emacs directly in wsl is a better option, but if you just want to make some quick edits in wsl while doing most of your work on the windows side of things, this might be a decent fix.
Thank you @dominiksta `` for that excellent workaround. I've updated it for my own situation when using rclone, and the filename doesn't necessarily tell you what the mount is. It catches the error thrown by file-acl instead of preventing the function from running:
(defun fp/ignore-acls (orig-fun &rest args)
"Ignore ACLs when not available. rclone does not provide an ACL."
(condition-case nil
(orig-fun (car args))
(error "")))
(advice-add 'file-acl :around 'fp/ignore-acls)
Hope others also find this useful
Environment
Microsoft Windows [Version 10.0.19041.508] Ubuntu 20.04 on WSL 2 Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020
Steps to reproduce
$ echo "Foo" > TEST
$ /mnt/c/Program/Emacs/x86_64/bin/runemacs.exe TEST
Getting ACLs: Input/output error, //wsl$/Ubuntu-20.04/home/rille/TEST