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

Get Error Unexpected when you try to run build after first time on windows network shared folder #19785

Open
Yabgu opened this issue Apr 28, 2024 · 3 comments · May be fixed by #19804
Open

Get Error Unexpected when you try to run build after first time on windows network shared folder #19785

Yabgu opened this issue Apr 28, 2024 · 3 comments · May be fixed by #19804
Labels
bug Observed behavior contradicts documented or intended behavior os-windows
Milestone

Comments

@Yabgu
Copy link

Yabgu commented Apr 28, 2024

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

Create hello world project in samba network shared folder (mounted as drive Z:\ in my case) with zig init-exe and then run zig build twice.

Expected Behavior

It should rebuild

@Yabgu Yabgu added the bug Observed behavior contradicts documented or intended behavior label Apr 28, 2024
@rofrol
Copy link
Contributor

rofrol commented Apr 28, 2024

How about zig 0.12?

@Yabgu
Copy link
Author

Yabgu commented Apr 28, 2024

It happens with 0.12 as well.

@squeek502
Copy link
Collaborator

Can reproduce. Stacktrace with a debug build of Zig (C0000101 is STATUS_DIRECTORY_NOT_EMPTY):

error.Unexpected NTSTATUS=0xc0000101
C:\Users\Ryan\Programming\Zig\zig\lib\std\posix.zig:2810:48: 0xf12f5a in renameatW (zig.exe.obj)
        else => return windows.unexpectedStatus(rc),
                                               ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\posix.zig:2612:25: 0xc59dc7 in renameat (zig.exe.obj)
        return renameatW(old_dir_fd, old_path_w.span(), new_dir_fd, new_path_w.span(), windows.TRUE);
                        ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\fs\Dir.zig:1700:26: 0xd2b067 in rename (zig.exe.obj)
    return posix.renameat(self.fd, old_sub_path, self.fd, new_sub_path);
                         ^
C:\Users\Ryan\Programming\Zig\zig\src\Package\Fetch.zig:1297:25: 0xd31563 in renameTmpIntoCache (zig.exe.obj)
        cache_dir.rename(tmp_dir_sub_path, dest_dir_sub_path) catch |err| switch (err) {
                        ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:7045:41: 0xd31d73 in createDependenciesModule (zig.exe.obj)
    try Package.Fetch.renameTmpIntoCache(
                                        ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:5149:62: 0xd3946c in cmdBuild (zig.exe.obj)
                const deps_mod = try createDependenciesModule(
                                                             ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:276:24: 0xb5433b in mainArgs (zig.exe.obj)
        return cmdBuild(gpa, arena, cmd_args);
                       ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:206:20: 0xb5151e in main (zig.exe.obj)
    return mainArgs(gpa, arena, args);
                   ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\start.zig:484:5: 0xb5124a in main (zig.exe.obj)
    return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp);
    ^
C:\Users\Ryan\Programming\Zig\zig\lib\libc\mingw\crt\crtexe.c:267:0: 0x32f6204 in __tmainCRTStartup (crt2.obj)
    mainret = _tmain (argc, argv, envp);

C:\Users\Ryan\Programming\Zig\zig\lib\libc\mingw\crt\crtexe.c:188:0: 0x32f625b in mainCRTStartup (crt2.obj)
  ret = __tmainCRTStartup ();

???:?:?: 0x7ff91a157343 in ??? (KERNEL32.DLL)
???:?:?: 0x7ff91c0e26b0 in ??? (ntdll.dll)
error: Unexpected
C:\Users\Ryan\Programming\Zig\zig\lib\std\os\windows.zig:2764:5: 0xdf5b7b in unexpectedStatus (zig.exe.obj)
pub const UINT = c_uint;
    ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\posix.zig:2810:17: 0xf12f76 in renameatW (zig.exe.obj)
        else => return windows.unexpectedStatus(rc),
                ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\posix.zig:2612:9: 0xc59e04 in renameat (zig.exe.obj)
        return renameatW(old_dir_fd, old_path_w.span(), new_dir_fd, new_path_w.span(), windows.TRUE);
        ^
C:\Users\Ryan\Programming\Zig\zig\lib\std\fs\Dir.zig:1700:5: 0xd2b087 in rename (zig.exe.obj)
    return posix.renameat(self.fd, old_sub_path, self.fd, new_sub_path);
    ^
C:\Users\Ryan\Programming\Zig\zig\src\Package\Fetch.zig:1313:25: 0xd315b2 in renameTmpIntoCache (zig.exe.obj)
            else => |e| return e,
                        ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:7045:5: 0xd31d91 in createDependenciesModule (zig.exe.obj)
    try Package.Fetch.renameTmpIntoCache(
    ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:5149:34: 0xd396af in cmdBuild (zig.exe.obj)
                const deps_mod = try createDependenciesModule(
                                 ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:276:9: 0xb5439c in mainArgs (zig.exe.obj)
        return cmdBuild(gpa, arena, cmd_args);
        ^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:206:5: 0xb51563 in main (zig.exe.obj)
    return mainArgs(gpa, arena, args);
    ^

@Vexu Vexu added this to the 0.13.0 milestone Apr 28, 2024
squeek502 added a commit to squeek502/zig that referenced this issue Apr 29, 2024
Before this commit, the DIRECTORY_NOT_EMPTY/FILE_IS_A_DIRECTORY/NOT_A_DIRECTORY statuses were assumed only to be possible when using `FILE_RENAME_INFORMATION_EX` and `FILE_RENAME_POSIX_SEMANTICS`, but that has empirically been shown to be false; a networked samba share can return the DIRECTORY_NOT_EMPTY status from `FILE_RENAME_INFORMATION` (which doesn't support `FILE_RENAME_POSIX_SEMANTICS`).

`FILE_IS_A_DIRECTORY` and `NOT_A_DIRECTORY` were not proven to be possible, but they were also moved to the outer switch just in case.

Fixes ziglang#19785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior os-windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants