Revision d11c51eec8a77e7f9af214b0d0c0e1d1ff951883 authored by Jeff King on 08 August 2023, 18:15:31 UTC, committed by Junio C Hamano on 21 May 2024, 19:33:07 UTC
Every time git-send-email calls its ask() function to prompt the user,
we call term(), which instantiates a new Term::ReadLine object. But in
v1.46 of Term::ReadLine::Gnu (which provides the Term::ReadLine
interface on some platforms), its constructor refuses to create a second
instance[1]. So on systems with that version of the module, most
git-send-email instances will fail (as we usually prompt for both "to"
and "in-reply-to" unless the user provided them on the command line).

We can fix this by keeping a single instance variable and returning it
for each call to term(). In perl 5.10 and up, we could do that with a
"state" variable. But since we only require 5.008, we'll do it the
old-fashioned way, with a lexical "my" in its own scope.

Note that the tests in t9001 detect this problem as-is, since the
failure mode is for the program to die. But let's also beef up the
"Prompting works" test to check that it correctly handles multiple
inputs (if we had chosen to keep our FakeTerm hack in the previous
commit, then the failure mode would be incorrectly ignoring prompts
after the first).

[1] For discussion of why multiple instances are forbidden, see:
    https://github.com/hirooih/perl-trg/issues/16

[jc: cherry-picked from v2.42.0-rc2~6^2]

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent fde2b4b
History
File Mode Size
.gitignore -rw-r--r-- 30 bytes
README.md -rw-r--r-- 13.9 KB
TEAMS -rw-r--r-- 2.7 KB
bg.po -rw-r--r-- 922.3 KB
ca.po -rw-r--r-- 681.4 KB
de.po -rw-r--r-- 686.1 KB
el.po -rw-r--r-- 524.1 KB
es.po -rw-r--r-- 655.0 KB
fr.po -rw-r--r-- 695.0 KB
id.po -rw-r--r-- 763.4 KB
is.po -rw-r--r-- 3.3 KB
it.po -rw-r--r-- 773.6 KB
ko.po -rw-r--r-- 557.5 KB
pl.po -rw-r--r-- 803.7 KB
pt_PT.po -rw-r--r-- 729.6 KB
ru.po -rw-r--r-- 648.7 KB
sv.po -rw-r--r-- 650.3 KB
tr.po -rw-r--r-- 671.2 KB
vi.po -rw-r--r-- 721.9 KB
zh_CN.po -rw-r--r-- 736.9 KB
zh_TW.po -rw-r--r-- 736.8 KB

README.md

back to top