Skip to content
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: Add a git safe.directory #4830

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

richb-hanover
Copy link
Contributor

Add the github command in the Taskfile.yaml to add a git safe.directory;
Call that command from the postCreateCommand in devcontainer.json;
Fixes #4817

Call that command from the postCreateCommand in devcontainer.json
@richb-hanover richb-hanover changed the title Add a git safe.directory build: Add a git safe.directory Aug 17, 2024
@max-sixty
Copy link
Member

Great, thanks @richb-hanover !

@max-sixty max-sixty merged commit 701194e into PRQL:main Aug 17, 2024
32 of 34 checks passed
@@ -382,6 +382,9 @@ tasks:
dir: prqlc/bindings/php
cmds:
- vendor/bin/phpunit tests

add-safe-directory:
- git config --global --add safe.directory /workspaces/prql
Copy link
Member

Choose a reason for hiding this comment

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

I do not think this should be included in the Taskfile. There are very limited situations where this absolute path is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see the difficulty. /workspaces/prql works fine for the Dev Container, but is unlikely to be valid in most other situations.

How could this be modified?

(I suspect this bites 100% of people who work on PRQL. For those who compile natively, it's a one-time fix; for Dev Container folks (like me) I have to re-run this command each time the container gets rebuilt...)

Copy link
Member

Choose a reason for hiding this comment

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

I tend to agree with the downside, but where should it go?

(and do you happen to know why we get this problem?)

Copy link
Member

Choose a reason for hiding this comment

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

I have not seen this problem occur, and if it does occur, it is most likely a problem with the devcontainer CLI and should not be addressed in this repository.
I suggest reverting this change.

Copy link
Member

Choose a reason for hiding this comment

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

(and do you happen to know why we get this problem?)

Maybe this issue microsoft/vscode-remote-release#8656

Copy link
Member

Choose a reason for hiding this comment

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

I am quite skeptical about the conditions under which this problem arises in the first place.
You see, I have been using Dev Containers for years and have never encountered this problem (of course, it was only relatively recently, a few years ago, when Git security was changed and this kind of error started occurring).

But my suspicion is that it is a user manipulation issue and that setting this up for all containers is the wrong direction.
At the very least, we should be very aware that this is an issue that should be resolved upstream and reported upstream.

Copy link
Member

Choose a reason for hiding this comment

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

We're not the only repo which has this problem — my link above was: https://github.com/codespell-project/codespell/pull/3361/files...

I agree with the principle of solving the root issue rather than adding our patches — but adding a small patch with a TODO: not sure why we need this, but we get error $foo without it close to the issue seems like a reasonable balance, no?

Copy link
Member

@eitsupi eitsupi Aug 19, 2024

Choose a reason for hiding this comment

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

Sorry, I did check and it seems that even moby is doing that....... (moby/moby#44930)
https://github.com/moby/moby/blob/5efbb60a4efa327301066fa4960b25d8917bf776/Dockerfile#L516-L518

but adding a small patch with a TODO: not sure why we need this, but we get error $foo without it close to the issue seems like a reasonable balance, no?

Of course, if this issue has been reported upstream and it is clear that this is the appropriate workaround for the current situation, then I think it is appropriate to make this change to this repository.

Copy link
Member

Choose a reason for hiding this comment

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

OK, let's wait to hear from the upstream issue then. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's move this conversation to #4836 (comment) which has much more context

@richb-hanover
Copy link
Contributor Author

@max-sixty @eitsupi - I didn't mention you in my previous response, and wasn't sure if you would be notified...

eitsupi added a commit that referenced this pull request Aug 18, 2024
@eitsupi
Copy link
Member

eitsupi commented Aug 18, 2024

I didn't mention you in my previous response, and wasn't sure if you would be notified...

This PR was notified while I was out, but was merged before I got home, thus the delay in commenting.

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.

DevContainer: Need to run git config ... --add safe.directory one time
3 participants