Skip to content
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

ERS files with ECW connections in their headers fail to open, due to "Attempt at recursively opening ERS dataset" failure. #9352

Closed
mlittlemore opened this issue Feb 29, 2024 · 3 comments
Assignees

Comments

@mlittlemore
Copy link

Using GDALOpen to load an ERS file.
ERSDataset opens the file then finds that the DataSetType is Translated.
This then calls another GDALOpen within the driver, attempting to open an ECW file.
When checking each driver, looking for the ECW one, it hits the ERS one again which triggers the "Attempt at recursively opening ERS dataset" error.
Then because this is an error, the entire GDALOpen process fails.

I think this would not happen if this recursion check in ERSDataset::Open would occur after the Identify check, so only check for recursion if trying to load an ERS file.

Also this is only happening because the ECW driver is after the ERS driver in the driver list. Not sure if there is a way to change this order.

@rouault
Copy link
Member

rouault commented Feb 29, 2024

Please attach a dataset that can be used to reproduce the issue

@rouault rouault added the awaiting_feedback Awaiting feedback from reporter label Feb 29, 2024
@mlittlemore
Copy link
Author

LandsatImage.zip

@jratike80
Copy link
Collaborator

jratike80 commented Mar 1, 2024

For some reason my gdalinfo knows what to do. Maybe because I have ECW on the top on the format list.

gdalinfo landsat_rgb741_image.ers
Driver: ERS/ERMapper .ers Labelled
Files: landsat_rgb741_image.ers
       landsat_rgb741_image.ecw
Size is 2021, 2265
Coordinate System is:
...

EDIT
Indeed OSGeo4W sets the drivers in different order and I can confirm the error:

gdalinfo landsat_rgb741_image.ers --debug on
GDAL: Auto register C:\OSGeo4W\apps\gdal\lib\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW.
ERROR 1: Attempt at recursively opening ERS dataset
gdalinfo failed - unable to open 'landsat_rgb741_image.ers'.

@rouault rouault removed the awaiting_feedback Awaiting feedback from reporter label Mar 5, 2024
@rouault rouault self-assigned this Mar 5, 2024
@rouault rouault closed this as completed in 717f746 Mar 5, 2024
rouault added a commit that referenced this issue Mar 5, 2024
ERS: avoid 'Attempt at recursively opening ERS dataset' when the .ers file references a .ecw (fixes #9352)
rouault added a commit that referenced this issue Mar 5, 2024
… file references a .ecw (fixes #9352)

The issue was no longer reproducible in master/3.9dev due to the
https://gdal.org/development/rfc/rfc96_deferred_plugin_loading.html
change, but was still somehow latent. This commit fixes the issue in the
3.8 branch
rouault added a commit that referenced this issue Mar 5, 2024
[Backport release/3.8] ERS: avoid 'Attempt at recursively opening ERS dataset' when the .ers file references a .ecw (fixes #9352)
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

No branches or pull requests

3 participants