-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
AUR PKGBUILD download fails if git environment variables are set #1731
Comments
Yay could specifically unset these two env variables. Maybe it should? I cannot think of a situation where it would make sense for yay to transport these from the calling env. On the other hand, why would you set these globally? Do you never use git for anything else except for your dotfiles? A quick fix would of course be to write a small wrapper script that unsets |
I forgot to leave a rationale for reporting this as a bug, apologies. But yes, that's my thought process. As yay is dealing with its own git repos, it should isolate itself from the user's git settings, including the ones that are set from the environment. The fact that the user has some strange settings should not break yay's workflow.
Ah yes, I missed explaining this: these environment variables are not set globally, but rather loaded and unloaded based on the working directory of the shell; I'm personally doing this with a hook in zsh, but the same is achievable with tools such as direnv. |
I'm not sure that's true for all settings. I could imagine there might be some global git settings that should be respected (which?). Perhaps the reset-to-default-values should be an allowlist-approach, and not a blanket reset, with some exceptions?
Ah, that makes more sense. 🙂 |
My thought process was that any user settings have the potential to disrupt yay's operation, and as the repos yay manages are not user-visible, no user-defined settings should pass. |
+1 would appreciate yay's use of git isolating itself from the user git settings / not inheriting any config issues the user makes To add onto the bug report... GIT_SSL_NO_VERIFY would be a dangerous envvar for a user to pass unknowingly into yay's process that they could hypothetically have set if using arch for work and the workplace has poor practices around git repos... If we're looking at a whitelist of git envars for yay to accept i'd only take the following config variables used for committing and user identification as part of yay's process since it allows for editting the pkgbuild and i cant think of a way they'd be misconfigured in a breaking manner...
|
This sounds ridiculous to me. "It would be dangerous if the user set a dangerous option". The options named above that are suggested to be whitelisted are actually the option that yay overrides by default. Then there's other settings like pager, diff tool, gpgsign. If the user has configured git in a way that breaks it it's on them IMO. |
Users might have a valid reason to, in particular and isolated cases, want to knowingly set that option, for instance, for a specific local network git repo they work with that does not have a "valid" TLS cert. The danger of
To me as a user, it's unexpected that yay would follow the same behaviour set for a different repo of mine, just because one or more environment variables happen to be set.
I think this is a fair point, if the criteria used is that these affect the parts of git that end up exposed to the user through yay. |
I agree with @Morganamilo in principle. But I also think that there might be some exceptions (like GIT_DIR and GIT_WORK_TREE) that yay could prune from the environment. Sort of as a favor to the user, because they're not really useful to yay anyway. But I'd suggest to keep that list as clear-cut and minimal as possible, because after all, by setting env vars you are kind of explicitly setting global git config values that should apply to all git operations, even those done "under the hood". |
Good to know lol
I agree in principal aswell, but it wouldn't hurt to have some logic inplace to warn them they've done a potential dumb would it?
It comes down to threat model. It could be an acceptable risk option if they believe it's only applicable to one intranet or local repo, but a completely unacceptable risk to apply to sourcing application / software updates through yay. In my opinion it would be good to have yay handle that in the same manner as gpgsign / difftool etc by overriding it and exposing that override in yay.conf or pruning it out. Theres a difference between letting a user set env vars that break yay and letting the user accidentally apply a dangerous config to yay that reduces the security of yay through ignorance of an unexpected interaction imo. Edit: and yes, for alot of AUR helper users (thanks manjaro) not thinking about the interaction between git globals and the helper tool is definitely becoming a thing |
Affected Version
yay v11.1.2 - libalpm v13.0.1
Describe the bug
If either of the environment variables
GIT_DIR
andGIT_WORK_TREE
are set, yay will fail when downloading PKGBUILD.Reproduction Steps
GIT_DIR
andGIT_WORK_TREE
.Expected behavior
The install or upgrade procedure would work correctly, and install the AUR package.
Output
yay config:
Content of the relevant environment variables:
Attempt to install a new AUR package as normal with the git environment variables set makes yay fail:
Un-setting
GIT_WORK_TREE
when running yay is not enough and will fail as well:Un-setting both
GIT_WORK_TREE
andGIT_DIR
makes yay behave correctly:The text was updated successfully, but these errors were encountered: