[chora] Followup (Re: "Can't check path...")

Eric spamsink at scoot.netis.com
Sun Nov 12 11:39:27 PST 2006


At 11:59 AM 11/12/2006, Chuck Hagenbuch wrote:

 >> http://php.net/var-dump is a good starting point.

Ah, thanks, that will help.  Using var-dump, I was able to get a little 
farther.

In file /var/www/html/horde/lib/Horde/VC/svn.php line 317, in the browseDir 
function, I added a var_dump call as follows:

   $cmd = $this->rep->getPath('svn') . ' ls ' . $Q .
                str_replace($Q, '\\' . $Q, $this->rep->sourceroot() .
                $this->queryDir())  // << NOTE: THIS IS ALL ON ONE LINE
   var_dump($cmd);

What I got back was:

   string(74) "/usr/bin/svn ls 'file:///usr/local/svnroot/repos/MyRepo/' 2>&1"

That appears to be the command that is to be executed at file svn.php line 318:

   $dir = popen($cmd, 'r');

(I would have though that popen() should be fed the path to the directory, 
i.e. 'file:///usr/local/svnroot/repos/MyRepo/', and not the whole command 
string including "svn ls", but I guess that must be a difference between 
php and C++.)

I assume that popen() must be able to open directories (directories are, 
after all, only a special kind of files in *nix).  I further assume that 
popen() returns a pointer to a stream.  In any case, when I add a 
"var_dump($dir);" after the popen() statement, I get:

   resource(55) of type (stream)

In any case, $dir returned non-NULL, so I assume that the popen() call 
completed without error (valid assumption?).

(One question ... If I leave both of those var_dump() calls in place, I get 
"string(74) "/usr/bin/svn ls 'file:///usr/local/svnroot/repos/MyRepo/' 
2>&1" resource(55) of type (stream)".  How do I tell it to insert a newline 
in between the two calls to var_dump(), to make the output a little easier 
to read?  On a hunch I added "\n" at the end of the first var_dump, as in 
var_dump($cmd, "\n");, also tried var_dump("\n", $cmd);, but neither of 
those did it.)

Now, starting at line 323 is the code:

   /* Create two arrays - one of all the files, and the other of
    * all the dirs. */
   $errors = array();
   while (!feof($dir)) {
       $line = chop(fgets($dir, 1024));
       var_dump($line);

I added the var_dump() call as shown above.

I get:

   string(60) "svn: Can't check path '/root/.subversion':
                            Permission denied" string(0) ""
(... all on one line.)

So, somewhere between line 317 and line 323 it seems to have gotten the 
idea that I wanted to look at /root/.subversion.  But, I can't find 
anything or any indication that would account for that.  In particular, 
there is nothing in file:///usr/local/svnroot/repos/MyRepo that would point 
to root.

Don't know where to go from here, unless popen() really is only supposed to 
be fed the path and not the whole command string, in which case I'd have to 
ask how it has worked for anyone else.




More information about the chora mailing list