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

"C. Michael Pilato" <[email protected]> Tue, 29 Jan 2013 09:57:01 -0500
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization CollabNet, Inc.
Message-ID <[email protected]>
------=_Part_3773_1539750914.1359471425104
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

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=
046579

To unsubscribe from this discussion, e-mail: [[email protected]=
.org].
------=_Part_3773_1539750914.1359471425104
Content-Type: application/pgp-signature; name=signature.asc
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=signature.asc
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJRB+M9AAoJEPXg8AH+aBMzQkcP/i7693K47lOflHVErjBz63Oi
kxyN3VPVlDPNjXrvYZE6Hyw99G8qJMBYks2YQcWQVhJBU5YtYyzdsfwDVEGk4pAX
/7KwQY9Mw2gWTsLW1ZB1ckHrgf5ztHZKyYrhZkcWSl7T/NbgjqW8BgMAkwzVI4tT
ztzELvMAlLxGX7XeLrx4Z+M6DUc7iEUer9svRcV28tVWa7dN0T12pkfMPX4t6Pel
jeIMw0EZ/Gn9C4EWL1NKF3MmeYadK/S/twJB7dU7AbduuihP7dbK3HvkCZzZtQu3
Ta4VwTQTtcqL2Sg4uFF53ByXq/fRajnTOeeCyf1dLt4KO5yKbJtAnbBT965Tfz7E
Gh0xf1Mcet31hLn6uTI00xuHVHl+d/1svAaKGe9yguRzwHaqcXGni8y7y4VK1c/S
AAbF01qAFIzotuRyswGSdlD/C0GKI18yI1S2kTPa115qn01BmAZGW3J3Rf2K6VMf
8enbgpzUB5xavzCgfkP/bH/ekciR+BKzv5TQLwvbsIFlVsyIlvzLS1/KuPuTEhWn
39GWFx/1ozzS7ClH1q5hNZOF01zHaYWvSVLRPWMuZkMUFSEQ15BPP+SpdT0qG+qv
HrhIGrFndfDl62ekJ5PqeeAis2F2frFlLzA53NXqRABICgzeOQzU4WVd/3iByDup
IUkbr61pW5BFll+zd68V
=JHxt
-----END PGP SIGNATURE-----

------=_Part_3773_1539750914.1359471425104--