-
Notifications
You must be signed in to change notification settings - Fork 2.1k
makefiles/docker: fix mounting localtime on OSX #10568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is this an alternative to #10564 ? (or a duplicate ?) |
its a duplicate in a way ... at least I was slower in opening the PR here. I worked on it today and found a solution, made a branch in RIOT and posted the solution in the respective issue at docker/for-mac but haven't opened the PR right away. Seems like @jthacker was quicker with the PR ... though I find my solution with the variable cleaner. Anyway, we can close this one I guess. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach better than #10564 as having a separate variable makes it easier to see and document it is a workaround for a buggy docker.
makefiles/docker.inc.mk
Outdated
@@ -94,6 +94,9 @@ _is_git_worktree = $(shell grep '^gitdir: ' $(RIOTBASE)/.git 2>/dev/null) | |||
GIT_WORKTREE_COMMONDIR = $(shell git rev-parse --git-common-dir) | |||
DOCKER_VOLUMES_AND_ENV += $(if $(_is_git_worktree),-v $(GIT_WORKTREE_COMMONDIR):$(GIT_WORKTREE_COMMONDIR)) | |||
|
|||
# Resolve symlink of /etc/localtime to its real path | |||
ETC_LOCALTIME := $(shell realpath /etc/localtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for immediate assignment here
ETC_LOCALTIME := $(shell realpath /etc/localtime) | |
ETC_LOCALTIME = $(shell realpath /etc/localtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here simply the $(realpath
function can be used as it should resolve symlinks.
Question here, there were many PRs before, to not use |
@cladmi you're right, but the other problem is though So we need to distinguish between OS here, I'd say. |
To really solve this once and for all RIOT needs a proper system init, that is: check the OS and lookup all the tools and stuff and set ENV accordingly. |
Does make's inbuilt realpath work for this? Also, the question here is, did you have to install |
It does not break anything on linux, squash and let's move forward. |
Funny to see that except the variable, after reviews this PR is now proposing the same fix as in #10564. |
@aabadie it was mainly about the variable from the beginning, but still you're |
Mounting `/etc/localtime` directly does not work on macOS (anymore). However, by resolving the symlink to its real path docker can handle the mount.
[the variable] and documentation |
True, even the PR/commit title was nicer in the other one. Anyways, this is not a competition to see who gets his fix first, it is about getting fixes done, I'm sure @jthacker will be happy that the issue is solved, whoever authors the patch is secondary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it does not break Linux. The only possible drawback of this is that now the (very approximate) location of the user is printed on the command line and therefore in build logs.
Copied solution from: RIOT-OS/RIOT#10568 Signed-off-by: Luke Mondy <luke.mondy@data61.csiro.au>
Copied solution from: RIOT-OS/RIOT#10568 Signed-off-by: Luke Mondy <luke.mondy@data61.csiro.au>
Copied solution from: RIOT-OS/RIOT#10568 Signed-off-by: Luke Mondy <luke.mondy@data61.csiro.au>
Copied solution from: RIOT-OS/RIOT#10568 Signed-off-by: Luke Mondy <luke.mondy@data61.csiro.au>
Copied solution from: RIOT-OS/RIOT#10568 Signed-off-by: Luke Mondy <luke.mondy@data61.csiro.au>
Contribution description
Mounting
/etc/localtime
directly does not work on macOS (anymore).However, by resolving the symlink to its real path docker can handle
the mount on macOS again - should also work with Linux.
Testing procedure
Try to run
BUILD_IN_DOCKER=1 make -C tests/minimal
on macOS, which will fail with one or the other error regarding either that/etc
is not shared and hence not accessible by docker, or if you do add it to the list of shared folders, it will fail with mounting/etc/localtime
into docker. With this PR it works again.Issues/PRs references
Fixes #10287.