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

Some errors produce empty files and fail silently #49

Open
joshbarrass opened this issue Jun 23, 2023 · 3 comments
Open

Some errors produce empty files and fail silently #49

joshbarrass opened this issue Jun 23, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@joshbarrass
Copy link

joshbarrass commented Jun 23, 2023

In the case of some errors (an example of an error where this occurs is reported in #48), PSXPackager will write an empty (or almost empty) file and fail silently (exit code 0, which ordinarily indicates success). As a result, automated scripts cannot easily detect these failures and will assume that the output file is valid. For destructive scripts, i.e. scripts that delete the original files once conversion is complete, this will cause loss of data.

Ideally, the program should not return an exit code of 0 if the conversion was unsuccessful, and should also clean up after itself in such cases to prevent empty files from being misinterpreted as successful conversions.

Steps:

Expected results:

Conversion is unsuccessful. echo $? returns a non-zero value, indicating failure. No PBP file is produced.

Actual results:

Conversion is unsuccessful. echo $? returns 0, indicating success. A small PBP file containing no ROM data is produced.

@RupertAvery
Copy link
Owner

I will add an appropriate return value.

  • 0 = success
  • -1 = error
  • -2 = cancelled

@RupertAvery
Copy link
Owner

RupertAvery commented Jul 9, 2023

So I found out that in linux the number returned is an unsigned int from 0-255, so the above gets returned as 0, 255, 254. I read that error values shoul be 0-125, as the MSB is used by the system. This is of course up to us, but what would you prefer or what is recommended or makes more sense?

Is 0, 1, 2 better?

RupertAvery added a commit that referenced this issue Jul 9, 2023
Do a case-insensitive search for resource files -  #48
Return a non-zero error when exiting after an error occurs - #49
@joshbarrass
Copy link
Author

0, 1, 2 seems reasonable to me. I think these are pretty standard return codes to use.

@RupertAvery RupertAvery self-assigned this Sep 8, 2023
@takano32 takano32 added the bug Something isn't working label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants