We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Codev Web>GetTWikiLibBug (05 Jun 2002, PeterThoeny)
Tags:
create new tag
, view all tags
There's a bug in the routine TWiki::getTWikiLib. It doesn't normalize more than one relative parent directory (eg, a /../ in the path). For example, if TWiki.pm is found in /foo/bar/baz/../../ then this routine will return /foo/bar/../ not the expected /foo/ .

The line to fix is, #516 in the 20011201 release of file lib/TWiki.pm:

    $twikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1|go;

should be

    while ( $twikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1|o);

I think the /g flag is iterative rather than recursive (at least that's what I think it tries to say on the perlop manpage - example with putting commas into a number).

-- SlavaKozlov - 26 Feb 2002

I've set this to BugReport since that's what it is.

-- RichardDonkin - 26 Mar 2002

I got a syntax error when I had applied the above patch, but the following worked:

    while ( $twikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1|o) {};

I'm using Perl version 5.005_03

-- MikeLees - 04 Jun 2002

Fixed and in TWikiAlphaRelease.

-- PeterThoeny - 05 Jun 2002


Category: TWikiPatches
Topic revision: r4 - 05 Jun 2002 - 07:29:46 - PeterThoeny
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback