[PATCH] Random testing of is_canonical(canonicalize(path))

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[PATCH] Random testing of is_canonical(canonicalize(path))

Julian Foad-5
This patch doesn't say anything about whether we wanted or now want the design of *_is_canonical() and *_canonicalize() to be such that is_canonical(canonicalize(path)) is always true. I present this for interested parties to play with and make progress.

Sample outputs:
DBG: dirent_uri-test.c:1191: non-c. dirent: 'O:.' -> 'O:.'
DBG: dirent_uri-test.c:1191: non-c. dirent: './v:' -> 'v:'
DBG: dirent_uri-test.c:1198: non-c. URI: 'u9' -> 'u9'
DBG: dirent_uri-test.c:1180: f='/hxDC7/'
lt-dirent_uri-test: /home/julianfoad/src/subversion-fsrepli/subversion/libsvn_subr/dirent_uri.c:322: canonicalize: Assertion `*src != '/'' failed.

To get the dirent failures I forcibly defined SVN_USE_DOS_PATHS in libsvn_subr/dirent_uri.c.

For whatever invariants we do decide should hold, it would be beneficial to have such a test in place.

The relpath_* functions do currently seem to obey this invariant, so I suggest we commit at least the relpath part of this, if we agree that's intended behaviour.

- Julian

dirent-uri-test-random-1.patch (5K) Download Attachment