Hi all, [Sorry, sending you an AI generated email for convenience. Hope you and PETSc are having a good summer.]
I encountered what may be a PetscBagRead.m issue while reading binary PetscBag output produced by PETSc 3.25.4. This may already have been fixed or reported, so please disregard if so. In the version I tested, datatype 9 is read with: val = read(fd,1,'int32'); However, PetscBagView() appears to write PETSC_BOOL using the current byte-sized PetscBool. Reading an int32 therefore misaligns subsequent bag entries. In my case, PetscReadBinaryMatlab eventually failed with an invalid MATLAB field name derived from bytes in the following entry. Changing the line to: val = read(fd,msize,'uchar'); resolved the problem in my test and should also handle Boolean arrays. I have prepared and tested a one-line patch. If this remains relevant, I would be happy to send it or open a merge request. Best wishes, Rich
