-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG assigning file variable to field_tree in index #25
base: develop
Are you sure you want to change the base?
Conversation
Thank you for your contribution.
For example the Fortran test examples/F90/grib_index.sh fails with
And also I ran valgrind on the C example:
and many errors were issued. e.g.
|
It appears to me that this PR is fine but triggers a latent bug in the underlying code set. |
Dear Shinji, |
I'm thiking about adding 'grib_file * dependents' member to the grib_file structure and queue 'newfile' in the chain so that grib_file_close_file (and grib_file_delete file too?) can avoid closing the file pointer as long as some 'dependents' exist. I will post a PR if I manage to cook a patch that sees ok. |
When _codes_index_add_file is invoked from codes_index_add_file, a new file
structure variable (newfile) is created and this variable is added to the
list of index files. However, later when the field_tree struct is
generated, the file variable obtained from file pool (grib_file_open) is assigned instead. The ID of file variable and newfile variable may not match. Later, this can produce errors when index file is read.
To reproduce an error:
Download and uncompress tar file examples.tar.gz:
tar xvfz examples.tar.gz
Compile both programs:
First execute:
./writeindex
Finally execute:
./readindex