create new tag
, view all tags

Provide a working default for $twikiLibPath

the existing $twikiLibPath provides a useless and misleading default ../lib. it is useless because, as comments above $twikiLibPath indicate, this must be set to an absolute path. it is misleading because twiki can seem to work for some things, but fail on others. multiple support request topics would seem to support this.

in bin/setlib.cfg (sic), i've updated $twikiLibPath so that an absolute path is generated at runtime. this default will work for most users (eg, the standard installation configuration, the TWikiSourceForgeDistribution, and the TWikiMacOsXDistribution). if bin and lib aren't next to each other, administrations will still need to edit the $twikiLibPath line just as they had to before.

-- WillNorris - 08 Nov 2004, 07 Dec 2004

Index: setlib.cfg
--- setlib.cfg   (revision 1820)
+++ setlib.cfg   (working copy)
@@ -34,21 +34,26 @@
 # -------------- Change these settings if required
+#    Path to lib directory containing TWiki.pm. Set to *absolute file path*:
+use Cwd qw( cwd );
+$twikiLibPath = cwd() . "/../lib";
-#    Path to lib directory containing TWiki.pm.
-#    ATTENTION: Set to absolute file path:
-$twikiLibPath = '../lib';

checked into DEVELOP r3351

-- WillNorris - 06 Dec 2004

Just saw this checkin and commented on twiki-dev - the use of Cwd is a significant overhead due to forking a pwd(1) command on every use of setlib.cfg.

ok, so if an installer is concerned with this (unmeasured) performance hit, they can edit the $twikiLibPath just like they used to have to edit $twikiLibPath before this patch i've updated the comments in bin/setlib.cfg to reflect that explicitly setting $twikiLibPath is still an option.

-- WillNorris - 07 Dec 2004

Also, the suffixing of /../foo to an absolute path doesn't look great for machines where there is a locked-down '..' for some reason (unlikely but possible, I have a hosting setup where some parent directories are unreadable but are executable).

yeah, i wondered about that, too. if someone does run into this problem, i'd be more than happy to help incorporate any forthcoming patches. portable code should use the CPAN:File::Spec module for dissecting and assembling paths.

-- WillNorris - 07 Dec 2004

Suggestion: How about generating this file from an installer script? I realise people want to unzip and go, but such a script could also edit the script shebang lines and it would move some of this overhead to install time, and make it possible to only pay the overhead on sites that want it.

-- RichardDonkin - 07 Dec 2004

i am interested in continued improvement in the installer. i think it would be wise to revist all of the configuration and setup files, rather than doing it piecemeal. however, i'm not prepared to do that at this time, but i should be soon. i'll be back with more details and comments when that happens. so, that's mostly a "yes", but not quite yet smile

-- WillNorris - 07 Dec 2004

The patch can cause an "Insecure dependency in require while running with -T switch at " in every script, I guess it happens if the cpan directories don't have the proper permission set.

-- RafaelAlvarez - 07 Dec 2004

Raf, thank you, thank you so much for this information. as you know, i've been trying to figure out why i had a taint problem (temporarily, i editted out the -T from the shebang line on my local copy of the bin scripts). i had been assuming that it was related to my Sandbox.TWikiInstallerFilePermissions

here's the updated patch (checked into DEVELOP 3363) which untaints $twikiLibPath. i'd appreciate feedback on this untaint in particular; it doesn't seem to be a very good untaint, but i'm under the impression that i can trust the results from cwd.

Index: bin/setlib.cfg
--- bin/setlib.cfg      (revision 3362)
+++ bin/setlib.cfg      (working copy)
@@ -35,8 +35,8 @@
 # -------------- Change these settings if required
 #    Path to lib directory containing TWiki.pm. Set to *absolute file path*:
-use Cwd qw( cwd );
-$twikiLibPath = cwd() . "/../lib";
+use Cwd qw( abs_path );
+( $twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/;     # CRAP untaint?  i dunno, i don't think so...  --WN
 #    Path to local Perl modules
 my $CPANBASE = "$twikiLibPath/CPAN/lib/site_perl";

-- WillNorris - 08 Dec 2004

I think the untaint is fine, since the pwd backticks line embedded in CPAN:Cwd doesn't include any user input.

-- RichardDonkin - 24 Jan 2005

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2005-01-24 - WillNorris
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.