Author: hagge.lists
Description:
MY SYSTEM
My system as per 2008-03-13:
uname -a
FreeBSD {censored} 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #0: Sun Sep 16 17:25:13 CEST 2007 {censored}:/usr/obj/usr/src/sys/INTERCORNER i386
php --version
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 18 2008 03:00:34)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
where diff
/usr/bin/diff
/usr/bin/diff --version
diff - GNU diffutils version 2.7
where diff3
/usr/bin/diff3
/usr/bin/diff3 --version
diff3 - GNU diffutils version 2.7
THE PROBLEM
Now onto the problem. In fact its more like a fiew related problems.
During the installation of MediaWiki 1.12.0rc1 I got the following message "GNU diff3 not found.". I know diff is installed on my system (as shown above) and I don't like errormessages, even small ones, so I investigated it further.
At first I thought the root to this problem/error/bug was that I'm using Safemode, but it is not. So I made a workaround/fix for it.
First part of the problem:
In the file ./config/index.php on line 501 the script is searching for "diff3 (GNU diffutils)" in the output from "% diff3 --version" and according to my output above that does not match and that is part of why MediaWiki do not find the diff-util on my installation.
Second part of the problem:
I am running PHP in safemode and therefore the function shell_exec() is not allowed (back-quotes is an alias of this function) which generates some PHP-warnings instead of doing what it is should to do.
Third part of the problem:
MediaWiki are searching for the diff-util using static paths and not using the $PATH-variable during installation. This is no problem for me but it might be for someone else.
I do not understand the search for "diff3.exe" with hardcoded paths in unix-style format. But I'm no big fan of windoze and it was alot of years ago I programmed for it so I might be missing something.
MY MODIFICATIONS
My modifications and my function is included in this bugreport and here is a description of what and how I modify:
- ./includes/ShellExec.php -- This file is my function to fetch output from shell applications and is working with safemode enabled (if safemode is properly configured ofcource).
- ./config/index.php -- I added a require_once() for my function and modified locate_executable() to fetch both the old version-output-format and my different one.
- ./maintenance/parserTests.inc -- I added a require_once() for my function and modified quickDiff() to use my function instead of back-quotes to execute.
I haven't found any where else the diff-util is used. You probably have better knowloedge of the codebase than me. If you find this modification useful let me know. I will be glad if anyone can test my code and verify it is working or correct me if I am wrong about anything.
Happy coding!
Regards
Anders, Sweden
Version: 1.17.x
Severity: normal
OS: FreeBSD
Platform: PC