H-uru / libhsplasma

Cross-platform Plasma data and network library
GNU General Public License v3.0
32 stars 30 forks source link

More Object ID complaints: PRC round-tripping #262

Closed dpogue closed 1 year ago

dpogue commented 1 year ago

I know this is one of those problems where there's no perfect solution. Previously we tried not to touch Object IDs and that turned into problems when re-saving files and breaking references between objects, now we always recalculate Object IDs when saving pages.

We've had a few bugs lately around PRC parsing, and I wanted to to try comparing before and after PRC output to make sure it was the same, using a process like this:

prcdc -o before.prc somefile.prp
prcc before.prc -o temp.prp -v moul
prcdc -o after.prc temp.prp
diff before.prc after.prc

Except the prcc step recalculates all the Object IDs and reorders all the objects and makes the diff completely unusable. In theory it doesn't need to do that, since it's already parsing the Object IDs from the PRC file (but it's unknowable if there have been changes to the PRC file that would require recalculating IDs).

Maybe this is something that we could set as a flag on plResManager for whether to recalculate Object IDs at write time, and default it to true, but provide a prcc flag that tells it to keep the existing IDs?