Item9331: configue gets confused by commented out settings

Priority: Urgent
Current State: Closed
Released In: 1.0.10, 1.1.0
Target Release: patch
Applies To: Engine
Reported By: KennethLavrsen
Waiting For:
Last Change By: KennethLavrsen
I had this in configure

#$Foswiki::cfg{PasswordManager} = 'none';
$Foswiki::cfg{PasswordManager} = 'Foswiki::Users::HtPasswdUser';

Ie same setting twice. One commented out. Quite normal thing for an admin to do when trying things. I have been doing this for years

Some change since 1.0.9 makes configure not ignore the commented setting. Instead it changes the commented setting which is first. But the Foswiki code ignores the commented line and uses correctly the line without the #

It seems configure - when changing settings - does not ignore the commented out lines.

This is bad because you think you change a setting but you don't. It cost me 45 minutes where I could not understand why my other work ignored the setting.

-- KennethLavrsen - 15 Jul 2010

I have seen behaviour just like this, but I had not figured out the cause. I am raising this to urgent, as it is enough to make an admin doubt their own sanity frown, sad smile

-- MichaelTempest - 18 Jul 2010

Note that commented out settings are a clearly defined part of the .spec syntax. It may be that the parser doesn't differentiate between parsing .spec and LocalSite.

-- CrawfordCurrie - 19 Jul 2010

I have a simple fix for the startVisit routine in

@@ -407,7 +407,7 @@ sub startVisit {
         $txt =~ s/VAR1/Foswiki::cfg$keys/;
         # Substitute any existing value, or append if not there
-        unless ( $this->{content} =~ s/\$(Foswiki::)?cfg$keys\s*=.*?;\n/$txt/s )
+        unless ( $this->{content} =~ s/^\s*?\$(Foswiki::)?cfg$keys\s*=.*?;\n/$txt/ms )
             $this->{content} .= $txt;

It appears to resolve the issue. But I'm really unsure of this aspect of configure. Crawford. I'm committing change, but please verify.

-- GeorgeClark - 19 Jul 2010

That should be fine. It limits the format of LocalSite.cfg every so slightly, but it's an acceptable constraint.

-- CrawfordCurrie - 20 Jul 2010

1.0.9 has the same issue. Configure changes the first matching line - if comment is ahead of the live item, the comment gets changed and rewritten.

-- GeorgeClark - 26 Jul 2010

ItemTemplate edit

Summary configue gets confused by commented out settings
ReportedBy KennethLavrsen
Codebase 1.0.9, trunk
SVN Range
AppliesTo Engine
Priority Urgent
CurrentState Closed
Checkins distro:745216b2ecd6 distro:f1c6064c2a08
TargetRelease patch
ReleasedIn 1.0.10, 1.1.0
Topic revision: r10 - 08 Sep 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy