When compiled with the H5_DEBUG_API define, HDF5 allows tracing of its API calls ( https://support.hdfgroup.org/HDF5/doc/H5.user/Debugging.html ).
To redirect this call into its own logfile instead of the standard output or standard error, HDF5 uses the fdopen() function to make use of an already opened file description, the actual opening operation is left to the Unix shell, as in
HDF5_DEBUG="55 trace" a.out 55>trace-output.log|
However, this mechanism doesn't seem to work under msys bash / mingw. I could trace it down to a simple program:
#include <stdio.h>
main()
{
FILE*F = fdopen(55, "w");
perror("out 55");
fprintf(F, "hello\n");
return 0;
}
Then running it in the shell with
./a.exe 55>more.txt
This works well under Linux, even in the Windows Linux Subsystem, but not in the msys bash:
$ ./a.exe 55> more.txt
out 55: Bad file descriptor
and neither in window's cmd.exe, where it seems only the first 10 numbers are allowed ( https://technet.microsoft.com/en-us/library/bb490982.aspx ):
./a.exe 5> more.txt
out 5: Bad file descriptor
Did anyone else get this mechanism to work under windows? If not, maybe the HDF5 trace function should be modified to allow for a filename instead of just a numerical file descriptor. The function in charge is H5_debug_mask() in H5.c , and instead of calling fdopen() on digits found in the HDF5_DEBUG environment variable, it could check for something like a dot contained in the string, and if so interpret it as filename to be opened instead (assuming that debug package names never will contain a dot, and all logfiles must have a file extension when opening via this mechanism).
Any thoughts?
Werner
···
--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019 Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362