[Bins] Re: Bug#334088: bins: if linkRelative and linkInsteadOfCopy is set, then path can be stripped improperly

Martin Michlmayr tbm at cyrius.com
Fri Nov 4 13:43:50 GMT 2005


tags 334088 + fixed
thanks

* Tim Connors <tconnors+reportbug at astro.swin.edu.au> [2005-10-15 22:59]:
> if you run
> ~/> bins photos public_html/photos
> without the trailing slash, and have both linkRelative and
> linkInsteadOfCopy set, then relpath() appears to improperly strip the
> first character from one of the directory components:
>     Image has the right size, just linking... Linking from /home/tconnors/public_html/photos/astronomy/dscf0205_Lg.jpg to ../../../hotos/astronomy/dscf0205.jpg... 

Thanks, there's a off by one when the directories start with the same
character.  Below is a fix.

--- /usr/bin/bins	2005-10-15 16:02:07.000000000 +0100
+++ bins	2005-11-04 13:40:29.000000000 +0000
@@ -1151,7 +1151,7 @@
     my $l2 = length($p2);
 
     my $cl = cls($p1, $p2);
-
+    $cl-- if (substr($p2, $cl-1, 1) ne "/");
     my $p2r = substr( $p2, $cl, $l2);
 
     my $p1dc = 0;

-- 
Martin Michlmayr
http://www.cyrius.com/


More information about the Bins mailing list