From 2786be2f757a86c6b153bfdf6ec726fc4d1fe4c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 31 Mar 2026 15:10:32 +0000 Subject: [PATCH 1/2] Fix remaining 'r' to 'rb' file permissions in binaryTable and binarydoc_matfid binaryTable.m used text mode 'r' in 6 places when setting permission for binary reads. binarydoc_matfid.m had 'r' as the default permission. Changed all to 'rb' for consistent binary file I/O and to prevent locale-dependent data corruption on Linux. https://claude.ai/code/session_01RqgvBjZQmYBS8G6PJjdxDh --- src/did/+did/+file/binaryTable.m | 12 ++++++------ src/did/+did/+implementations/binarydoc_matfid.m | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/did/+did/+file/binaryTable.m b/src/did/+did/+file/binaryTable.m index dafc7fe..e2b5abb 100644 --- a/src/did/+did/+file/binaryTable.m +++ b/src/did/+did/+file/binaryTable.m @@ -79,7 +79,7 @@ % [lockfid,key] = binaryTableObj.getLock(); binaryTableObj.file.fclose(); - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); headerData = uint8(fread(binaryTableObj.file,binaryTableObj.headerSize,'uint8')); binaryTableObj.file.fclose(); @@ -210,7 +210,7 @@ function releaseLock(binaryTableObj, lockfid, key) % obtain the lock so the file can't change while we read it [lockfid,key] = binaryTableObj.getLock(); - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); [r,~] = binaryTableObj.getSize(); @@ -279,7 +279,7 @@ function insertRow(binaryTableObj, insertAfter, dataCell) end binaryTableObj.file.fclose(); else % copy over everything to temp file before inserting and moving back - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); beforeBytes = binaryTableObj.headerSize + insertAfter * binaryTableObj.rowSize(); totalBytes = (binaryTableObj.headerSize + r * binaryTableObj.rowSize()); @@ -340,7 +340,7 @@ function deleteRow(binaryTableObj, row) [lockfid,key] = binaryTableObj.getLock(); binaryTableObj.file.fclose(); - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); beforeBytes = binaryTableObj.headerSize + (row-1) * binaryTableObj.rowSize(); totalBytes = (binaryTableObj.headerSize + r * binaryTableObj.rowSize()); @@ -426,7 +426,7 @@ function writeTable(binaryTableObj, data) % [lockfid,key] = binaryTableObj.getLock(); binaryTableObj.file.fclose(); - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); fid = fopen(binaryTableObj.tempFileName(),'w'); @@ -486,7 +486,7 @@ function writeTable(binaryTableObj, data) if ~option.isRecurrent [lockfid,key] = binaryTableObj.getLock(); binaryTableObj.file.fclose(); - binaryTableObj.file = binaryTableObj.file.setproperties('permission','r'); + binaryTableObj.file = binaryTableObj.file.setproperties('permission','rb'); binaryTableObj.file.fopen(); end diff --git a/src/did/+did/+implementations/binarydoc_matfid.m b/src/did/+did/+implementations/binarydoc_matfid.m index b1a0d47..50ac2c6 100644 --- a/src/did/+did/+implementations/binarydoc_matfid.m +++ b/src/did/+did/+implementations/binarydoc_matfid.m @@ -18,7 +18,7 @@ arguments fileProps.machineformat (1,1) string {did.file.mustBeValidMachineFormat} = 'l'; % native machine format - fileProps.permission (1,1) string {did.file.mustBeValidPermission} = "r" + fileProps.permission (1,1) string {did.file.mustBeValidPermission} = "rb" fileProps.fid (1,1) int64 = -1 fileProps.fullpathfilename = ''; matfidProps.key = '' From b6a3a05d92ce30c6eb9ac411e27b511dc88b5114 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 31 Mar 2026 15:23:18 +0000 Subject: [PATCH 2/2] Move symmetry tests to tests_symmetry/ to avoid skips in test-code workflow The general test-code workflow auto-discovers all TestCase classes under tests/, including readArtifacts symmetry tests. Since makeArtifacts never runs in that workflow, both parameterized readArtifacts tests (matlab and python artifacts) are skipped. Moving symmetry tests to a separate tests_symmetry/ directory keeps them out of auto-discovery while the dedicated test-symmetry workflow still runs them correctly. https://claude.ai/code/session_01RqgvBjZQmYBS8G6PJjdxDh --- .github/workflows/test-symmetry.yml | 2 ++ .../+did/+symmetry/+makeArtifacts/+database/buildDatabase.m | 0 .../+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md | 0 .../+did/+symmetry/+readArtifacts/+database/buildDatabase.m | 0 .../+did/+symmetry/+readArtifacts/INSTRUCTIONS.md | 0 5 files changed, 2 insertions(+) rename {tests => tests_symmetry}/+did/+symmetry/+makeArtifacts/+database/buildDatabase.m (100%) rename {tests => tests_symmetry}/+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md (100%) rename {tests => tests_symmetry}/+did/+symmetry/+readArtifacts/+database/buildDatabase.m (100%) rename {tests => tests_symmetry}/+did/+symmetry/+readArtifacts/INSTRUCTIONS.md (100%) diff --git a/.github/workflows/test-symmetry.yml b/.github/workflows/test-symmetry.yml index 91bc5a8..f607fdd 100644 --- a/.github/workflows/test-symmetry.yml +++ b/.github/workflows/test-symmetry.yml @@ -46,6 +46,7 @@ jobs: command: | addpath(genpath("src")); addpath(genpath("tests")); + addpath(genpath("tests_symmetry")); import matlab.unittest.TestRunner; import matlab.unittest.TestSuite; import matlab.unittest.plugins.DiagnosticsOutputPlugin; @@ -61,6 +62,7 @@ jobs: command: | addpath(genpath("src")); addpath(genpath("tests")); + addpath(genpath("tests_symmetry")); import matlab.unittest.TestRunner; import matlab.unittest.TestSuite; runner = TestRunner.withTextOutput; diff --git a/tests/+did/+symmetry/+makeArtifacts/+database/buildDatabase.m b/tests_symmetry/+did/+symmetry/+makeArtifacts/+database/buildDatabase.m similarity index 100% rename from tests/+did/+symmetry/+makeArtifacts/+database/buildDatabase.m rename to tests_symmetry/+did/+symmetry/+makeArtifacts/+database/buildDatabase.m diff --git a/tests/+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md b/tests_symmetry/+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md similarity index 100% rename from tests/+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md rename to tests_symmetry/+did/+symmetry/+makeArtifacts/INSTRUCTIONS.md diff --git a/tests/+did/+symmetry/+readArtifacts/+database/buildDatabase.m b/tests_symmetry/+did/+symmetry/+readArtifacts/+database/buildDatabase.m similarity index 100% rename from tests/+did/+symmetry/+readArtifacts/+database/buildDatabase.m rename to tests_symmetry/+did/+symmetry/+readArtifacts/+database/buildDatabase.m diff --git a/tests/+did/+symmetry/+readArtifacts/INSTRUCTIONS.md b/tests_symmetry/+did/+symmetry/+readArtifacts/INSTRUCTIONS.md similarity index 100% rename from tests/+did/+symmetry/+readArtifacts/INSTRUCTIONS.md rename to tests_symmetry/+did/+symmetry/+readArtifacts/INSTRUCTIONS.md