RE: [viewvc-dev] [PATCH] Fix issue #519: "Stack trace while accessing a BDB repository if last commit deleted a file or directory"

vijayaguru guruchave <[email protected]> Tue, 29 Jan 2013 22:28:11 +0530
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <00204DFF376536408E3A4C93718C03C2EF5848__44468.4671158486$1359478858$gmane$org@maa-exchmb.maa.corp.collab.net>
------=_Part_3853_129173894.1359478837719
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

Yes. This patch looks good. Thanks for backporting it to 1.1.18.

There is a typo in r2827 log message.
s/_get_changed_copyinfo/_get_change_copyinfo

Thanks & Regards,
Vijayaguru



-----Original Message-----
From: C. Michael Pilato [mailto:[email protected]]
Sent: Tue 1/29/2013 8:27 PM
To: Vijayaguru Guruchave
Cc: [email protected]
Subject: Re: [viewvc-dev] [PATCH] Fix issue #519: "Stack trace while access=
ing a BDB repository if last commit deleted a file or directory"
=20
On 01/29/2013 08:06 AM, vijayaguru guruchave wrote:
> Hi,
>=20
> This patch fixes issue #519:"Stack trace while accessing a BDB=20
> repository if last commit deleted a file or directory".[1]
>=20
> The patch and log message are attached.
>=20
> [1] http://viewvc.tigris.org/issues/show_bug.cgi?id=3D519
>=20
> Thanks & Regards,
> Vijayaguru
>=20
> P.S: I can't find an answer why we don't get any exception while=20
> accessing a FSFS repository of same directory structure.

The FSFS repository doesn't exhibit the problem because FSFS sets the
"copyfrom_known" flag on the 'change' structure (which means that
svn_fs_copied_from() doesn't have to be called at all).

Thanks for the patch, but I think the following would be a better one.
Rather than fine-tuning the way we call _get_change_copyfrom() in this
instance, I think it's better to just ensure that _get_change_copyfrom() is
smarter about how it returns its answers.  What do you think?

Index: svn_repos.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- svn_repos.py=09(revision 2826)
+++ svn_repos.py=09(working copy)
@@ -644,11 +644,19 @@
       return found_readable, found_unreadable, changedpaths.values()

     def _get_change_copyinfo(fsroot, path, change):
+      # If we know the copyfrom info, return it...
       if hasattr(change, 'copyfrom_known') and change.copyfrom_known:
         copyfrom_path =3D change.copyfrom_path
         copyfrom_rev =3D change.copyfrom_rev
+      # ...otherwise, if this change could be a copy, check the
+      # copyfrom info ...
+      elif (change.change_kind =3D=3D fs.path_change_add or
+            change.change_kind =3D=3D fs.path_change_replace):
+        copyfrom_rev, copyfrom_path =3D fs.copied_from(fsroot, path)
+      # ...else, there's no copyfrom info to return.
       else:
-        copyfrom_rev, copyfrom_path =3D fs.copied_from(fsroot, path)
+        copyfrom_rev =3D core.SVN_INVALID_REVNUM
+        copyfrom_path =3D None
       return copyfrom_path, copyfrom_rev

     def _simple_auth_check(fsroot):


--=20
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=3D4251&dsMessageId=3D3=
046591

To unsubscribe from this discussion, e-mail: [[email protected]=
.org].
------=_Part_3853_129173894.1359478837719
Content-Type: text/html;	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-=
1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 6.5.7653.38"=
>
<TITLE>RE: [viewvc-dev] [PATCH] Fix issue #519: &quot;Stack trace while acc=
essing a BDB repository if last commit deleted a file or directory&quot;</T=
ITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=3D2>Yes. This patch looks good. Thanks for backporting it to =
1.1.18.<BR>
<BR>
There is a typo in r2827 log message.<BR>
s/_get_changed_copyinfo/_get_change_copyinfo<BR>
<BR>
Thanks &amp; Regards,<BR>
Vijayaguru<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: C. Michael Pilato [<A HREF=3D"mailto:[email protected]">mailto:cmpi=
[email protected]</A>]<BR>
Sent: Tue 1/29/2013 8:27 PM<BR>
To: Vijayaguru Guruchave<BR>
Cc: [email protected]<BR>
Subject: Re: [viewvc-dev] [PATCH] Fix issue #519: &quot;Stack trace while a=
ccessing a BDB repository if last commit deleted a file or directory&quot;<=
BR>
<BR>
On 01/29/2013 08:06 AM, vijayaguru guruchave wrote:<BR>
&gt; Hi,<BR>
&gt;<BR>
&gt; This patch fixes issue #519:&quot;Stack trace while accessing a BDB<BR=
>
&gt; repository if last commit deleted a file or directory&quot;.[1]<BR>
&gt;<BR>
&gt; The patch and log message are attached.<BR>
&gt;<BR>
&gt; [1] <A HREF=3D"http://viewvc.tigris.org/issues/show_bug.cgi?id=3D519">=
http://viewvc.tigris.org/issues/show_bug.cgi?id=3D519</A><BR>
&gt;<BR>
&gt; Thanks &amp; Regards,<BR>
&gt; Vijayaguru<BR>
&gt;<BR>
&gt; P.S: I can't find an answer why we don't get any exception while<BR>
&gt; accessing a FSFS repository of same directory structure.<BR>
<BR>
The FSFS repository doesn't exhibit the problem because FSFS sets the<BR>
&quot;copyfrom_known&quot; flag on the 'change' structure (which means that=
<BR>
svn_fs_copied_from() doesn't have to be called at all).<BR>
<BR>
Thanks for the patch, but I think the following would be a better one.<BR>
Rather than fine-tuning the way we call _get_change_copyfrom() in this<BR>
instance, I think it's better to just ensure that _get_change_copyfrom() is=
<BR>
smarter about how it returns its answers.&nbsp; What do you think?<BR>
<BR>
Index: svn_repos.py<BR>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>
--- svn_repos.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (revision 2826)<=
BR>
+++ svn_repos.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (working copy)<B=
R>
@@ -644,11 +644,19 @@<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return found_readable, found_unreadabl=
e, changedpaths.values()<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; def _get_change_copyinfo(fsroot, path, change):<BR=
>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If we know the copyfrom info, return it..=
.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if hasattr(change, 'copyfrom_known') a=
nd change.copyfrom_known:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_path =3D change.c=
opyfrom_path<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_rev =3D change.co=
pyfrom_rev<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # ...otherwise, if this change could be a c=
opy, check the<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # copyfrom info ...<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elif (change.change_kind =3D=3D fs.path_cha=
nge_add or<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; change.=
change_kind =3D=3D fs.path_change_replace):<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_rev, copyfrom_path =3D=
 fs.copied_from(fsroot, path)<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # ...else, there's no copyfrom info to retu=
rn.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_rev, copyfrom_path =3D=
 fs.copied_from(fsroot, path)<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_rev =3D core.SVN_INVAL=
ID_REVNUM<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copyfrom_path =3D None<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return copyfrom_path, copyfrom_rev<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; def _simple_auth_check(fsroot):<BR>
<BR>
<BR>
--<BR>
C. Michael Pilato &lt;[email protected]&gt;<BR>
CollabNet&nbsp;&nbsp; &lt;&gt;&nbsp;&nbsp; www.collab.net&nbsp;&nbsp; &lt;&=
gt;&nbsp;&nbsp; Enterprise Cloud Development<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>
------=_Part_3853_129173894.1359478837719--