Skip to content

Exclude parent-directory components from path extensions #752

Closed

Description

@LunaStev

Problem

The parent-directory component .. is reported as having an extension. path_ext_start treats its final dot as an extension delimiter, so path_has_ext("..") returns true.

Starting points: std/path/analyze.wave.

Reproduction

Tested at 6257ba3eb4b9f1ab6c247a920c6e0c4b5d699331 on Linux amd64 with LLVM 21.1.8 and a compiler built from that checkout. Build it with LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo build --locked --jobs 2.

For a self-contained test against this checkout's std, create a temporary alias (leaving installed std unchanged):

python3 - <<'PYSETUP'
from pathlib import Path
import shutil
p = Path('/tmp/wave-issue-std')
shutil.copytree('std', p, dirs_exist_ok=True)
for f in p.rglob('*.wave'):
    f.write_text(f.read_text().replace('"std::', '"checkout_std::'))
PYSETUP

Save as repro.wave:

import("checkout_std::path::analyze")::{path_has_ext}; fun main() -> i32 { if (path_has_ext("..")) { return 1; } return 0; }
target/debug/wavec build repro.wave --dep checkout_std=/tmp/wave-issue-std -O0 --emit=ir,bin --out-dir /tmp/wave-issue-O0
/tmp/wave-issue-O0/repro
target/debug/wavec build repro.wave --dep checkout_std=/tmp/wave-issue-std -O2 --emit=ir,bin --out-dir /tmp/wave-issue-O2
/tmp/wave-issue-O2/repro

Both executables exit 1, showing that .. was classified as having an extension.

Scope

Exclude final components . and .. from extension detection. Preserve ordinary hidden-file and multiple-extension behavior, including the current separator policy.

Difficulty: easy.

Completion criteria

  • Cover ., .., dir/.. and trailing separators.
  • Keep .gitignore, ordinary names and archive.tar.gz behavior intact.
  • Check both extension offsets and predicates at O0/O2.

Activity

  1. added
    bug
    good first issue
    needs testing
    on Sep 25, 2026
  2. self-assigned this
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions