Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful "PermissionDenied" in WSL + network drive #20324

Open
Pistahh opened this issue Jun 17, 2024 · 1 comment
Open

Unhelpful "PermissionDenied" in WSL + network drive #20324

Pistahh opened this issue Jun 17, 2024 · 1 comment
Labels
error message This issue points out an error message that is unhelpful and should be improved.

Comments

@Pistahh
Copy link

Pistahh commented Jun 17, 2024

Zig Version

0.13.0

Steps to Reproduce and Observed Output

  • Windows 10 with WSL.
  • Mount a network drive from a Linux samba share, in my case as D:
  • make D: accessible within WSL: sudo mount -t drvfs D: /home/user/dev
  • clone sdl-zig-demo into this directory and try to compile it with zig build

I get the output (added some line breaks to improve readibility):

% zig build
install
└─ install sdl-zig-demo failure
error: unable to update file from
   '/home/user/dev/sdl-zig-demo/.zig-cache/o/31b7da78f2ea68584a39395618fa7226/sdl-zig-demo' to
   '/home/user/dev/sdl-zig-demo/zig-out/bin/sdl-zig-demo': PermissionDenied
Build Summary: 1/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install sdl-zig-demo failure
error: the following build command failed with exit code 1:
/home/user/dev/sdl-zig-demo/.zig-cache/o/7ea22ec676a64f02709f55d4496cc1dd/build
   /opt/zig-linux-x86_64-0.13.0/zig
   /home/user/dev/sdl-zig-demo
   /home/user/dev/sdl-zig-demo/.zig-cache
   /home/user/.cache/zig
   --seed 0x348388c2 -Zab712fe6bccacd35

After spending quite some time to figure out what is wrong with permissions, as the file can be manually copied without any issues, strace revealed that the issue is not with the copy itself:

14205 mkdirat(AT_FDCWD, "/home/user/dev/sdl-zig-demo/zig-out/bin", 0755) = -1 EEXIST (File exists)
14205 newfstatat(AT_FDCWD, "/home/user/dev/sdl-zig-demo/zig-out/bin", {st_mode=S_IFDIR|0777, st_size=512, ...}, 0) = 0
14205 openat(AT_FDCWD, "/home/user/dev/sdl-zig-demo/zig-out/bin", O_RDONLY|O_CLOEXEC|O_PATH|O_DIRECTORY <unfinished ...>
14171 <... futex resumed>)              = -1 ETIMEDOUT (Connection timed out)
14171 futex(0xa72460c, FUTEX_WAIT_PRIVATE, 1, {tv_sec=0, tv_nsec=79999910} <unfinished ...>
14205 <... openat resumed>)             = 10
14205 mmap(NULL, 528, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f847de67000
14205 madvise(0x7f847de67000, 0, 0xffffffff /* MADV_??? */) = -1 EINVAL (Invalid argument)
14205 madvise(0x7f847de67000, 528, MADV_WIPEONFORK) = 0
14205 getrandom("\x9f\xfe\x47\xb1\x2e\xbe\x7a\x2d\xaa\x6b\xd9\xe7\x84\xb7\xcc\x34\x93\x3e\x5a\x0d\xe7\x10\x25\xc2\x92\x92\x84\xc4\x49\xeb\xbb\xc1", 32, 0) = 32
14205 openat(10, "SZTRXTC3QcCZhcgH", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_CLOEXEC, 0100777) = 11
14205 sendfile(11, 9, [0] => [2502144], 2502144) = 2502144

Notice this one failing:

14205 utimensat(11, NULL, [{tv_sec=1718565794, tv_nsec=846739800} /* 2024-06-16T20:23:14.846739800+0100 */, {tv_sec=1718565794, tv_nsec=824229700} /* 2024-06-16T20:23:14.824229700+0100 */], 0)
    = -1 EPERM (Operation not permitted)

14205 close(11)                         = 0
14205 unlinkat(10, "SZTRXTC3QcCZhcgH", 0) = 0
14205 close(10)                         = 0
14205 close(9)                          = 0
14205 write(2, "\33[J", 3)              = 3
14205 write(2, "\33[2m", 4)             = 4
14205 write(2, "install", 7)            = 7
14205 write(2, "\n", 1)                 = 1
14205 write(2, "\33(0mq\33(B ", 9)      = 9
14205 write(2, "install sdl-zig-demo", 20) = 20
14205 write(2, "\33[31m", 5)            = 5
14205 write(2, " failure\n", 9)         = 9

It is probably due to the combination of wsl+network drive.

Expected Output

Not quite sure, but it would be useful to indicate that this is not due to the actual directory/file permissions and have something to do with the setup itself

@Pistahh Pistahh added the error message This issue points out an error message that is unhelpful and should be improved. label Jun 17, 2024
@Pistahh
Copy link
Author

Pistahh commented Jun 17, 2024

Error coming from https://github.com/ziglang/zig/blob/master/lib/std/fs/File.zig#L1083 .

Looks like utimens only works without a timestamp.

% touch me
% touch -d yesterday me
touch: setting times of 'me': Operation not permitted

utimensat(0, NULL, NULL, 0)             = 0
utimensat(0, NULL, [{tv_sec=1718524556, tv_nsec=773606512} /* 2024-06-16T08:55:56.773606512+0100 */, {tv_sec=1718524556, tv_nsec=773606512} /* 2024-06-16T08:55:56.773606512+0100 */], 0)
   = -1 EPERM (Operation not permitted)
``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error message This issue points out an error message that is unhelpful and should be improved.
Projects
None yet
Development

No branches or pull requests

1 participant