octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CHANGESET] Random failure of fopen when file does not exist


From: John W. Eaton
Subject: [CHANGESET] Random failure of fopen when file does not exist
Date: Thu, 5 Feb 2009 19:40:07 -0500

On  5-Feb-2009, John W. Eaton wrote:

| On  5-Feb-2009, Rafael Laboissiere wrote:
| 
| | In the process of packaging octave 3.1.51 for Debian, I am getting errors
| | like this:
| | 
| | /usr/bin/make -C interpreter all
| | [...]
| | ../../run-octave -f -q -H -p . --eval "sparseimages ('spchol', 'txt');"
| | error: fputs: invalid stream number = -1
| | [...]
| | 
| | The annoying thing is that the bug is not deterministic and the build fails
| | each time on a different run-octave line.
| | 
| | I think I nailed down the problem and the changeset attached below should
| | fix it.  It seems to be caused by changeset b68e44c90afe, in which a test
| | using fs.is_dir () was introduced in do_stream_open().  The problem is that
| | when the file_stat fs variable is created in file_stat fs (fname) and the
| | file with name fname does not exist (as it is the case in the example
| | above), then the private variable fs_mode is not initialized.  In my system
| | here (Debian sid amd64) it seems that fs.is_dir() will return random values
| | in this case.
| | 
| | I hope I did the correct analysis and the fix is appropriate.  At least, the
| | Debian package is building correctly now.
| 
| Thanks for finding this problem.  I propose the following change
| instead, which will won't require hunting down all uses of fs.is_dir
| or similar funtions and only calling them if fs.exists returns true.
| 
|   http://hg.savannah.gnu.org/hgweb/octave/rev/ddbe87599331
| 
| Does this also work for you, without your patch?

Oops, that change used the OK function where it should have used the
EXISTS function.  I checked in a fix.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]