ID 218132 - Nuke cannot read exr that it writes

Follow

Problem summary
Nuke cannot read exr that it writes

Customer has "some internally generated EXRs (from some internal software) that appear compliant with spec (attached) and can be read successfully by Nuke, however in certain conditions when written out, the resulting EXR is broken and cannot be re-read in Nuke or in other readers (e.g. RV)."​

Customer provided one of their special exr's and a nice diagnostic script (both attached) where they demonstrate how certain nodes can break Nuke's own exr Write, producing an un-readable exr

A - res, no bbox
B - no chg, black outside
C - no chg
D - reformat AND expand bbox
D' - as per D, but changing the exr/chunkCount metadata tag
E - reformat
F - only bbox tweak
G - only bbox tweak but no compression/etc 


Customer reported version
nuke.9.0v8 (also "10")​

Customer reported platform
linux centos6​

Steps to reproduce

1) Launch Nuke and open attached script  repro_exr_break_daveintel​.nk

2) re-point Read3 to input file from
/gpfs/netpics/Testing/Bugs​/<this bug number>/chunkCount_test_v01​.exr

3) repoint 8 Write nodes to a path of your choice, preserving the filename each outputs

4) select Render > Render All Write Nodes

5) repoint the 8 Read nodes below the Writes to input the files written

Reproduced by support
Support repro'd customer results on OS 10.10.5 Nuke 9.0v1, 9.0v8, 10.0v2 

Expected behaviour
All Reads were expected to input the Writes' output without error

Actual behaviour
Read1, Read2, and Read8 failed, giving this output from NUke10.0v2

ERROR: Read8: Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_D.0001.exr". Unexpected data block y coordinate.
ERROR: Read1: Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_F.0001.exr". Unexpected data block y coordinate.
ERROR: Read2: Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Scan line 43 is missing.
ERROR: Read2: Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Scan line 31 is missing.
ERROR: Read2: Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Error reading pixel data from image file "/Users/dave/Downloads/_10303/foo_G.0001.exr". Scan line 18 is missing.​

    We're sorry to hear that

    Please tell us why