Skip to content

Support file bind mounts in addition to directories#49

Merged
jserv merged 1 commit intomainfrom
compatibility
Apr 5, 2026
Merged

Support file bind mounts in addition to directories#49
jserv merged 1 commit intomainfrom
compatibility

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented Apr 5, 2026

kbox_apply_bind_mounts() unconditionally mkdir'd target before MS_BIND, silently failing for file sources. Stat the host source to determine its type: create a directory target via mkdir for directories, or an empty file target via openat(O_CREAT|O_EXCL) for regular files. Reject symlinks, devices, and other non-regular types up front.

On EEXIST, verify the existing target matches the expected type to catch mismatches early instead of deferring to a confusing mount error.

Close #39

Change-Id: I287c480fbe80301911e0b64702db2b6abb48a70f


Summary by cubic

Enable bind-mounting regular files alongside directories. Also improves validation and error messages to fail fast on mismatches.

  • New Features

    • Detects source type and creates the correct target (dir via mkdir, file via openat(O_CREAT|O_EXCL)); rejects symlinks and other non-regular sources.
    • Adds unit tests for bind spec parsing and wires them into the unit test suite.
  • Bug Fixes

    • Fixes file-source mounts that previously failed after mkdir; on EEXIST, verifies target type and improves errors; validates inputs (s, specs, count).

Written for commit 0000f97. Summary will update on new commits.

cubic-dev-ai[bot]

This comment was marked as resolved.

kbox_apply_bind_mounts() unconditionally mkdir'd target before MS_BIND,
silently failing for file sources. Stat the host source to determine its
type: create a directory target via mkdir for directories, or an empty
file target via openat(O_CREAT|O_EXCL) for regular files. Reject
symlinks, devices, and other non-regular types up front.

On EEXIST, verify the existing target matches the expected type to catch
mismatches early instead of deferring to a confusing mount error.

Close #39

Change-Id: I287c480fbe80301911e0b64702db2b6abb48a70f
@jserv jserv merged commit e6f833c into main Apr 5, 2026
5 checks passed
@jserv jserv deleted the compatibility branch April 5, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle file bind mounts in mount profiles instead of silent failure

1 participant