Re: [PATCH] git-svn: workaround for a bug in svn serf backend
- From
Roman Kagan <rkagan@mail.ru>
- Date
- Dec 30, 2013, 16:01 UTC
- Message-ID
- <CANiYKX5Nd8YTsAKshma_-Ezqzw1tkC_-UJas0_oDxUZbcfaAAA@mail.gmail.com>
- In-Reply-To
- <87lhz2o7ht.fsf@thomasrast.ch>
2013/12/30 Thomas Rast <tr@thomasrast.ch>:
Show 18 quoted lines
> Roman Kagan <rkagan@mail.ru> writes:
>
>> + # 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.No. The string is needed in subversion's close_file(), so we want to keep it alive until close_file() returns. Surviving till the end of the current function scope is sufficient for that.
> However, does Perl make any guarantees as to the order in which local > variables are unreferenced and then destroyed?
We don't care about the order they are destroyed WRT each other.
Roman.