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

Fix incorrect retry when SIGINT reaches ssh #1015

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/remote.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,9 @@ let buildShellConnection shell host userOpt portOpt rootName termInteract =

Don't let these signals reach ssh by blocking them.

Unfortunately, a bug introduced in OpenSSH 9.6 (also present in 9.7)
breaks this workaround by unblocking SIGINT in the ssh process.

The signals could be ignored instead of being blocked because ssh
does not set handlers for SIGINT and SIGQUIT if they've been ignored
at startup. But this triggers an error in ssh. The interactive
Expand Down
6 changes: 4 additions & 2 deletions src/uitext.ml
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ let verifyMerge title text =
true
end

let intrcount = ref 0
let intrRequested () = !intrcount <> 0

type stateItem =
{ mutable ri : reconItem;
mutable bytesTransferred : Uutil.Filesize.t;
Expand Down Expand Up @@ -862,7 +865,6 @@ let doTransport reconItemList numskip isSkip =
in
Uutil.setProgressPrinter showProgress;

let intrcount = ref 0 in
let sigtermHandler _ =
if !intrcount >= 3 then raise Sys.Break;
Abort.all ();
Expand Down Expand Up @@ -1678,7 +1680,7 @@ and start2 () =
exit exitStatus
with
| Sys.Break -> terminate ()
| e when noRepeat || breakRepeat e -> begin
| e when noRepeat || breakRepeat e || intrRequested () -> begin
handleException e;
exit Uicommon.fatalExit
end
Expand Down
Loading