Feature Proposal: Which 'patch' foswiki uses should be a config option

Motivation

foswiki (like TWiki) depends on 'GNU patch', not just any 'patch'. Which one to use should be a configure option similar to rcs, grep,etc.

Description and Documentation

Which 'patch' to use should be a configure option similar to rcs, grep,etc.

Examples

Example: Solaris 10 has two versions of 'patch' build-in by default: the Sun one which has been around for decades (/usr/bin/patch) and the GNU one (/usr/bin/gpatch). foswiki will need the latter.

Solaris users currently solve the problem by symlinking. Ugly, ugly, ugly. (see http://twiki.org/cgi-bin/view/Codev/SolarisInstallCookbook#GNU_patch). This current workaround is needed to make configure script pass without barking. The correct solution would be to make 'patch' binary location a config option.

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: JanGartmann - 27 Mar 2011

Discussion

If it is predictable that Solaris needs to use /usr/bin/gpatch why bother the admin with yet another silly configure setting? Why can't the code simply detect the environment and automatically and without bothering anyone do the right thing

Unless I misunderstand the situation here this should be fixed to work with the right gpatch on Solaris on a simple bug report

-- KennethLavrsen - 27 Mar 2011

It appears we used to check for the version of patch however that was disabled at some point Tasks.Item3255. (Otherwise configure would be generating errors on foswiki.org as we run on freebsd.)

We currently code the path to and check for all of the external commands: egrep, fgrep, and all of the rcs commands. Everything except for patch. They are all expert parameters, so for completeness we should probably add patch to the list and verify it as well. Hiding them as expert parameters means that the vast majority of the admins won't see the "silly" parameter, but for systems that require it, it's there. Also with the architecture of the configure checkers, if gives us a place to "hook" the checker to guess the correct parameter based upon the System.

For completeness, we also should consider Tasks.Item800 - the paths for all this stuff is set wrong for OSX. The defaults are also incorrect for FreeBSD.

All of these commands currently in configure use a hardcoded /usr/bin/ prefix Some are hardcoded, and some use a hidden parameter coded in Foswiki.spec, but the result is the appearance of a hardcoded path in the configuration:
# bodgey up a default location for grep
my $grepDefaultPath = '/bin/';
$grepDefaultPath = '/usr/bin/' if ($^O eq 'darwin');
$grepDefaultPath = 'c:/PROGRA~1/GnuWin32/bin/' if ($^O eq 'MSWin32');
$Foswiki::cfg{Store}{EgrepCmd} = $grepDefaultPath.'grep -E %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%';
...
$Foswiki::cfg{RCS}{initBinaryCmd} = "/usr/bin/rcs $Foswiki::cfg{RCS}{ExtOption} -i -t-none -kb %FILENAME|F%";

This is all terribly platform dependent, and currently quite well hidden, and inconsistent. The code in Foswiki.spec needs to be moved into a checker. A checker can check for the file locations and set the paths correctly on various platforms.

So this proposal should be broadened and suggest a simplification and reorganization of the configuration and checkers for all of the external programs, grep, patch and rcs. (Are there any others?)

Or better yet, as Kenneth suggests, (but expanded ...) a series of Tasks to fix the platform inconsistencies in the external program paths referenced in the configuration.

-- GeorgeClark - 28 Mar 2011

Which version of Foswiki uses patch. I cannot find where in the code patch is called. I renamed patch on my system to disable it, and Foswiki 1.1.3 appears to run fine. rdiff, compare, editing, ... ???

-- GeorgeClark - 28 Mar 2011

first up, given that we don't have any code that calls patch, adding a cfg will gain nothing.

secondly, i think that patch was for my magic upgrader script that went away many many moons ago (though i'm not positive)

so imo we should be removing this 'dependency'

-- SvenDowideit - 28 Mar 2011

I think we've determined that foswiki doesn't use patch. Rejecting this proposal. Please reactivate it if you can find where we use patch.

-- GeorgeClark - 23 Feb 2012
Topic revision: r5 - 23 Feb 2012, GeorgeClark
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