Mantis - Quercus
Viewing Issue Advanced Details
1950 minor always 08-20-07 02:01 08-20-07 12:20
ntherning  
nam  
normal  
closed 3.1.2  
fixed  
none    
none 3.1.3  
0001950: Bug in FileInputOutput.isEOF()
I tried to install drupal 5.2. There's a while-loop in includes/install.inc around line 181 which never terminates. It looks something like this:

  if ($fp = @fopen($settings_file, 'r+')) {
    // Step line by line through settings.php.
    while (!feof($fp)) {
      $line = fgets($fp);
      ...
    }
  }

Apparently feof($fp) always returns false even if the file has been consumed. I found an issue with the isEOF() methid in FileInputOutput. The line

return _stream.getFilePointer() == _stream.getLength() - 1;

should be

return _stream.getFilePointer() == _stream.getLength();

since filePointer will point at the position right after the last byte in the stream when the file has been consumed. After applying this fix drupal installed nicely without any other problems.
I'm using quercus from svn revision 2959. The com.caucho.(util|config|vfs) sources are from the resin 3.1.2 sources.

More system info:
apache-tomcat-5.5.23
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Ubuntu 7.04
Linux 2.6.20-15-generic 0000002 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

Notes
(0002204)
nam   
08-20-07 12:20   
php/1618

fixed for streams opened with 'r+' and etc. option