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

Prevent git from hanging a process #6140

Closed
wants to merge 1 commit into from

Conversation

b10n1k
Copy link
Contributor

@b10n1k b10n1k commented Jan 28, 2025

  • Use of a timeout when IPC::Run invokes
  • Enhance error message and notify user for likely solution

I tried to catch the prompt but I assume that the process is not running in a tty and IPC::Run could not get the output.

https://progress.opensuse.org/issues/174592

* Use of a timeout when IPC::Run invokes
* Enhance error message and notify user for likely solution

I tried to catch the prompt but I assume that the process is not
running in a tty and IPC::Run could not get the output.

Signed-off-by: Ioannis Bonatakis <ybonatakis@suse.com>
return_code => undef,
stderr => 'an internal error occurred',
stdout => '',
my $additional_info = "If you use http for CASEDIR or NEEDLES_DIR is adviced to
Copy link
Contributor

Choose a reason for hiding this comment

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

run_cmd_with_log_return_error is a general purpose function not only used for git commands.
It doesn't make sense to add a message about git here.

Also, we shouldn't add lengthy directions into the error message, but link to the documentation, as it was suggested in the ticket

my $additional_info = "If you use http for CASEDIR or NEEDLES_DIR is adviced to
configure git with the insteadof option in the .gitconfig file.
Run the following command to:
git config [--global] url.\"git://github.com\".insteadOf https://github.com";
Copy link
Contributor

Choose a reason for hiding this comment

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

url.insteadOf is not what we want. it is url.pushInsteadOf, which is an important difference.
We still want the fetch to happen with http.

my @cmd;
push @cmd, 'env', 'GIT_SSH_COMMAND=ssh -oBatchMode=yes' if $ssh_batchmode;
push @cmd, 'env', 'GIT_SSH_COMMAND=ssh -oBatchMode=yes' if $batchmode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you not use GIT_ASKPASS and GIT_TERMINAL_PROMPT like suggested in the ticket?
Waiting for a timing out command seems way more complicated than just telling git to not prompt in the first place.

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 was thinking that with the timeout we gonna have a general solution when the _run_cmd (or more specifically run_cmd_with_log_return_error) encounter similar issue.
GIT_ASKPASS and GIT_TERMINAL_PROMPT make the logic more complicated IMO but also provide a better error as I didnt find a way to catch the prompt in the $stdout somehow.
Maybe both can be applied at the end.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what's complicated about using two env vars. It's as simple as it gets?

Copy link
Contributor

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

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

See my alternative suggestion: #6141

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

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

rebase on top of #6141

@b10n1k
Copy link
Contributor Author

b10n1k commented Jan 29, 2025

rebase on top of #6141

I didnt notice and I didnt know about this. Again two ppl work on the same thing

@b10n1k
Copy link
Contributor Author

b10n1k commented Jan 29, 2025

rebase on top of #6141

I didnt notice and I didnt know about this. Again two ppl work on the same thing

This is not merged tho. what do you mean?

@b10n1k
Copy link
Contributor Author

b10n1k commented Jan 29, 2025

closed in favor of #6141

@b10n1k b10n1k closed this Jan 29, 2025
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.

3 participants