Skip to content

MiraMonVector: fix a case of mutirecord (lists) in some fields #11148

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

Merged

Conversation

AbelPau
Copy link
Contributor

@AbelPau AbelPau commented Oct 28, 2024

What does this PR do?

Fixes a found error writing a MiraMon vector from a JSON file. This JSON file contains some lists in some fields (not the first ones).
There was a memory allocation error due to an error in initializing the number of fields of the second MiraMon record.

The file:
LT05_L2SP_038037_20120505_20200820_02_T1_ST_stac_minimal.json

Tasklist

  • Make sure code is correctly formatted (cf pre-commit configuration)
  • Add a test case to prove the fix
  • All CI builds and checks have passed

@rouault
Copy link
Member

rouault commented Oct 28, 2024

It could be valuable to have a autotest check demonstrating the fix

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 28, 2024

It could be valuable to have a autotest check demonstrating the fix

Yes, I'm preparing it but it take a lot of time (due to docker, windows instead of linux and this kind of things). Meanwhile I was preparing the draft to have some work done.

Tomorrow I'll have prepared! Thanks.

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 28, 2024

It could be valuable to have a autotest check demonstrating the fix

Where is the appropiate place to leave the "problematic" JSON file?
"autotest\ogr\data\jsonfg" or "autotest\ogr\data\miramon\reading_test"

thanks!

@rouault
Copy link
Member

rouault commented Oct 28, 2024

"autotest\ogr\data\miramon\reading_test"

more that one. But do you actually need a test file? Can't that be reproduced by using CreateFeature() directly with the appropriate field definition and feature values ?

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 28, 2024

"autotest\ogr\data\miramon\reading_test"

more that one. But do you actually need a test file? Can't that be reproduced by using CreateFeature() directly with the appropriate field definition and feature values ?

It's a very short file (21 kb) and has like 20 fields, some of the with lists. Not complicated to create but more reliable to check from the original file (that has caused the problem) than a created one.

But if you think it's better I can try to create it.

@rouault
Copy link
Member

rouault commented Oct 28, 2024

Or try to really minimize the input dataset to the minimum that is actually needed. While 21 kb doesn't sound large, if for every bugfix in the > 250 drivers we have we would do that, that would amount to something huge.

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 28, 2024

Or try to really minimize the input dataset to the minimum that is actually needed. While 21 kb doesn't sound large, if for every bugfix in the > 250 drivers we have we would do that, that would amount to something huge.

Sure, I can eliminate all not necessary fields to reproduce the error and then use that. Let me try!

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 28, 2024

Or try to really minimize the input dataset to the minimum that is actually needed. While 21 kb doesn't sound large, if for every bugfix in the > 250 drivers we have we would do that, that would amount to something huge.

Sure, I can eliminate all not necessary fields to reproduce the error and then use that. Let me try!

LT05_L2SP_038037_20120505_20200820_02_T1_ST_stac_minimal.json

Here it is: 3 Kb (7 times less). I deleted unnecessary assets and other...

@coveralls
Copy link
Collaborator

coveralls commented Oct 28, 2024

Coverage Status

coverage: 69.422% (+0.001%) from 69.421%
when pulling b73b846 on AbelPau:MiraMonVector-fix-stringlist,-integerlist,--case
into b4a3fde on OSGeo:master.

@AbelPau AbelPau force-pushed the MiraMonVector-fix-stringlist,-integerlist,--case branch from 01a09fe to 6ea9158 Compare October 29, 2024 15:49
@AbelPau AbelPau marked this pull request as ready for review October 30, 2024 06:39
@rouault rouault merged commit 77a4479 into OSGeo:master Oct 30, 2024
38 checks passed
@rouault
Copy link
Member

rouault commented Oct 30, 2024

The backport to release/3.10 failed:

The process '/usr/bin/git' failed with exit code 128
stderr
error: commit fde7c6c25d13fbb40bd732a10ecc168f43375064 is a merge but no -m option was given.
fatal: cherry-pick failed

stdout
[backport-11148-to-release/3.10 89a3ecd34d] MiraMonVector: fix a case of mutirecord (lists) in some fields
 Author: AbelPau <a.pau@creaf.uab.cat>
 Date: Mon Oct 28 17:06:41 2024 +0100
 3 files changed, 160 insertions(+), 4 deletions(-)
 create mode 100644 autotest/ogr/data/miramon/reading_test/LT05_L2SP_038037_20120505_20200820_02_T1_ST_stac_minimal.json

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.10 release/3.10
# Navigate to the new working tree
cd .worktrees/backport-release/3.10
# Create a new branch
git switch --create backport-11148-to-release/3.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 6ea915861e5975b0b6b2d50c375c1fa94921f2d6,fde7c6c25d13fbb40bd732a10ecc168f43375064,b73b846c1bdb6b199d1e80436a7715bc56d18598
# Push it to GitHub
git push --set-upstream origin backport-11148-to-release/3.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.10

Then, create a pull request where the base branch is release/3.10 and the compare/head branch is backport-11148-to-release/3.10.

@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 30, 2024 via email

@rouault
Copy link
Member

rouault commented Oct 30, 2024

Remember I am using Windows :(

ah, perhaps you need to a shorted name, so maybe something like
git worktree add .worktrees/bkptr310 release/3.10

But nevermind for that backport. I'll manually cherry-pick since I want to issue a RC2 soon

rouault pushed a commit that referenced this pull request Oct 30, 2024
Fixes a found error writing a MiraMon vector from a JSON file. This JSON file contains some lists in some fields (not the first ones).
There was a memory allocation error due to an error in initializing the number of fields of the second MiraMon record.
@rouault
Copy link
Member

rouault commented Oct 30, 2024

cherry-picked in release/3.10 per commit c373931

@rouault rouault added this to the 3.10.0 milestone Oct 30, 2024
@AbelPau
Copy link
Contributor Author

AbelPau commented Oct 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants