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

Layout step fails on Windows with error "Failed to find a parent section match for a page" #58

Open
Atomk opened this issue Sep 25, 2024 · 1 comment

Comments

@Atomk
Copy link
Contributor

Atomk commented Sep 25, 2024

Zig's website builds fail on Windows with error "Failed to find a parent section match for a page" because some path separators are hardcoded to /, and cached paths are saved with the native separator resulting in failing equality checks with paths using the / separator.

md_rel_path = 'news/welcome-jacob-young.smd'
section_path = 'C:\...\www.ziglang.org\.zig-cache\zine\s\en-US\news\s'
section file contents:
    news\migrate-to-self-hosting\index.smd
    news\carmen-the-allocgator\index.smd
    news\welcome-matthew-lugg.smd
    news\first-donor-bounty.smd
    news\announcing-donor-bounties.smd
    news\2024-financials.smd
    news\bounties-damage-open-source-projects.smd
    news\welcome-jacob-young.smd
    news\0.11.0-postponed-again.smd
    news\goodbye-cpp\index.smd
    news\financials-update.smd
    news\jakub-konka-hired-full-time\index.smd
    news\website-i18n-redesign.smd
    news\zig-0.7.1.smd
    news\fosdem-2021.smd
    news\statement-regarding-zen-programming-language.smd
    news\announcing-zig-software-foundation.smd

Notice how the path separator in md_rel_path differs from the ones in the section file contents.
Hacking around I was able to confirm that fixing this issue allows to complete a ziglang.org build on Windows.

@Atomk
Copy link
Contributor Author

Atomk commented Sep 25, 2024

After #59 these are the remaining failures:

   │  ├─ run layout (news\welcome-jacob-young.smd) failure
   │  ├─ run layout (news\2024-financials.smd) failure
   │  ├─ run layout (news\announcing-donor-bounties.smd) failure
   │  ├─ run layout (news\first-donor-bounty.smd) failure
   │  ├─ run layout (learn\why_zig_rust_d_cpp.smd) failure
   │  ├─ run layout (learn\why_zig_rust_d_cpp.smd) failure
   │  ├─ run layout (learn\why_zig_rust_d_cpp.smd) failure
   │  ├─ run layout (learn\why_zig_rust_d_cpp.smd) failure
   │  └─ run layout (learn\why_zig_rust_d_cpp.smd) failure

I was able to work around this by replacing this code with the following lines, but it's obviously just a hack and should be properly fixed by someone who better understand the codebase (and Zig, this is my first time actually using the language)

var ref_native = try gpa.dupe(u8, ref);
if (builtin.os.tag == .windows) {
    std.mem.replaceScalar(u8, ref_native[0..], '/', std.fs.path.sep);
}

const res = try page_finder.find(.{
    .ref = .{
        .site = page_site,
        .path = ref_native,
    },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant