|
 |
On 10/6/21 5:01 AM, jr wrote:
> hi,
>
> -----<snip>-----
> #version 3.8;
>
> global_settings {assumed_gamma 1}
> box {0,1}
>
> #if (0)
> #declare dir_ = "/badName/";
> #else
> #declare dir_ = "/tmp/";
> #end
>
> #declare arr_ = array [3] {"foo","bar","baz"};
>
> #fopen fp_ concat(dir_,"wtest.txt") write
>
> #for (i_,0,2)
> #if (2 != i_) #local c_ = ","; #else #local c_ = ""; #end
> #write (fp_,concat("\"",arr_[i_],"\"",c_))
> #end
>
> #fclose fp_
> -----<snip>-----
>
> when I change the '#if' to use a non-existing directory, the alpha.9945627 and
> beta.2, as well as WFP's povr, all silently ignore the fact that no file was
> (could be) created, and do not return an error. both on Linux and Windows.
>
> (thanks for the discovery goes to TdG who ran into this issue while testing some
> code of mine)
>
This a bug is basically the same as the radiosity file append bug.
It looks like after v3.7 some file IO class work got done making the
test for successful opens on write and append(a) 'if (*(wfile))' instead
of the more common / expected 'if (wfile != nullptr)'.
(a) - Read too depending on the set up and usage.
To complicate things...
1) Though POV-Ray's IStream is using the same base class as OStream,
because the read pointer is a shared_ptr, you must use
the usual 'if (rfile != nullptr)' test for success on reads. The
override version in fact segfaults for me when I tried it - and I've not
gotten my head around the C++ reason(s) why.
2) The read open success/fail, from a users perspective, is working but
it's due overlapping code in a function called Locate_File() and not due
the testing in Parse_Fopen(). Meaning, I think, but I'm too lazy to
chase it at the moment, that the read 'if (rfile != nullptr)' is
probably also not working in Parse_Fopen(), but we are covered so it
doesn't matter.
3) Given this and the radiosity bug,I have to wonder if we have other
file open write / append bugs in v3.8. What other file opens might be
write or append in POV-Ray?
Anyhow, updates not checked in, but fopen write/append fixes will be in
the next povr tarball.
Bill P.
Post a reply to this message
|
 |