__main__: honour --device= in docker_shell_extra_arguments - #78
Open
bhcopeland wants to merge 1 commit into
Open
__main__: honour --device= in docker_shell_extra_arguments#78bhcopeland wants to merge 1 commit into
bhcopeland wants to merge 1 commit into
Conversation
Member
Author
|
@roxell FYI |
roxell
reviewed
Jul 31, 2026
| elif arg.startswith("--device="): | ||
| device_spec = arg[len("--device=") :] | ||
| parts = device_spec.split(":") | ||
| host_path = Path(parts[0]) |
Collaborator
There was a problem hiding this comment.
--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.
Member
Author
There was a problem hiding this comment.
ack now skipped good spot
| 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 |
Collaborator
There was a problem hiding this comment.
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?
Member
Author
There was a problem hiding this comment.
ack, honours cgroup now.
| 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(): |
Collaborator
There was a problem hiding this comment.
so if a device node is skipped silently that is fixed here, can we also add a warning to the log?
bhcopeland
force-pushed
the
device-dict-honour-device-arg
branch
from
August 3, 2026 07:51
09b84bd to
768cf0f
Compare
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
force-pushed
the
device-dict-honour-device-arg
branch
from
August 3, 2026 08:03
768cf0f to
db67a05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.