Writeable readonly directories?

What is the problem you are having with rclone?

When serving a local directory through webdav
and creating a directory inside the served one, using a webdav client, rclone server outputs

2021/01/27 15:16:33 ERROR : dirname/: Can only open directories read only

However, the directory gets created nonetheless and is writeable using the webdav client.

What is your rclone version (output from rclone version)

Happens iwth different versions e.g. cygwin version:

rclone v1.50.2
- os/arch: windows/amd64
- go version: go1.13.4

as well as native windows version (installed through scoop):

rclone v1.53.4
- os/arch: windows/amd64
- go version: go1.15.6

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 7, 64 bit

Which cloud storage system are you using? (eg Google Drive)

local file remote

The command you were trying to run (eg rclone copy /tmp remote:tmp)

cd /d/temp/tmp
rclone serve webdav .

then in separate command window after attaching the webdav resource as drive u:

md u:\dirname
dir u:\

The rclone config contents with secrets removed.

no config

A log from the command with the -vv flag

$ rclone serve webdav . -vv
2021/01/27 15:38:12 DEBUG : rclone: Version "v1.50.2" starting with parameters ["D:\\downloads\\cygwin\\usr\\local\\bin\\rclone.exe" "serve" "webdav" "." "-vv"]
2021/01/27 15:38:12 NOTICE: Config file "D:\\downloads\\cygwin\\home\\user.name\\.config\\rclone\\rclone.conf" not found - using defaults
2021/01/27 15:38:12 INFO  : Local file system at //?/D:/temp/tmp: poll-interval is not supported by this remote
2021/01/27 15:38:12 DEBUG : Adding path "vfs/forget" to remote control registry
2021/01/27 15:38:12 DEBUG : Adding path "vfs/refresh" to remote control registry
2021/01/27 15:38:12 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2021/01/27 15:38:12 NOTICE: Local file system at //?/D:/temp/tmp: WebDav Server started on http://127.0.0.1:8080/
2021/01/27 15:38:26 INFO  : /dirname: PROPFIND from 127.0.0.1:51122
2021/01/27 15:38:26 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:26 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:26 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:26 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:26 INFO  : /: PROPFIND from 127.0.0.1:51122
2021/01/27 15:38:26 INFO  : /dirname: MKCOL from 127.0.0.1:51122
2021/01/27 15:38:26 DEBUG : /dirname: OpenFile: flags=O_RDWR, perm=----------
2021/01/27 15:38:26 ERROR : dirname/: Can only open directories read only
2021/01/27 15:38:26 DEBUG : /dirname: >OpenFile: fd=<nil>, err=permission denied
2021/01/27 15:38:26 INFO  : /dirname: PROPPATCH from 127.0.0.1:51122
2021/01/27 15:38:59 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:59 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:59 INFO  : /: PROPFIND from 127.0.0.1:51122
2021/01/27 15:38:59 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:59 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:59 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 15:38:59 DEBUG : /dirname: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /dirname: >OpenFile: fd=dirname/ (r), err=<nil>
2021/01/27 15:38:59 DEBUG : /dirname: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 15:38:59 DEBUG : /dirname: >OpenFile: fd=dirname/ (r), err=<nil>
2021/01/27 15:38:59 INFO  : /: PROPFIND from 127.0.0.1:51122

hello and welcome to the forum,

if you run it without cygwin, using standard command prompt, do you get the same results?

Yes, it's just the same, see output below

D:\temp\tmp>rclone serve webdav . -vv
2021/01/27 17:46:46 DEBUG : rclone: Version "v1.53.4" starting with parameters ["P:\\scoop\\apps\\rclone\\current\\rclone.exe" "serve" "webdav" "." "-vv"]
2021/01/27 17:46:46 DEBUG : Creating backend with remote "."
2021/01/27 17:46:46 DEBUG : Using config file from "C:\\Users\\user.name\\.config\\rclone\\rclone.conf"
2021/01/27 17:46:46 DEBUG : fs cache: renaming cache item "." to be canonical "//?/D:/temp/tmp"
2021/01/27 17:46:46 INFO  : Local file system at //?/D:/temp/tmp: poll-interval is not supported by this remote
2021/01/27 17:46:46 NOTICE: Local file system at //?/D:/temp/tmp: WebDav Server started on http://127.0.0.1:8080/
2021/01/27 17:47:01 INFO  : /dirname: PROPFIND from 127.0.0.1:52560
2021/01/27 17:47:01 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:01 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:01 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:01 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:01 INFO  : /: PROPFIND from 127.0.0.1:52560
2021/01/27 17:47:01 DEBUG : : Added virtual directory entry vAdd: "dirname"
2021/01/27 17:47:01 INFO  : /dirname: MKCOL from 127.0.0.1:52560
2021/01/27 17:47:01 DEBUG : /dirname: OpenFile: flags=O_RDWR, perm=----------
2021/01/27 17:47:01 ERROR : dirname/: Can only open directories read only
2021/01/27 17:47:01 DEBUG : /dirname: >OpenFile: fd=<nil>, err=permission denied
2021/01/27 17:47:01 INFO  : /dirname: PROPPATCH from 127.0.0.1:52560
2021/01/27 17:47:28 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:28 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:28 INFO  : /: PROPFIND from 127.0.0.1:52560
2021/01/27 17:47:28 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:28 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:28 DEBUG : /: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /: >OpenFile: fd=/ (r), err=<nil>
2021/01/27 17:47:28 DEBUG : /dirname: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /dirname: >OpenFile: fd=dirname/ (r), err=<nil>
2021/01/27 17:47:28 DEBUG : /dirname: OpenFile: flags=O_RDONLY, perm=----------
2021/01/27 17:47:28 DEBUG : /dirname: >OpenFile: fd=dirname/ (r), err=<nil>
2021/01/27 17:47:28 INFO  : /: PROPFIND from 127.0.0.1:52560

I managed to replicate this with Windows 10

I got a traceback when it happens

Stack trace:
goroutine 35 [running]:
github.com/rclone/rclone/fs/log.Stack(0x252b920, 0xc000651a40, 0x254fcfb, 0xd)
        Z:/go/src/github.com/rclone/rclone/fs/log/log.go:87 +0x8f
github.com/rclone/rclone/vfs.(*Dir).Open(0xc000651a40, 0x2, 0x7, 0x28718a0, 0xc000651a40, 0x0)
        Z:/go/src/github.com/rclone/rclone/vfs/dir.go:761 +0xf9
github.com/rclone/rclone/vfs.(*VFS).OpenFile(0xc0003202d0, 0xc0006ec0aa, 0x7, 0x2, 0x0, 0x0, 0xc7aec239, 0x1772cdeb770f3705, 0x170000c0006d0fc0)
        Z:/go/src/github.com/rclone/rclone/vfs/vfs.go:481 +0x683
github.com/rclone/rclone/cmd/serve/webdav.(*WebDAV).OpenFile(0xc000118d80, 0x28503c0, 0xc0006d0d00, 0xc0006ec0aa, 0x7, 0x2, 0xc000000000, 0x0, 0x0, 0x0, ...)
        Z:/go/src/github.com/rclone/rclone/cmd/serve/webdav/webdav.go:274 +0xa5
golang.org/x/net/webdav.patch(0x28503c0, 0xc0006d0d00, 0x28579c0, 0xc000118d80, 0x2850ec0, 0xc000119440, 0xc0006ec0aa, 0x7, 0xc0006db340, 0x1, ...)
        C:/Users/Dev/go/pkg/mod/golang.org/x/net@v0.0.0-20201029055024-942e2f445f3c/webdav/prop.go:308 +0x94f
golang.org/x/net/webdav.(*Handler).handleProppatch(0xc000119480, 0x28459c0, 0xc00057c540, 0xc000571500, 0x0, 0x0, 0x0)
        C:/Users/Dev/go/pkg/mod/golang.org/x/net@v0.0.0-20201029055024-942e2f445f3c/webdav/webdav.go:600 +0x38f
golang.org/x/net/webdav.(*Handler).ServeHTTP(0xc000119480, 0x28459c0, 0xc00057c540, 0xc000571500)
        C:/Users/Dev/go/pkg/mod/golang.org/x/net@v0.0.0-20201029055024-942e2f445f3c/webdav/webdav.go:69 +0x5d8
github.com/rclone/rclone/cmd/serve/webdav.(*WebDAV).handler(0xc000118d80, 0x28459c0, 0xc00057c540, 0xc000571500)
        Z:/go/src/github.com/rclone/rclone/cmd/serve/webdav/webdav.go:185 +0xfe
net/http.HandlerFunc.ServeHTTP(0xc000378d00, 0x28459c0, 0xc00057c540, 0xc000571500)
        c:/go/src/net/http/server.go:2042 +0x4b
net/http.serverHandler.ServeHTTP(0xc000430540, 0x28459c0, 0xc00057c540, 0xc000571500)
        c:/go/src/net/http/server.go:2843 +0xaa
net/http.(*conn).serve(0xc000608640, 0x28503c0, 0xc0006d0c00)
        c:/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
        c:/go/src/net/http/server.go:2969 +0x36d

It looks like this is the the Windows WebDAV client calling PROPPATCH on the directory and the WebDav library I'm using trying to patch the properties on the directory by opening it Read/Write.

I'm not sure exactly where the problem lies here - there might be something rclone could do to fix it.

However it doesn't seem to cause a problem as the Windows WebDAV client seems to ignore the error.

It looks like someone found this problem recently

and has provided a patch :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.