The CifCheck command fails silently when it cannot write to the *-diag.log file (eg if $PWD is read-only). ofstream::open() is unchecked and validation errors are lost. With no output and an exit code of 0, it looks exactly like the input file passed validation.
Steps to reproduce
# Create the test directory and a minimally invalid CIF file:
mkdir -p /tmp/test_mmcif
cat > /tmp/test_mmcif/invalid.cif << 'EOF'
data_test
_invalid_category.field value
EOF
# Remove write permission on the directory:
rm invalid.cif-diag.log
chmod a-w /tmp/test_mmcif
# Run CifCheck
CifCheck -f invalid.cif -dictSdb /path/to/mmcif_pdbx_v50.sdb
Observation
Command runs successfully, no error display, exit code 0, no diagnostic file invalid.cif-diag.log
Expected output
This should have displayed an error and, preferably, exited with a non 0 exit code.
Proposed solution
I opened a pull request in rcsb/cpp-cif-file#1 with a proposed fix.
The CifCheck command fails silently when it cannot write to the *-diag.log file (eg if
$PWDis read-only).ofstream::open()is unchecked and validation errors are lost. With no output and an exit code of 0, it looks exactly like the input file passed validation.Steps to reproduce
Observation
Command runs successfully, no error display, exit code 0, no diagnostic file
invalid.cif-diag.logExpected output
This should have displayed an error and, preferably, exited with a non 0 exit code.
Proposed solution
I opened a pull request in rcsb/cpp-cif-file#1 with a proposed fix.