h5repack oddities
- Dominant language
- C
- Stars
- 988
- Forks
- 355
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 12
Description
**Describe the bug**
I have been playing with `h5repack` in the context of user-defined filters (e.g. passing `-f :=`) and have run across a number of issues which I briefly enumerate here.
#### Use of colon character
- When no specific objects are listed ahead of the colon character (`:`) in the argument to the `-f` option, is the colon character still needed? I think it is unclear in the documentation whether it is or not. I would recommend that it *work* in this circumstance either way. Then, you don't have to worry about making documentation any clearer. So, if no specific objects are listed ahead of the colon, both `-f :UD=XXXXX,...` and `-f UD=XXXXXX,...` should both work.
#### Handling of `cd_value_count` for `UD=` filters
- For a `UD` filter with no params (e.g. `cd_vals`), is a `0` still nonetheless needed for the `cd_value_count` parameter. This does seem to work either way. That is good.
- If you specify a `cd_value_count` of `K` and provide fewer than `K` values, this is caught as an error and `h5repack` does not proceed. This is also good. The reverse is not, however, true. If you specify a `cd_value_count` of zero but provide more values, no error is generated and, indeed, the resulting repacked datasets show those extra values as part of the filter parameters.
#### When `filter_flag` is `1` (mandatory)
- When a specific object is listed ahead of the colon character and the `filter_flag` is `1` indicating the filter is *mandatory*, then if the `can_apply` for the associated filter returns anything other than 1 for that object, that should be treated as an outright error by `h5repack`. An error message should be printed and the return value from `h5repack` should not be `0`.
- When the requested filter ID is not succesfully loaded (e.g. after all `dlopen()` calls there is nothing found matching the specified filter ID) and `filter_flag` is `1` indicating the filter is *mandatory, that should be treated as an outright error by `h5repack`. An error message should be printed and the return value from `h5repack` should not be `0`.
A stub filter I was using to test is [foo.c.gz](https://github.com/user-attachments/files/17822078/foo.c.gz)
Contributor guide
Assessment
This issue has not been assessed yet.