Skip to content

Partial standard-library cache directories are treated as complete packages #356

@aspizu

Description

@aspizu

Repro

home=$(mktemp -d /tmp/goboscript-home-XXXXXX)
tmp=$(mktemp -d /tmp/goboscript-std-partial-XXXXXX)
printf 'std = "2.1.0"\n' > "$tmp/goboscript.toml"
printf 'costumes "blank.svg";\n%%include std/math\n\n' > "$tmp/stage.gs"
printf '<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>\n' > "$tmp/blank.svg"
mkdir -p "$home/Library/Application Support/com.aspizu.goboscript/std/v2.1.0"
HOME="$home" target/debug/goboscript build "$tmp"

Observed:

error: No such file or directory (os error 2)
 --> .../stage.gs:2:10
2 | %include std/math
  |          ^^^^^^^^

fetch_package() returns immediately when the version directory exists, even if the directory is empty or only partially extracted. The compiler then treats the broken cache as the installed std package.

Expected

The std cache should be validated before reuse, or package extraction should be atomic so partial directories are not accepted as complete packages. A broken cache should be repaired or reported as cache corruption, not surfaced as a missing %include file in user code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions