fix(tools): h5rs diff compares soft links by target, like h5diff
An OBJ that was a soft link was resolved and its target object compared, so two files whose /g/s both point at /z differed when /z did: exit 1, where h5diff (without --follow-symlinks) compares the links' target paths and exits 0. A soft link is now compared as a link wherever it is, OBJ included. --follow-symlinks compares the objects soft links lead to instead, walks into soft-linked groups, resolves relative targets against the link's group, and treats two dangling links as the same; exit codes equal h5diff's on 14 cases. External links are never followed (documented). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -140,6 +140,7 @@ $ h5rs diff a.h5 b.h5 /x /y # different paths in each
|
||||
$ h5rs diff -r a.h5 b.h5 /d # list every differing element
|
||||
$ h5rs diff -d 0.001 a.h5 b.h5 # |a - b| > 0.001 is a difference
|
||||
$ h5rs diff -p 0.01 a.h5 b.h5 # |a - b| / |a| > 1% is a difference
|
||||
$ h5rs diff --follow-symlinks a.h5 b.h5 /lnk # what the soft link /lnk leads to
|
||||
```
|
||||
|
||||
Integers are compared in integer arithmetic, with or without a tolerance, so
|
||||
@@ -150,7 +151,14 @@ exactly, as h5diff's does.
|
||||
Exit status: 0 no differences, 1 differences, 2 error — the same as h5diff's
|
||||
on the cases `diff_exit_codes_match_h5diff` runs. Compared: which objects
|
||||
exist, their kinds, datatypes and shapes, attribute sets and values, dataset
|
||||
values, and soft/external link targets. Every path is compared: an object
|
||||
values, and soft/external link targets. A soft link — including an OBJ
|
||||
that is itself a soft link — is compared as a link, by its target path, as
|
||||
h5diff does; `--follow-symlinks` compares the objects soft links lead to
|
||||
instead (and walks into soft-linked groups), and two dangling links are then
|
||||
the same, as in h5diff. External links are always compared by target (file
|
||||
and path): `--follow-symlinks` does not open other files, where h5diff's
|
||||
does. Two dangling soft links with different targets are a difference
|
||||
(h5diff reports them with `-r`/`-v` but exits 0 without). Every path is compared: an object
|
||||
hard-linked under two names is compared under both, with everything below
|
||||
it, so a file that shares one object between two names equals a file that
|
||||
stores two identical copies. Differences from h5diff, on purpose: objects
|
||||
|
||||
Reference in New Issue
Block a user