Skip to content

Commit

Permalink
Merge pull request #1015 from tleedjarv/fix-sshintr
Browse files Browse the repository at this point in the history
Fix incorrect retry when SIGINT reaches ssh
  • Loading branch information
gdt authored Apr 26, 2024
2 parents 5f07978 + 6f2ec4b commit 795e0d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 795e0d8

Please sign in to comment.