Skip to content

buildFileForContract cannot bootstrap a repo that has never generated: vm.writeFile does not create src/generated #40

Description

@thedavidmeister

LibFs.buildFileForContract calls vm.writeFile directly, and vm.writeFile does not create parent directories. So a repo that has never generated — no src/generated on disk — cannot run its build:

vm.writeFile: failed to open file ".../src/generated/ReproFresh.sol": No such file or directory (os error 2)

vm.isDir("src/generated") is false at that point, so the permission check passes and only the write fails. The error names neither the missing directory nor the fix.

This is the first-run path for every consumer of this package. It is invisible here because src/generated is committed in this repo.

Triage framing

It may be intended that a consumer creates the directory themselves, or that src/generated is always committed so the case never arises in practice. Against that: nothing documents the requirement, the failure is an OS-level error rather than a stated precondition, and vm.createDir(dir, true) before the write is one line inside the function that already owns file placement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

adversarialAdversarial mutation-test findingauditAudit finding

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions