Windows fix for go-pear.org

From: Date: Sun, 23 Mar 2003 08:05:35 +0000
Subject: Windows fix for go-pear.org
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14554@lists.php.net to get a copy of this message
Hi, I've done a small amount of investigation of the windows install problems with go-pear.org, and have some changes. I've attached a diff against go-pear.org that will stop the go-pear script from automatically installing pear.ini into c:\php4. The problem was that PHP_BINDIR is set at compiletime, and is hard-coded as c:\php4 for the windows distribution of PHP! Since Pear_Config uses PHP_BINDIR if PHP_PEAR_BIN_DIR is not set, I added code that takes the $prefix directory if it is the php installation directory, and uses that to store the PEAR registry. The crash problem is in System::mktemp(). I can't do any debugging on it, because go-pear downloads a new System.php with every install. Could someone please investigate these lines: pear/System.php line 355:
        $tmp = tempnam($tmpdir, $prefix);
        if (isset($tmp_is_dir)) {
            unlink($tmp); // be careful possible race condition here
            if (!call_user_func('mkdir', $tmp, 0700)) {
                return System::raiseError("Unable to create temporary directory $tmpdir");
            }
        }
and explain why unlink($tmp) is called without checking to first see: 1) if $tmp even exists 2) if $tmp is a file (unlink doesn't work on directories, we need rmdir) 3) why mktemp is trying to create c:\windows\temp, which implies that perhaps these lines: pear/System.php line 349:
        if (!isset($tmpdir)) {
            $tmpdir = System::tmpdir();
        }
should be changed to:
        if (empty($tmpdir)) {
            $tmpdir = System::tmpdir();
        }
as then when line 355 comes around, $tmpdir will contain a temporary directory name. The change above may be enough to fix the Windows issues, but as I said, it needs to be committed in order to even begin testing it. Hope this is helpful towards getting pear 1.0-level on windows, it would be about time. Greg

« previous php.pear.dev (#14554) next »