Skip Menu |

This queue is for tickets about the PatchReader CPAN distribution.

Report information
The Basics
Id: 40467
Status: resolved
Priority: 0/
Queue: PatchReader

People
Owner: tmannerm [...] cpan.org
Requestors: justin [...] picsel.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.9.6



Subject: PatchReader::FixPatchRoot doesn't understand 'Attic' files (and patch to fix)
Date: Tue, 28 Oct 2008 16:57:52 +0000
To: bug-PatchReader [...] rt.cpan.org
From: Justin Fletcher <justin [...] picsel.com>
Hiya, We use the PatchReader internally in order to view patches. Recently one of our engineers reported that a patch was not able to be parsed because the filename that had been generated was incorrect. The problem appears to be RCS files which are in the Attic directory. These are not handled by PatchReader::FixPatchRoot and so when the name is trimmed it leaves characters behind. For example... If the repository is "/var/cvs/", The file is "sources/Testing/file.c", The RCS file is "/var/cvs/sources/Testing/Attic/file.c,v" This becomes trimmed in PatchReader::FixPatchRoot to give us DIFF_FILE set to "sourcesources/Testing/file.c" The solution in our changed version is to strip the /Attic from the name, thus: -----8<----- --- FixPatchRoot.pm 27 Jul 2006 14:36:19 -0000 1.1 +++ FixPatchRoot.pm 28 Oct 2008 14:21:57 -0000 @@ -73,16 +73,24 @@ sub start_file { substr($file->{rcs_filename}, 0, length($this->{REPOSITORY_ROOT})) eq $this->{REPOSITORY_ROOT}) { # Since we know the repository we can determine where the user was in the # repository when they did the diff by chopping off the repository root # from the rcs filename $this->{DIFF_ROOT} = substr($file->{rcs_filename}, length($this->{REPOSITORY_ROOT})); $this->{DIFF_ROOT} =~ s/,v$//; + if ($file->{rcs_filename} =~ m,/Attic/[^/]*$,) + { + # If the RCS file exists in the Attic then we need to correct for + # this, stripping off the '/Attic' name in order to reduce the name + # to just the CVS root. + $this->{DIFF_ROOT} = substr($this->{DIFF_ROOT}, 0, + -6 ); # Take off the '/Attic' + } # XXX More error checking--that filename exists and that it is in fact # part of the rcs filename $this->{DIFF_ROOT} = substr($this->{DIFF_ROOT}, 0, -length($file->{filename})); $this->flush_delayed_commands(); $file->{filename} = $this->{DIFF_ROOT} . $file->{filename}; -----8<----- It's relatively rare to have patches for files that are in the Attic, so this might not have been seen previously. -- Justin Fletcher Picsel Technologies Ltd Tel: +44 141 8855588 Titanium House, Kings Inch Rd, Glasgow, G51 4BP, UK Web: www.picsel.com ---------------------------------------------------------------------------- This email is subject to disclaimer at http://www.picsel.com/disclaimer.html