Repository navigation
Runtime/Windows/fs: remove_tree trailing-slash link (#1951); VecRange args refused in Sema (#1954); raw source locations (#1953); in-root wo store (#1885); hex of narrow signed ints (#1907); HOME-less build (#1884); Windows copy_tree/list_files_text don't follow junctions (#1952) - #1978
Merged
Merged
Conversation
added 9 commits
October 2, 2026 21:17
…op path: remove_tree("link/") removed the link's target (#1951)
lstat("link/") resolves the link, so rt_remove_tree saw the target as a
directory, emptied it, and rmdir("link/") removed the target itself; the
link was left dangling and keep.txt was gone (rt/darwin_aarch64.w:539,
and the same lines in rt/linux_x86_64.w and rt/linux_aarch64.w). The entry
now copies the path without its trailing separators and walks that; a
child path never ends in one (rt_path_join). Windows already strips before
its reparse-point query (#1863).
test/behavior/behav_1951_remove_tree_symlink_trailing_slash.w: a symlink
to a directory removed with one and two trailing slashes, a tree holding a
symlink removed with a trailing slash, and a plain directory with one; the
target's file survives each. Red on main's compiler (the target directory
was removed), green on the rebuilt stage1.
…0, 1) crashed the compiler at build (#1954) The issue's repro is `v.range(0, 1)`: two integers where the method takes one range. Sema typed the call (check was silent), and the VEC_RANGE lowering read the range's element type off the first argument (src/CodegenDispatch.w:10470 wl_struct_get_type_at on an i64; lldb frame #1 under LLVMStructGetTypeAtIndex, EXC_BAD_ACCESS at 0x0). `len()` and `is_empty()` on a VecRange from `v.range(start..end)` build and run on main; the crash was in the misspelled constructor, not in len. check_method_call_parts now checks `range` beside split_at: exactly one argument, of range type, else a diagnostic naming the spelling. test/compile_errors/err_1954_vec_range_two_args.w and err_1954_vec_range_int_arg.w pin the two diagnostics (check passed both on main); test/behavior/behav_1954_vecrange_len_is_empty.w pins len() and is_empty() over a VecRange.
…nger reads the path's backslashes as escapes (#1953) MirBuilder.source_location_operand (src/MirLower.w:3092) interned `path:line:col` as a plain CK_STR, and every consumer decodes a plain CK_STR as a source literal (CodegenDispatch str_const_text -> decode_string_escapes; cc_string_literal_payload; comptime), so `W:\review-1863\test\behavior\x.w` printed as `W:` CR `eview-1863` TAB `estbehaviorx.w`. lower_synthesized_str_lit interns compiler-made text with the raw-literal prefix the Parser gives a raw literal, which all three decoders already honor; the location, `__FILE__` and the function name go through it. test/behavior/behav_1953_panic_location_backslash_path.w (Windows): runs the compiler on a program under TEMP\...\t\r\b\boom.w and expects its `__FILE__` and its panic location byte for byte.
…, not an escape (#1885) build_graph_path_project_contained refused every absolute path (src/BuildGraphSupport.w:151), so WITH_WO_DIR spelled as an absolute in-root path (`C:/dev/wt/out/with-wo`) failed the wo install targets with "output escapes project root". It now takes the root: an absolute path that is the root or lies beneath it (separators normalized; case folded on Windows) is checked as the relative path it names, anything else is still refused. build_graph_validate_target_containment takes the root from the dispatcher. The issue's second half, the old store path persisting after unsetting WITH_WO_DIR, is #1925's graph-cache env fingerprint, which landed after the issue's main (355c20b): a removed variable hashes as empty and re-plans. The fixture pins both: an absolute in-root store installs (red on main's compiler with the escape message), the variable removed re-plans to the default store, and an absolute store outside the project is still refused.
…s: i8 -2 under :x is fe (#1907) The issue's u8 cases were fixed by #1922 (Sema's signedness reaches the formatter, so an unsigned value zero-extends). A narrow signed value was still sign-extended to 64 bits before with_fmt_int_spec (rt/rt_core.w) formatted it, so `i8` -2 printed `fffffffffffffffe` under :x, :b, :o, :X and :#x. f-strings reach the formatter through FMT_BUF_WRITE_FMT (with_fmt_buf_write_i64_spec), a format call through FMT_SPEC; both now pass Sema's bit width of the value in flags bits 24-31 (CodegenDispatch mir_int_spec_flags; CCodegen int_spec_flags_text for the C backend), and with_fmt_int_spec masks a bit-pattern base to that width. Decimal is unchanged: a negative decimal still prints '-' and its magnitude. test/behavior/behav_1907_hex_spec_own_width.w: the issue's u8 lines, u16 and u32, and i8/i16/i32/i64 -2 under x, 02x, #x, b, o and X. Red on the first stage1 of this branch (fffffffffffffffe for i8), green after. --emit-c passes the same width bits.
…is no home (#1884) The issue's case, Windows without HOME, became the USERPROFILE fallback in build/wo.w wo_home with #1937, after the issue's main. Two parts were left. With no home at all (HOME unset, and USERPROFILE too on Windows) the store still became `/.local/with-wo` and the build failed late, after stage1 and stage2, as an install escaping the project root: on main, `HOME= with build --graph` exits 0 and plans every wo artifact under /.local/with-wo. And the green store (build.w green_store_install_path, build/retention.w ret_green_store_path), `:install-user` (src/main.w) and the driver's test-verdict and build-runner stores read HOME alone. build/compiler.w comp_home_dir is now the one rule for the build layer: $HOME, else %USERPROFILE% on Windows, else Diagnostics.error naming the variables and the overrides (WITH_WO_DIR, WITH_GREEN_DIR) at graph time; comp_home_lookup gives "" for a caller that only asks whether an explicit store lies beneath it, and comp_home_dir_env is the action-time reading. The driver's stores and :install-user use build_graph_home_dir (the same rule), and :install-user refuses with no home. test/behavior/behav_1884_build_layer_no_home.w evaluates this repo's graph with no home and expects the refusal (rc 0 with a /.local/with-wo plan on main). test/behavior/behav_1884_windows_install_home_unset.w (Windows) pins the fallback: a `$HOME/` install with HOME emptied lands under %USERPROFILE%.
…ymlink as the link: neither walks into its target (#1952) win_copy_tree_w and win_list_files_walk classified each entry with GetFileAttributesW (rt/windows_x86_64.w win_is_dir), which calls a junction a directory, so list_files_text listed the junction's target and copy_tree copied it, from outside the tree. #1863 fixed remove_tree the same way; the three walkers now share it: win_top_entry classifies the top path (the reparse tag from its own FindFirstFileW entry, trailing separators left off), and each child is classified by its listing entry with win_is_link (reparse point + name-surrogate bit). list_files_text lists a link as a leaf, the link itself, as the lstat walk lists a symlink on POSIX. copy_tree copies a file link as the file it names (POSIX open() follows one) and refuses a directory link with -21 (EISDIR), as the POSIX copy fails on a directory symlink (verified on the Mac: copy_tree over a tree holding a dir symlink returns -21). Same change in rt/windows_aarch64.w; the two files' walker code is identical. test/behavior/behav_1952_windows_walkers_junctions.w (Windows), mirroring behav_fs_remove_tree_windows_junctions.w. On win10 with the pinned seed (nightly-20260930-local-2-bd6e00d1dee6): fails at line 58, the listing holds the junction's target. With this branch's stage1 (:dev on win10): passes, as do behav_fs_remove_tree_windows_junctions, behav_fs_list_files_file_path and behav_fs_windows_unicode_names.
…y was joined onto the root twice (#1885) pre_d_build_runner's p7_abs treated only a leading '/' as absolute, so on Windows p7_abs(p7_join(case_dir, ...)) spelled W:\root/W:\root/out/... and behav_1885_in_root_store_and_env_replan.w failed on win10 with that path in the escape message. A leading '/' or '\', or a drive letter and a separator, is absolute. With it the #1885 fixture passes on win10 with the branch stage1, the issue's case: an absolute drive-letter store inside the project root.
…ect root (#1885) 456f18f0 made containment relative to the root: an absolute path beneath it is contained, so the predicate is now (root, path). The three cases keep their intent under root `/root` (C:/elsewhere/x.w and /elsewhere/x.w escape, src/x.w is contained), and the case #1885 made legal is added: /root/out/x.w is contained. Test: the previous file no longer compiles on stage1 ("expects 2 argument(s), found 1", the battery red); this one prints ok.
Contributor
Author
|
Battery GREEN on stack top 029574d (seed-driven, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Campaign wave (issues since modeled-C). One commit per issue; each red→green with the fixture named in its commit; Windows ones verified on win10 before/after. Gate green on the Mac. Notes: #1954's crash was the spelling
v.range(0, 1)(two ints to a one-range method) reaching codegen — Sema now refuses it;range(0..2).len()always worked. #1952:copy_treerefuses a tree with a directory junction (-21), matching what macOS already does for a directory symlink. Stacked on #1976 for one battery.