git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [[PATCH v2]] Fix bug when more than one readline instance is used

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 10, 2023, 14:31 UTC
Message-ID
<xmqqmsyzhsto.fsf@gitster.g>
In-Reply-To
<20230810011831.1423208-1-wesleys@opperschaap.net>
Wesley Schwengle <wesleys@opperschaap.net> writes:
> Subject: Re: [[PATCH v2]] Fix bug when more than one readline instance is used

Thanks. Again, our convention is to make sure that, even only with the title, readers would know what the commit is about. The above does not even hint which part of the system the bug was about. By stealing from what Peff already has done, we can call this

    Subject: [PATCH v2] git-svn: avoid creating more than one Term::ReadLine object

to mimic c016726c (send-email: avoid creating more than one Term::ReadLine object, 2023-08-08). Also, please do not double the [brackets] around the "PATCH".

> A followup[^1] for git-svn.perl on d42e4ca9f8 where this bug was solved
> for git-send-email.perl
>
> [^1]: https://lore.kernel.org/git/20230810004956.GA816605@coredump.intra.peff.net/T/#t

Once a commit is in 'next', its commit object name will generally be stable, hence, taken as a whole, something like:

    git-svn: avoid creating more than one than one Term::ReadLine object
    Newer (v1.46) Term::ReadLine::Gnu would not like us to ask it to
    create multiple readline instances.  c016726c (send-email: avoid
    creating more than one Term::ReadLine object, 2023-08-08)
    adjusted git-send-email to this change.  Make the same
    adjustment to git-svn.
    While at it, drop the same FakeTerm hack, just like dfd46bae
    (send-email: drop FakeTerm hack, 2023-08-08) did, for exactly
    the same reason.

I'll queue the patch with the above commit log message for tonight, so unless you have improvements over it, there is no need to resend.

Thanks.
Show 45 quoted lines
> Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
> ---
>  git-svn.perl | 27 +++++++++------------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index be987e316f..93f6538d61 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -297,27 +297,18 @@ sub _req_svn {
>  		{} ],
>  );
>  
> -package FakeTerm;
> -sub new {
> -	my ($class, $reason) = @_;
> -	return bless \$reason, shift;
> -}
> -sub readline {
> -	my $self = shift;
> -	die "Cannot use readline on FakeTerm: $$self";
> -}
>  package main;
>  
> -my $term;
> -sub term_init {
> -	$term = eval {
> +{
> +	my $term;
> +	sub term_init {
> +		return $term if $term;
>  		require Term::ReadLine;
> -		$ENV{"GIT_SVN_NOTTY"}
> -			? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
> -			: new Term::ReadLine 'git-svn';
> -	};
> -	if ($@) {
> -		$term = new FakeTerm "$@: going non-interactive";
> +		$term = $ENV{"GIT_SVN_NOTTY"}
> +				? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
> +				: new Term::ReadLine 'git-svn';
> +		};
> +		return $term;
>  	}
>  }
Previous: Wesley SchwengleNext: Wesley
Message 4 of 14 in “Fix bug when more than one readline instance is used”
  1. Fix bug when more than one readline instance is usedWesley Schwengle, Aug 10, 2023
  2. Jeff KingAug 10, 2023
  3. ] Fix bug when more than one readline instance is usedWesley Schwengle, Aug 10, 2023
  4. Junio C HamanoAug 10, 2023
  5. WesleyAug 10, 2023
  6. Junio C HamanoAug 11, 2023
  7. WesleyAug 11, 2023
  8. Junio C HamanoAug 11, 2023
  9. Jeff KingAug 11, 2023
  10. Junio C HamanoAug 11, 2023
  11. git-svn: drop FakeTerm hackJunio C Hamano, Aug 30, 2023
  12. Jeff KingAug 31, 2023
  13. Junio C HamanoAug 31, 2023
  14. Junio C HamanoAug 10, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.