Fwd: Re: [chora] rb/wb file modes

Chuck Hagenbuch chuck@horde.org
Sat, 4 May 2002 19:40:35 -0400



----- Forwarded message from Ahmed <ashihab@alcahest.com> -----
    Date: Sat,  4 May 2002 23:18:31 +0100
    From: Ahmed <ashihab@alcahest.com>
Reply-To: Ahmed <ashihab@alcahest.com>
 Subject: Re: [chora] rb/wb file modes
      To: Chuck Hagenbuch <chuck@horde.org>

I got the same problems with a linux system (RH 7.1) I solved the problems 
with 
using a conditional on OS_WINDOWS. 

I've found problems with following files:

chora/lib/CVSLib/Annonate.php

-- snip
*** Annotate.php        Sat May  4 23:14:40 2002
--- Annotate.php.new    Sat May  4 22:27:30 2002
***************
*** 45,52 ****
          $cvsroot = $this->CVS->cvsRoot();
  
          $this->tmpfile = Horde::getTempFile('chora');
  
!         $pipe = popen($conf['paths']['cvs'] . ' -n -l server > ' . $this-
>tmpfile, 'wb');
  
          $out = array();
          $out[] = "Root $cvsroot";
--- 45,53 ----
          $cvsroot = $this->CVS->cvsRoot();
  
          $this->tmpfile = Horde::getTempFile('chora');
+       $mode = OS_WINDOWS ? 'wb' : 'w';
  
!         $pipe = popen($conf['paths']['cvs'] . ' -n -l server > ' . $this-
>tmpfile, $mode);
  
          $out = array();
          $out[] = "Root $cvsroot";
-- snip

Chora/lib/CVSLib/Checkout.php

-- snip
*** Checkout.php        Sat May  4 23:14:41 2002
--- Checkout.php.new    Mon Apr 29 15:11:04 2002
***************
*** 31,38 ****
          }
  
          $Q = OS_WINDOWS ? '"' : "'" ;
  
!         if (!($RCS = popen($CVS->conf['paths']['co'] . " -p$rev 
$Q$fullname$Q 
2>&1", 'rb'))) {
              return new CVSLib_Error(CVSLIB_INTERNAL_ERROR,
                        _("Couldn't perform checkout of the requested 
file"));
          }
--- 31,39 ----
          }
  
          $Q = OS_WINDOWS ? '"' : "'" ;
+       $mode = OS_WINDOWS ? 'rb' : 'r';
  
!         if (!($RCS = popen($CVS->conf['paths']['co'] . " -p$rev 
$Q$fullname$Q 
2>&1", $mode))) {
              return new CVSLib_Error(CVSLIB_INTERNAL_ERROR,
                        _("Couldn't perform checkout of the requested 
file"));
          }

-- snip

Ahmed...

Quoting Chuck Hagenbuch <chuck@horde.org>:

> Quoting Jan Schneider <jan@horde.org>:
> 
> > I have problems with some of the recently introduced "rb" and "wb" file
> > modes in the popen() calls. I get an "invalid argument" warning from
> > these calls and no file pointer gets returned. 
> > 
> > Interesting enough this message is in German, that means it probably 
> > doesn't come from PHP but from the system. I don't know why these
> > arguments cause problems because they are stated as harmful for *nix 
> > system in the manual but perhaps something changed here with the 
> > introduction of streams in the latest php code.
> > 
> > Does anybody else see these errors on a Linux system?
> 
> No, things work fine here... feel free to wrap things in the if 
> (OS_WINDOWS) check we committed in one place...
> 
> -chuck
> 
> --
> Charles Hagenbuch, <chuck@horde.org>
> "A dream which helps you to live your reality with dignity
>  and justice is a good dream." - Tariq Ramadan
> 
> -- 
> Chora mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: chora-unsubscribe@lists.horde.org
> 
> 
> 

----- End forwarded message -----


-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"A dream which helps you to live your reality with dignity
 and justice is a good dream." - Tariq Ramadan