OSLCompiler not checking for write failures
johnhaddon opened this issue · comments
John Haddon commented
Problem
Write errors are not detected by OSLCompiler::compile()
, leading to incomplete .oso
files but with no error being reported. This occurred for us because the disk was full, but presumably could be triggered by any other write error.
Expected behavior:
OSLCompiler.compile()
checks for write errors and returnsfalse
if they are found, with errors reported by theerrorHandler
.oslc
reports the errors and returns with a non-zero exit status.
Actual behavior:
OSLCompiler.compile()
returnstrue
even when writing fails.oslc
reports compilation succeeded even when writing fails.
Steps to Reproduce
set -e
# Make a tiny RAM disk
mkdir -p /mnt/oslTest
mount -t tmpfs -o size=512 tmpfs /mnt/oslTest
# Try to compile into it 10 times
for i in {1..10}
do
oslc "$OSLSOURCEDIR/src/shaders/metal.osl" -o /mnt/oslTest/metal${i}.oso
done
# See what we've got. Here I see a single successfully compiled shader, and 9 failures with size 0.
ls -l /mnt/oslTest
Versions
- OSL branch/version: 1.11.11
- OS: CentOS 7
- C++ compiler: GCC 9
- LLVM version: 10.0.1
- OIIO version: 2.2.11.1
John Haddon commented
I've set the wheels in motion to get a CLA sorted with my employer, so I hope to be able to open a PR with a proposed fix before too long.
Larry Gritz commented
Oh, that's awesome, thanks!