Item1011: Configure fails with cryptic error in Configure/Checker.pm line 315 when RCS is not available on the system

pencil
Priority: Urgent
Current State: Closed
Released In: 1.0.1
Target Release: patch
Applies To: Engine
Component: Configure
Branches:
Reported By: PascalSchuppli
Waiting For:
Last Change By: KennethLavrsen
When you install Foswiki and don't have RCS available on the system, you get a perl type error in the configure script/page about 1.0.0 not being a number but having the < operator applied to it. This is a show-stopper for Foswiki configuration - the configuration page breaks and you have to read the Apache error log to figure out that the real problem is RCS not being there.

The exact error location is the comparison in the following if statement if Foswiki/Configure/Checker.pm:
     if ( $version =~ /^\d/ && $version < $rcsverRequired ) {

            # RCS too old
            $err .=
                $prog
              . ' is too old, upgrade to version '
              . $rcsverRequired
              . ' or higher.';
        }

-- PascalSchuppli

Pascal,

I removed my rcs executables, and I get the did not return a version number (or might not exist..) error that is a few lines higher up in my configure output.

can you please tell us a little more about your system? perhaps the OS or something else is causing it to return 1.0.0?

-- SvenDowideit - 08 Feb 2009

I installed Foswiki on a virtual machine created by the vmbuilder script included in Ubuntu 8.10. As far as I know, the vmbuilder is installing a bare-bones Ubuntu 8.10 OS known as JeOS. I installed only the bare minimum of additional packages to get FosWiki running, e.g. apache 2.2, german locale etc, so basically I'm still dealing with a vanilla Ubuntu 8.10 JeOS installation. The error I described above persisted until I installed the rcs package, after which it disappeared. It is also repeatable; when I remove the rcs package, the error appears again. configure reports 5.010000 as the perl version installed.

BTW, I think it's a strange coincidence that the "version number" reported for rcs is 1.0.0 when in fact FosWiki is installed in that version, in a directory named "Foswiki-1.0.0". Maybe when rcs is not installed, something goes wrong and the regex picks up Foswiki's 1.0.0 from a path string in the resulting error message?

-- PascalSchuppli - 09 Feb 2009

OK; here's some more information that should help to explain what's going on. I inserted the following debug statement in Checker.pm right below line 307:
my $version = `$prog -V` || '';
print STDERR "***[$prog][$version]***";

Now here's what I found in the apache error log afterward (I replaced the actual paths with /this/is/private/):
[Mon Feb  9 22:17:37 2009] configure: Can't exec "/usr/bin/rcs": No such file or directory at /this/is/private/Foswiki-1.0.0/lib/Foswiki/Configure/Checker.pm line 307.
***[/usr/bin/rcs][<h1>Software error:</h1>
<pre>Can't exec &quot;/usr/bin/rcs&quot;: No such file or directory at /this/is/private/Foswiki-1.0.0/lib/Foswiki/Configure/Checker.pm line 307.
</pre>
<p>
For help, please send mail to the webmaster (<a href="mailto:webmaster@localhost">webmaster@localhost</a>), giving this error message
and the time and date of the error.

</p>
]***[Mon Feb  9 22:17:38 2009] configure: Argument "1.0.0" isn't numeric in numeric lt (<) at /this/is/private/Foswiki-1.0.0/lib/Foswiki/Configure/Checker.pm line 316.

Looks like something is going royally wrong with the contents of $version! I have absolutely no clue how that HTML snippet ends up in $version, but at least you can see why the regex thinks rcs is installed in version 1.0.0. Hope that helps you fix things. The error might ultimately be caused by some missing (perl?) library on my machine, an incompatible perl version 5.10 or the apache setup, but I think FosWiki should fail more gracefully in that case.

-- PascalSchuppli - 09 Feb 2009

please try this patch:

Index: lib/Foswiki/Configure/Checker.pm
===================================================================
--- lib/Foswiki/Configure/Checker.pm    (revision 382)
+++ lib/Foswiki/Configure/Checker.pm    (working copy)
@@ -304,14 +304,14 @@
         $err .= $key . ' is not set';
     }
     else {
-        my $version = `$prog -V` || '';
-        if ( $version =~ /(\d+(\.\d+)+)/ ) {
+        my $version = `$prog -V`;
+        if ( defined $version && $version =~ /(\d+(\.\d+)+)/ ) {
             $version = $1;
         }
         else {
-            $err .= $this->ERROR( $prog
-                  . ' did not return a version number (or might not exist..)' );
+            $err .= $this->ERROR( $prog . ( defined $version ? ' did not return a version number' : ' not found' ) );
         }
+       # SMELL: this comparison would break if rcs used a major.minor.rev version number syntax; "use version;" or CPAN module
         if ( $version =~ /^\d/ && $version < $rcsverRequired ) {
 
             # RCS too old

-- WillNorris - 10 Feb 2009

Sorry, Will, but the patch does nothing for me. It has no effect on the error message I receive. This is logical; $version gets filled with the HTML snippet containing the 1.0.0 from the Foswiki-1.0.0 path component, so it is does match $version =~ /^\d/. I'd still be interested in how that HTML snippet ends up in $version. Is there some error handler that kicks in, or is it something CGI does, or what? Find the reason for that, and you found the cause of the error on my machine.

- PascalSchuppli - 10 Feb 2009

By code inspection it's obvious what is going on. The code tries to "parse" a valid version number from the result of the program run. Usually if RCS is missing this fails, because the error message contains nothing that looks like a version number. In Pascal's install, however, he has a Foswiki-1.0.0 directory which provides the necessary version string.
No such file or directory at /this/is/private/Foswiki-1.0.0/lib/Foswiki/Configure/Checker.pm
The analysis of the error message needs to be made smarter.

Confirmed and elevated to "Urgent" status, because now we are shipping with a Foswiki root dir in the zip, this scenario will arise a lot more often.

-- CrawfordCurrie - 13 Feb 2009

yes, it is obvious that it is trying to parse the version number in the directory name. however, perlop says `` is supposed to return undef if the command couldn't be executed, hence my patch above.
  1. does `` not return undef under windows? the reported code path flow would seem to indicate this. that would be a shame.

well, i've done as much as i can on this bug. i'm punting it to someone who actually uses and/or cares about windows.

-- WillNorris - 13 Feb 2009

Cant see why this bug is urgent. Ok, if RCS is missing, you get the wrong result with configure. But with a missing RCS you wont be able to run Foswiki at all. In addition, this is exclusivly related to windows. Iam for lowering to normal.

-- EugenMayer - 13 Feb 2009

Will, (1) agreed, it looks like something naff is happening with perlop. But this is a Linux VM, not Windows. Eugen, it's urgent for the reason I gave. Also. "with a missing RCS you wont be able to run Foswiki at all" - wrong, you can use RcsLite. Also, it is not exclusive to Windows, it was reported against a Linux VM.

-- CrawfordCurrie - 13 Feb 2009

Can we get this fixed Saturday the 14th? Otherwise I downgrade to normal again.

-- KennethLavrsen - 13 Feb 2009

Done

-- CrawfordCurrie - 14 Feb 2009

ItemTemplate edit

Summary Configure fails with cryptic error in Configure/Checker.pm line 315 when RCS is not available on the system
ReportedBy PascalSchuppli
Codebase 1.0.0
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component Configure
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:97a9fe0b905e
TargetRelease patch
ReleasedIn 1.0.1
Topic revision: r19 - 23 Feb 2009, 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