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

cct: emit error message and return error code when not being able to open input file #4200

Merged
merged 1 commit into from
Jul 21, 2024

Conversation

rouault
Copy link
Member

@rouault rouault commented Jul 15, 2024

Fixes #4198

CC @busstoptaktik I believe it is better to explicitly fail when the/an input file is missing than silently going on

@kbevers
Copy link
Member

kbevers commented Jul 15, 2024

I believe it is better to explicitly fail when the/an input file is missing than silently going on

So do I. Note that Thomas is on vacation and it could be a while before he sees this.

@busstoptaktik
Copy link
Member

On holidays and commenting from my phone, so my ability to grasp the overall problem tackled by this PR is quite limited. But if I understand the issue reported by @jidanni, the problem is that when given meaningless +arguments, cct does not react properly: The epsg:nnnn looking like an arg to "+to", if cct was cs2cs, should be taken as the name of an input file by cct, but apparently is not?

If no input file names are given, cct, like any filter style program, should not complain, but read stdin, write stdout. And the syntax used in the issue should perhaps give unchanged output?

@rouault
Copy link
Member Author

rouault commented Jul 18, 2024

the problem is that when given meaningless +arguments, cct does not react properly: The epsg:nnnn looking like an arg to "+to", if cct was cs2cs, should be taken as the name of an input file by cct, but apparently is not?

cct considers the epsg:nnnn as a filename from which to take input coordinates, and without the fix in that PR, it fails to open it, but without any error message, and without returning in error, and when opt_input_loop() has consumed all input filenames, cct returns with a success error code. With that PR, it should be more obvious that invalid arguments have been provided. This won't obviously catch all potential non-sensical inputs, but I believe it is valuable to report invalid filenames.

@rouault rouault added this to the 9.5.0 milestone Jul 21, 2024
@rouault rouault merged commit 7d766a4 into OSGeo:master Jul 21, 2024
23 checks passed
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.

Make output or error message
3 participants