Skip to content

__main__: honour --device= in docker_shell_extra_arguments - #78

Open
bhcopeland wants to merge 1 commit into
kernelci:masterfrom
bhcopeland:device-dict-honour-device-arg
Open

__main__: honour --device= in docker_shell_extra_arguments#78
bhcopeland wants to merge 1 commit into
kernelci:masterfrom
bhcopeland:device-dict-honour-device-arg

Conversation

@bhcopeland

Copy link
Copy Markdown
Member

Device-dict mode only bound --volume= entries from docker_shell_extra_arguments and dropped everything else, so a device that needs a host device node in the container.

@bhcopeland
bhcopeland requested a review from roxell July 29, 2026 14:05
@bhcopeland

Copy link
Copy Markdown
Member Author

@roxell FYI

@roxell roxell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add tests?

Comment thread tuxrun/__main__.py Outdated
elif arg.startswith("--device="):
device_spec = arg[len("--device=") :]
parts = device_spec.split(":")
host_path = Path(parts[0])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--device= with an empty value binds the working dir. Path("") is . and it exists, so we will pass --device .:.:rw Think we should skip when parts[0] is empty.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack now skipped good spot

Comment thread tuxrun/__main__.py Outdated
device_spec = arg[len("--device=") :]
parts = device_spec.split(":")
host_path = Path(parts[0])
container_path = Path(parts[1]) if len(parts) > 1 else host_path

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this mean that we always pass rw even if the device dict asks for r ?and we end up giving more than whats asked for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, honours cgroup now.

Comment thread tuxrun/__main__.py Outdated
parts = device_spec.split(":")
host_path = Path(parts[0])
container_path = Path(parts[1]) if len(parts) > 1 else host_path
if host_path.exists():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if a device node is skipped silently that is fixed here, can we also add a warning to the log?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now logs a warning

@bhcopeland
bhcopeland force-pushed the device-dict-honour-device-arg branch from 09b84bd to 768cf0f Compare August 3, 2026 07:51
Device-dict mode only bound --volume= entries from a device dict's
docker_shell_extra_arguments and dropped everything else, so a device
that needs a host device node never got it passed into the container.

Parse --device= entries and bind them. Skip an empty host path, honour
the requested permissions (a bare "r" is read-only, otherwise
read-write) instead of always granting rw, and warn when a device is
skipped because its host path is missing. Render a read-only device as
a valid ":r" rather than the invalid ":ro". Extract the parsing into a
helper and cover it with unit tests.

Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
@bhcopeland
bhcopeland force-pushed the device-dict-honour-device-arg branch from 768cf0f to db67a05 Compare August 3, 2026 08: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.

2 participants