zig icon indicating copy to clipboard operation
zig copied to clipboard

Build.InstallDirStep error messages don't handle absolute paths well

Open squeek502 opened this issue 2 years ago • 0 comments

Zig Version

0.11.0-dev.3949+27a66191c

Steps to Reproduce and Observed Output

If the InstallDir step fails and src_dir_path is an absolute path, it will concatenate src_builder.build_root and src_dir_path in the error message which can look like this:

SDL2.install include/: error: unable to update file from 'C:\Users\Ryan\AppData\Local\zig\p\12203b8910747b6bcf74925433d17511e2398e9ff454ff01438c83abad35dbd27ea9\C:\Users\Ryan\AppData\Local\zig\p\12203b8910747b6bcf74925433d17511e2398e9ff454ff01438c83abad35dbd27ea9\include\begin_code.h' to 'C:\Users\Ryan\Programming\Zig\tmp\ztyping\zig-out\include\SDL2\begin_code.h': AccessDenied

the 'from' path printed:

C:\Users\Ryan\AppData\Local\zig\p\12203b8910747b6bcf74925433d17511e2398e9ff454ff01438c83abad35dbd27ea9\C:\Users\Ryan\AppData\Local\zig\p\12203b8910747b6bcf74925433d17511e2398e9ff454ff01438c83abad35dbd27ea9\include\begin_code.h

is two absolute paths concatenated together (and in this case is an invalid Windows path which is extra confusing).

Unsure if this affects any other build system errors. From a quick look, it seems like other steps are more or less guaranteed to have a relative path so the concatenation with build_root might be okay there.

Expected Output

A better representation of the actual path that was used (likely using something like fs.path.resolve if necessary)

squeek502 avatar Jul 10 '23 01:07 squeek502