unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51773: 28.0.60; Issue writing files over WebDAV on MS-Windows
@ 2021-11-11 19:16 Ioannis Kappas
  2021-11-11 19:22 ` Ioannis Kappas
  0 siblings, 1 reply; 3+ messages in thread
From: Ioannis Kappas @ 2021-11-11 19:16 UTC (permalink / raw)
  To: 51773

Hi,

There appears to be an issue with Emacs on MS-Windows that prevents
writing to files over WebDAV with the following error message:

  Getting ACLs: Input/output error, //<server>//...//<filename>

To reproduce

1. C-x f to a UNC path or mapped drive pointing to a WebDAV server.
2. Insert some text and C-x s to save the file.
3. The above error message appears, the buffer is still marked as
modified and any other attempt to save the file fails with the same
error.

Analysis to follow.

In GNU Emacs 28.0.60 (build 2, x86_64-w64-mingw32)
 of 2021-11-11
Repository revision: 6dae01ad6da1bcbced062c0d46a6759c7a0570e4
Repository branch: emacs-28
Windowing system distributor 'Microsoft Corp.', version 10





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#51773: 28.0.60; Issue writing files over WebDAV on MS-Windows
  2021-11-11 19:16 bug#51773: 28.0.60; Issue writing files over WebDAV on MS-Windows Ioannis Kappas
@ 2021-11-11 19:22 ` Ioannis Kappas
  2021-11-11 19:43   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Ioannis Kappas @ 2021-11-11 19:22 UTC (permalink / raw)
  To: 51773

The issue is caused by the ERROR_INVALID_FUNCTION error returned by
w32.c:get_security_info()'s GetSecurityInfo win32 fn when it is called
on a WebDAV file.

The caller w32.c:acl_get_file() doesn't know how to handle the error
and returns it as is, causing the write to fail and the error message to be
displayed.

Looking at the caller, it does have a clause to return ENOSUP for WebDAV files:

  else if (err == ERROR_NOT_SUPPORTED
   /* ERROR_ACCESS_DENIED is what we get for a volume
      mounted by WebDAV, which evidently doesn't
      support ACLs.  */
   || err == ERROR_ACCESS_DENIED)
    errno = ENOTSUP;


Thus a solution, which I have tested it to work, is to add the
ERROR_INVALID_FUNCTION to the predicate

diff --git a/src/w32.c b/src/w32.c
index 9fe698d28d..0e066b12e7 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6614,10 +6614,11 @@ acl_get_file (const char *fname, acl_type_t type)
     || err == ERROR_INVALID_NAME)
      errno = ENOENT;
    else if (err == ERROR_NOT_SUPPORTED
-    /* ERROR_ACCESS_DENIED is what we get for a volume
-       mounted by WebDAV, which evidently doesn't
-       support ACLs.  */
-    || err == ERROR_ACCESS_DENIED)
+    /* ERROR_ACCESS_DENIED or ERROR_INVALID_FUNCTION is
+       what we get for a volume mounted by WebDAV,
+       which evidently doesn't support ACLs.  */
+    || err == ERROR_ACCESS_DENIED
+    || err == ERROR_INVALID_FUNCTION)
      errno = ENOTSUP;
    else
      errno = EIO;

Please let me know if you require more info.

Thanks





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#51773: 28.0.60; Issue writing files over WebDAV on MS-Windows
  2021-11-11 19:22 ` Ioannis Kappas
@ 2021-11-11 19:43   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2021-11-11 19:43 UTC (permalink / raw)
  To: Ioannis Kappas; +Cc: 51773-done

> From: Ioannis Kappas <ioannis.kappas@gmail.com>
> Date: Thu, 11 Nov 2021 19:22:16 +0000
> 
> Thus a solution, which I have tested it to work, is to add the
> ERROR_INVALID_FUNCTION to the predicate
> 
> diff --git a/src/w32.c b/src/w32.c
> index 9fe698d28d..0e066b12e7 100644
> --- a/src/w32.c
> +++ b/src/w32.c
> @@ -6614,10 +6614,11 @@ acl_get_file (const char *fname, acl_type_t type)
>      || err == ERROR_INVALID_NAME)
>       errno = ENOENT;
>     else if (err == ERROR_NOT_SUPPORTED
> -    /* ERROR_ACCESS_DENIED is what we get for a volume
> -       mounted by WebDAV, which evidently doesn't
> -       support ACLs.  */
> -    || err == ERROR_ACCESS_DENIED)
> +    /* ERROR_ACCESS_DENIED or ERROR_INVALID_FUNCTION is
> +       what we get for a volume mounted by WebDAV,
> +       which evidently doesn't support ACLs.  */
> +    || err == ERROR_ACCESS_DENIED
> +    || err == ERROR_INVALID_FUNCTION)
>       errno = ENOTSUP;
>     else
>       errno = EIO;
> 
> Please let me know if you require more info.

Thanks, installed on the emacs-28 branch (there was one more place
which needed the same fix, a few lines above the one you fixed).





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-11 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 19:16 bug#51773: 28.0.60; Issue writing files over WebDAV on MS-Windows Ioannis Kappas
2021-11-11 19:22 ` Ioannis Kappas
2021-11-11 19:43   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).