Skip to content

MicroVM merge-back test assumes umask 022 for new inode modes #2008

Open

Description

@jbeda

Bug description

The microVM merge-back scenario test assumes newly created files have 0644/0755 host modes. It fails under either a common group-writable caller umask (0002, which produces 0664/0775) or a restrictive one (0077, which produces 0600/0700), despite the documented contract that new merged inodes have host-derived modes.

This is not evidence that the Mecatl Shell tool sets the umask: the Shell runner starts a child shell with the harness process's inherited umask. The current Shell invocation inherited 0002 from its mecatui parent. The microVM daemon separately sets its own umask to 0022 for deterministic artifact extraction.

Steps to reproduce

On Linux, from the repository root:

cd environment/microvm
umask 0002 # this was the inherited default in the investigation session
GOWORK=off go test . -run '^TestMicroVMMVP_Scenario5_BasicExistingMergeBehavior$' -count=1
# Compare: umask 0022; GOWORK=off go test . -run '^TestMicroVMMVP_Scenario5_BasicExistingMergeBehavior$' -count=1

The 0002 run fails at repository_attachment_test.go:510 with replacement metadata 65532:65532:0100664 rather than expected 0644; the 0022 run passes. An explicit umask 0077 also fails (with 0600 instead of 0644); the new executable can likewise differ from the expected 0755.

Expected behavior

The test verifies that merge-back clears stale guest ownership metadata, projects the actual host-derived modes of new inodes, and does not change those host modes during ownership refresh, regardless of the test process's inherited umask.

Actual behavior

TestMicroVMMVP_Scenario5_BasicExistingMergeBehavior hard-codes 644 and 755 after merge-back. mergeRepositoryWorktreesWithOwnership uses git apply, so newly created inode modes are subject to the calling process's umask. The test already captures one pre-refresh host mode (refreshedChildHostMode) but also requires it to equal 0755.

Environment

  • Linux; microVM module at ba47fd88a (investigation checkout).
  • Reproduced under the session's inherited umask 0002 and deliberately set 0077; passes with explicitly set 0022. The 0002 mask comes from the mecatui process's inherited mask, not the Shell tool.

Suggested fix

Assert that fresh ownership metadata matches the actual post-apply host inode modes, that stale guest metadata is gone, and that ownership refresh preserves the mode. Do not globally force 022 in the library or test runner; the daemon already sets 022 at its artifact boundary (cmd/mecatl-microvmd/main.go:129-136).

Related packaging boundary worth checking separately: task microvm:package copies and archives the guest agent without normalizing its executable mode (Taskfile.yml:388-394). Verify the tar member stays executable for the guest UID under a restrictive caller umask; if not, explicitly set 0755 before archiving, as the release/E2E packaging paths do.

References: environment/microvm/repository_attachment_test.go:436-516, environment/microvm/operational.go:88-103, docs/architecture/microvm-environments.md:182-184.

Activity

  1. self-assigned this
    on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions