-
Notifications
You must be signed in to change notification settings - Fork 61
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
Can't use --path-link
- panic: reached unreachable code
#114
Comments
> zigup 0.11.0 --path-link "C:Users\$USER\scoop\apps\zigup\current\zig\zig.exe" |
Same error when I specify a filename:
|
There's a few interesting things going on here. First it looks like your pathname is invalid. It should start with const std = @import("std");
pub fn main() !void {
const filename = "C:Users\\$USER\\scoop\\apps\\zigup\\current\\zig\\zig.exe";
std.log.info("creating file '{s}'", .{filename});
_ = try std.fs.cwd().createFile(filename, .{});
} Here's what I get: >zig run bug.zig
info: creating file 'C:Users\$USER\scoop\apps\zigup\current\zig\zig.exe'
error: FileNotFound
D:\tools\zig\0.12.0-dev.80+014d88ef6\files\lib\std\os\windows.zig:133:39: 0x7ff79f643116 in OpenFile (bug.exe.obj)
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
^
D:\tools\zig\0.12.0-dev.80+014d88ef6\files\lib\std\fs.zig:1403:23: 0x7ff79f615622 in createFileW (bug.exe.obj)
.handle = try os.windows.OpenFile(sub_path_w, .{
^
D:\tools\zig\0.12.0-dev.80+014d88ef6\files\lib\std\fs.zig:1286:13: 0x7ff79f611273 in createFile (bug.exe.obj)
return self.createFileW(path_w.span(), flags);
^
C:\temp\zig-windows-bad-path\bug.zig:6:9: 0x7ff79f611073 in main (bug.exe.obj)
_ = try std.fs.cwd().createFile(filename, .{});
^ Could you run this same test program and copy/paste the output so we can confirm you're getting Aside from this, to address your immediate issue, try updating your pathname by changing the start to |
Thank you for investigating this! I ran the program you pasted and got the following output, so it looks like a zig std library bug: ❯ zig run bug.zig
info: creating file 'C:Users\$USER\scoop\apps\zigup\current\zig\zig.exe'
thread 18816 panic: reached unreachable code
C:\Users\$USER\scoop\apps\zigup\current\zig\0.10.0\files\lib\std\os\windows.zig:125:33: 0x7ff6e14f1e60 in OpenFile (bug.exe.obj)
.OBJECT_NAME_INVALID => unreachable,
^
C:\Users\$USER\scoop\apps\zigup\current\zig\0.10.0\files\lib\std\fs.zig:1393:26: 0x7ff6e14c3c90 in createFileW (bug.exe.obj)
else if (flags.truncate)
^
C:\Users\$USER\scoop\apps\zigup\current\zig\0.10.0\files\lib\std\fs.zig:1264:48: 0x7ff6e14c1478 in createFile (bug.exe.obj)
return self.createFileW(path_w.span(), flags);
^
C:/Users/$USER/Documents/GitHub/bug.zig:6:45: 0x7ff6e14c12d0 in main (bug.exe.obj)
_ = try std.fs.cwd().createFile(filename, .{});
^
C:\Users\$USER\scoop\apps\zigup\current\zig\0.10.0\files\lib\std\start.zig:377:41: 0x7ff6e14c15e7 in WinStartup (bug.exe.obj)
std.debug.maybeEnableSegfaultHandler();
^
???:?:?: 0x7ff8c4ab257c in ??? (???)
???:?:?: 0x7ff8c524aa57 in ??? (???) I am running Windows 11 (22H2) Build 22621.3155 Also yes, I did forget to put a ❯ .\zigup\zig-out\bin\zigup.exe 0.10.0 --path-link "C:\Users\$USER\scoop\apps\zigup\current\zig\zig.exe"
install directory 'C:\Users\$USER\Documents\GitHub\zigup\zig-out\bin\zig'
mkdir "C:\Users\$USER\Documents\GitHub\zigup\zig-out\bin\zig"
compiler 'C:\Users\$USER\Documents\GitHub\zigup\zig-out\bin\zig\0.10.0' already installed
error: AccessDenied
C:\Users\$USER\scoop\apps\zigup\current\zig\0.11.0\files\lib\std\fs.zig:1822:31: 0x7ff7f800750d in openDirAccessMaskW (zigup.exe.obj)
.ACCESS_DENIED => return error.AccessDenied,
^
C:\Users\$USER\scoop\apps\zigup\current\zig\0.11.0\files\lib\std\fs.zig:1755:19: 0x7ff7f7fa9596 in openDirW (zigup.exe.obj)
var dir = try self.openDirAccessMaskW(sub_path_w, flags, args.no_follow);
^
C:\Users\$USER\scoop\apps\zigup\current\zig\0.11.0\files\lib\std\fs.zig:1660:13: 0x7ff7f7f729e6 in openDir (zigup.exe.obj)
return self.openDirW(sub_path_w.span().ptr, args, false);
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:774:21: 0x7ff7f7f727aa in compareDir (zigup.exe.obj)
else => |e| return e,
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:730:21: 0x7ff7f7f73452 in verifyPathLink (zigup.exe.obj)
switch (try compareDir(path_link_dir_id, path)) {
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:687:5: 0x7ff7f7f747a6 in setDefaultCompiler (zigup.exe.obj)
try verifyPathLink(allocator, path_link);
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:395:9: 0x7ff7f7f753a9 in fetchCompiler (zigup.exe.obj)
try setDefaultCompiler(allocator, compiler_dir, .existence_verified);
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:308:9: 0x7ff7f7f7a891 in main2 (zigup.exe.obj)
try fetchCompiler(allocator, args[0], .set_default);
^
C:\Users\$USER\Documents\GitHub\zigup\zigup.zig:177:17: 0x7ff7f7f7adc2 in main (zigup.exe.obj)
else => return e,
^
|
I've create a PR to fix the first issue in zig here: ziglang/zig#19288 I've also created a zigup PR to fix the second issue here: #115 . Do you mind trying out the zigup PR #115 and see if it fixes the issue for you? |
Thank you, when I use the branch for #115 I don't get an error anymore! |
Fix released here: https://github.com/marler8997/zigup/releases/tag/v2024_03_13 |
It's been seen on Windows 11 (22H2) Build 22621.3155 that NtCreateFile will return the OBJECT_NAME_INVALID error code with certain path names. The path name we saw this with started with `C:Users` (rather than `C:\Users`) and also contained a `$` character. This PR updates our OpenFile wrapper to propagate this error code as `error.BadPathName` instead of making it `unreachable`. see marler8997/zigup#114 (comment)
It's been seen on Windows 11 (22H2) Build 22621.3155 that NtCreateFile will return the OBJECT_NAME_INVALID error code with certain path names. The path name we saw this with started with `C:Users` (rather than `C:\Users`) and also contained a `$` character. This PR updates our OpenFile wrapper to propagate this error code as `error.BadPathName` instead of making it `unreachable`. see marler8997/zigup#114 (comment)
Not sure how to use the
--path-link
argument, I'd like to put thezig.exe
symlink that points to the default compiler in the specified directory but I get this error:The text was updated successfully, but these errors were encountered: