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

Run GPG in shell on Unix as well (#7467) #7575

Merged
merged 2 commits into from
Mar 12, 2025
Merged

Conversation

Byron
Copy link
Collaborator

@Byron Byron commented Mar 11, 2025

This way there are higher chances of picking up the required PATH configuration, making
signing operations more likely to work.

Fixes #7467 .

Tasks

  • implementation
  • see if this improves anything on MacOS (where signing doesn't work for me either without running from a terminal)
    • It doesn't just magically work for me which is expected as sh isn't zsh, which would be more likely to work
  • try with SHELL.
    • It still doesn't work for me, despite zsh, but that's merely a problem of my setup which requires a login shell. Screenshot 2025-03-11 at 12 16 31
    • However, I think doing this will greatly improve the chances that signing works out of the box.
  • ❌ validate on windows (not easy, forgot there is a special incantation for ARM VMs), but nonetheless it doesn't startup, giving a null-pointer exception somewhere in tauri each time.

Copy link

vercel bot commented Mar 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2025 4:18am

@vercel vercel bot temporarily deployed to Preview – gitbutler-components March 11, 2025 03:43 Inactive
Copy link

vercel bot commented Mar 11, 2025

@Byron is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

This way there are higher chances of picking up the required PATH configuration, making
signing operations more likely to work.
)

The `SHELL` environment variable is set on MacOS to represent the login shell.
It is probably more likely to yield an environment that can run the signing program.

Note that doing so usually is dangerous as well if scripts were to be used,
but that's not the case here - we know a program is provided.
@Byron
Copy link
Collaborator Author

Byron commented Mar 11, 2025

@krlvi Maybe you could take a look and try the Windows version, something that I failed to do unfortunately due to strange technical issues on this machine. The reason it should be tried is that now the SHELL environment variable is read, and I'd hope this is nothing strange on Windows (like powershell) which might make something that worked before fail. Thank you.

@Byron Byron marked this pull request as ready for review March 11, 2025 06:19
@krlvi
Copy link
Member

krlvi commented Mar 11, 2025

@krlvi Maybe you could take a look and try the Windows version, something that I failed to do unfortunately due to strange technical issues on this machine. The reason it should be tried is that now the SHELL environment variable is read, and I'd hope this is nothing strange on Windows (like powershell) which might make something that worked before fail. Thank you.

Thanks for this. I will try to validate this today

@krlvi
Copy link
Member

krlvi commented Mar 11, 2025

@Byron I was able to test signing working correctly on Windows with this branch. Both in the test UI as well as in commit creation.

Unfortunately setting gpg.program is not enough:
image

But if I set it in GitButler, signing works

image

@Byron Byron merged commit 2c9a565 into gitbutlerapp:master Mar 12, 2025
22 of 23 checks passed
@Byron Byron deleted the fix-7467 branch March 12, 2025 00:29
@Byron
Copy link
Collaborator Author

Byron commented Mar 12, 2025

Thanks so much for validating!

It's interesting that the --global configuration doesn't work even though it should, and makes it seem like gix doesn't pickup --global options in this environment.
I took a look and global corresponds to C:/Users/byron/.gitconfig on a user's machine, which is a file that would be picked up (gix config shows it, too).

Something I find strange is the need to use msys-paths, but maybe /'ed paths would work as well , i.e. c:/foo/gpg. It's good to see that /c/ paths also work, which means that using the Git shell is doing the trick.

@Byron
Copy link
Collaborator Author

Byron commented Mar 12, 2025

Now that I could build and run the application, I could finally check what's in the environment on Windows.

This is when launching the dev version from a terminal:

Screenshot 2025-03-12 at 08 59 07

The shell is the one set by the terminal. Unfortunately the debug-build itself doesn't bring up the UI so I could not see what actually happens in a 'normal' instance.
I'd assume that SHELL isn't set then, which means it gets the same value as before (the one determined by gitoxide).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken git signing
2 participants