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

Re: [PATCH] git-svn: workaround for a bug in svn serf backend

From
Thomas Rast <tr@thomasrast.ch>
Date
Dec 30, 2013, 12:20 UTC
Message-ID
<87lhz2o7ht.fsf@thomasrast.ch>
In-Reply-To
<1388059524-4864-1-git-send-email-rkagan@mail.ru>
Roman Kagan <rkagan@mail.ru> writes:
Show 7 quoted lines
> +	# workaround for a bug in svn serf backend (v1.8.5 and below):
> +	# store 3d argument to ->add_file() in a local variable, to make it
> +	# have the same lifetime as $fbat
> +	my $upa = $self->url_path($m->{file_a});
>  	my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
> -				$self->url_path($m->{file_a}), $self->{r});
> +				$upa, $self->{r});
Hmm, now that you put it that way, I wonder if the patch is correct.
Let me first rephrase the problem to verify that I understand the issue:
  $fbat keeps a pointer to the $upa string, without maintaining a
  reference to it.  When $fbat is destroyed, it needs this string, so we
  must ensure that the lifetime of $upa is at least as long as that of
  $fbat.

However, does Perl make any guarantees as to the order in which local variables are unreferenced and then destroyed? I can't find any such guarantee.

In the absence of such, wouldn't we have to keep $upa in an outer, separate scope to ensure that $fbat is destroyed first?

-- 
Thomas Rast
tr@thomasrast.ch
Previous: Andreas StrickerNext: Roman Kagan
Message 25 of 27 in “Fwd: Error with git-svn pushing a rename”
  1. Benjamin PabstNov 14, 2013
  2. Andreas StrickerNov 15, 2013
  3. Andreas StrickerNov 15, 2013
  4. Jonathan NiederNov 15, 2013
  5. Andreas StrickerNov 17, 2013
  6. Benjamin PabstNov 20, 2013
  7. Roman KaganDec 24, 2013
  8. Roman KaganDec 25, 2013
  9. Roman KaganDec 25, 2013
  10. Thomas RastDec 25, 2013
  11. git-svn: workaround for a bug in svn serf backendRoman Kagan, Dec 26, 2013
  12. Jonathan NiederDec 26, 2013
  13. Roman KaganDec 27, 2013
  14. Roman KaganDec 27, 2013
  15. git-svn: workaround for a bug in svn serf backendRoman Kagan, Dec 27, 2013
  16. Jonathan NiederDec 27, 2013
  17. Eric WongDec 27, 2013
  18. Junio C HamanoDec 27, 2013
  19. Roman KaganDec 28, 2013
  20. Junio C HamanoDec 30, 2013
  21. Roman KaganDec 31, 2013
  22. Roman KaganJan 17, 2014
  23. Junio C HamanoJan 17, 2014
  24. Andreas StrickerJan 6, 2014
  25. Thomas RastDec 30, 2013
  26. Roman KaganDec 30, 2013
  27. Benjamin PabstNov 18, 2013

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.