-
Notifications
You must be signed in to change notification settings - Fork 222
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
build: Move git config ... add safe.directory to a script within .devcontainer #4836
base: main
Are you sure you want to change the base?
Conversation
# Since these are called by the .devcontainer/devcontainer.json's `postCreateCommand` | ||
# they won't affect people building the software natively | ||
|
||
git config --global --add safe.directory /workspaces/prql |
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 observed the need for the git config ... --add safe.directory ... command in three environments: macOS 12.7.5 on Intel, macOS 14.5 on M2, and Win 11. So there's something about the DevContainer that triggers/requires it. This PR works around it cleanly.
Any thoughts on why this is needed in this repository and not in others?
Have you reported this issue upstream?
In my opinion, this is a problem that should be resolved upstream, and doing something about it here is the wrong direction.
@eitsupi Thank you for insisting I look further. I found a good article that seems to explain the situation. Avoiding Dubious Ownership in Dev Containers IIUC, the situation where the volume mounted by the container is owned by root, while the source code folders are owned by vscode could lead to mischief in certain environments. That causes This leads me to a few observations:
Thanks |
@richb-hanover Again, could you please report this issue upstream? This should not be a problem specific to this repository, and it would be quite silly to make such a change in all repositories that use devcontainer. |
@eitsupi - I would ask for your help creating the report for upstream. I assume it should go here: https://github.com/microsoft/vscode-remote-release/issues Here's my first draft of a report - your comments would be appreciated: SUBJECT: Dev Container gives "dubious ownership" error message I have a Dev Container whose Dockerfile has this form:
Using current versions of Docker Desktop on both macOS and Windows, I see this error:
I first noticed this a while ago - maybe two-three months, but I'm not sure. My questions:
Many thanks. |
@richb-hanover Thanks, your draft looks good. |
Posted at microsoft/vscode-remote-release#10179 |
This is another way to solve #4830. It places the
git config ... --add safe.directory ...
command into a shell script (post_create.sh) within the .devcontainer directory.It gets invoked by the devcontainer.json
postCreateCommand
section, so it only applies to Dev Container builds, and won't hassle people who build PRQL natively.Other observations:
I observed the need for the
git config ... --add safe.directory ...
command in three environments: macOS 12.7.5 on Intel, macOS 14.5 on M2, and Win 11. So there's something about the DevContainer that triggers/requires it. This PR works around it cleanly.This script also installs
pre-commit
so that commands liketask test-lint
always work without error.