Skip to content

Host volume traversal can fail with tar 'Cannot close: Bad file descriptor' #14

Closed

Description

@ZhiXiao-Lin

Summary

Reading a host-mounted workspace from inside a3s-box run can make tar fail with Cannot close: Bad file descriptor on files under the mounted volume.

Environment

  • a3s-box version 3.0.3
  • Host platform: macos/arm64
  • VM backend: krun
  • Virtualization: Hypervisor.framework
  • Image: node:24-bookworm
  • Host mount: -v /Users/roylin/code/os:/workspace

Reproduction

a3s-box run --rm \
  --name os-web-build-asset-system-ui-2 \
  --cpus 4 \
  --memory 8g \
  --package-cache pnpm \
  -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
  -v /Users/roylin/code/os:/workspace \
  -w /tmp \
  node:24-bookworm -- \
  bash -lc 'set -euo pipefail
mkdir -p /tmp/os
tar -C /workspace \
  --exclude=./node_modules \
  --exclude=./.git \
  --exclude=./apps/web/dist \
  --exclude=./apps/api/dist \
  --exclude=./dist \
  -cf - . | tar -C /tmp/os -xf -'

Observed behavior

The box exited with tar failures like:

tar: ./apps/api/storage/git-cache/repositories/4a77cb54-f1ca-4010-859e-181a16c64ea5.git/hooks/sendemail-validate.sample: Cannot close: Bad file descriptor
tar: ./apps/api/storage/git-cache/repositories/2d12badb-705d-4a2a-94fb-eaef6269561e.git/objects/2a/e4d2096999bff0939927f8251d9ae6d2460184: Cannot close: Bad file descriptor
tar: ./apps/api/storage/git-cache/repositories/4b897f98-bf9d-4163-bdb6-e077962bd15b.git/hooks/pre-commit.sample: Cannot close: Bad file descriptor
tar: ./apps/api/builtin-assets/agents/agentic/smartcatagent/cat_client/node_modules/eslint/messages/failed-to-read-json.js: Cannot close: Bad file descriptor
tar: ./apps/api/builtin-assets/agents/industrial/digital-twin-builder/web/node_modules/stats-gl/node_modules/three/src/math/Interpolant.js: Cannot close: Bad file descriptor
tar: Exiting with failure status due to previous errors

The same repository is readable from the host. The failure appears while streaming files out of the A3S Box host volume mount.

Expected behavior

A read-only traversal/copy of a host-mounted directory should not fail with EBADF/Bad file descriptor. If certain host filesystem entries are unsupported, Box should either handle them transparently or provide a clear diagnostic indicating the unsupported file type/path and mount limitation.

Impact

This breaks CI-style workflows that copy a mounted repository into the guest filesystem before running isolated build steps. It forces callers to know and exclude unrelated cache directories, which makes builds brittle.

Metadata

Metadata

Assignees

No one assigned

    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