-
Notifications
You must be signed in to change notification settings - Fork 124
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
RFC: Removing the backup
option
#542
Comments
I fall heavily into the "Keep It" camp & do whatever you need to make it maintainable. My biggest reason is something I didn't see there nor above: it's an absolutely breaking change, & typically wouldn't be noticed by someone who updates to this version (eventually, ahem) until something in their workflow breaks, & they must have those presumably backed-up files. |
Thanks for the input! |
+1 for removing backup. Seems odd and unnecessary. PS - Related side topic: When would I use |
@ace-dent good points!
@AlexTMjugador do you have any thoughts on these? |
A note regarding |
I'm all for removing
The |
-- In the near 20yrs of experimenting with pngs, I have never found a broken CRC in the wild; only synthetic test images. I'm curious if anyone has ever genuinely found one?
-- A fair point. I just don't think |
Yeah, was going to say the same. Data corruption |
-- To state the obvious, in the real-world, if you cannot trust the CRC... I wouldn't want to trust what else of the bitstream is or isn't broken... 😅 |
For what it's worth, I've found from listening to user feedback on my apps that some popular PNG encoders (namely, those found in some versions of Photoshop and other image manipulation programs) do stupid things like adding trailing bytes to the PNG files they generate, even though they violate the PNG specification. Of course, this does not mean that such encoders are broken to the point of generating chunks with bad CRCs, but this experience has shown me that it's not surprising to find blatant errors in PNG encoders in current usage. Anyway, given that the maintenance cost of ignoring CRCs is low, that such an option is useful for fuzzing, and that safe Rust prevents memory safety problems that might arise from parsing potentially bad input, I'd just leave that option alone. |
That is unfortunately not true. We originally PR'd the We thus needed to do proper validation of those files. oxipng was already around and That said, I don't think oxipng needs to be able to "fix" them. Merely meant to point out that it does happen in practice. We're plenty happy to just reject the file. As for what encoders are at fault, in our experience it's usually some image manipulation programs. Wouldn't blame any in particular though, given it's hard to be sure how exactly "affected" users might have modified them. |
That's really interesting to hear, thanks for sharing! Are you saying that the images would be perfectly valid if the CRC was "fixed", or is that unknown? |
We don't collect samples in general, alas [1]. So I can't say for sure for all of them or give a breakdown. But here's a sample file from our test suite: https://github.com/shssoichiro/oxipng/assets/875533/8587151b-c4cc-4215-b080-dcdb32c4577d It does successfully render in most image viewers I try, but it fails oxipng processing (in the past with the adler32 error, nowadays with a less explicit 'Invalid data found; unable to read PNG file'). [1]: because ensuring perfect 1:1 pixel post-processing result is our main goal, so we reject anything even a little bit broken and don't take chances on automated fixes of any kind, in case they'd corrupt things and we'd realize it only months later with thousands of images subtly broken |
Oh I see, we've got slightly mixed up here. Adler32 is the zlib checksum; crc32 the PNG chunk checksum. The |
Sure, we're not using (or interested in) |
Yeah, for sure. I'd love to find out what they are and get them to fix it 😄 |
This is probably getting a bit off-topic but since you asked... On one of the very few documented cases we have (user came to us for support, then insisted to take the time to reproduce the issue instead of just reexporting differently), it was Windows (no version information, but looks like Windows 10 from the window decorations) with GIMP 2.10.10, producing files failing with (unfortunately, we didn't collect the source project files at the time, so yeah... not super useful) |
Nice, thanks. I haven't yet found anything related to bad Adler32 checksums, other than it's actually "normal" for PNG decoders to skip these anyway since it's redundant. Perhaps we should make fix apply to this too (except I don't think libdeflate will allow it). |
Oh nice find indeed! Wonder how many people will run buggy versions of those for years, unfortunately...
Personally I quite like overzealous checks for our use-case, as we've seen many wild edge-cases technically permitted by specs but breaking things badly, but we understand if it's a pain to maintain and is considered FP-like. |
Don’t worry, it’s not something we currently have control over since the deflate library we use doesn’t expose any options for it. And even so we would only want to skip it if |
@Tristan971 I just had a thought: Do you get people uploading APNGs at all? The current release of oxipng rejects these as unsupported but they will be supported in the next release. Would that be undesirable for your checks, or will it not matter? |
@andrews05 Yes, but we are relying on imagemagick’s identify tool to reject them so far, so that won’t be a problem 👍 (also glad to hear oxipng will support them; maybe we’ll revisit our own policy in that regard) |
Cool. |
We’ll look at it when and if we decide to allow these. For GIFs we always pick the first frame for non-animated thumbnailing purpsoes, but I know some animated formats allow things like different canvas sizes per-frame and we always have to keep this kind of thing in mind (since we do enforce resolution limits). We’ll see, thanks for the mention anyway! |
This has been done in v9. |
Tidy up the API by removing a couple of options we don't really need. Backup was discussed in shssoichiro#542 Check was discussed in shssoichiro#439 @shssoichiro Just say if you prefer to keep either of these 🙂
Hi all, I'm hoping to get some feedback from users regarding the
backup
option. @AlexTMjugador and I very briefly discussed the possibility of removing this, so I want to outline why the idea came up and some reasons why we might want to do this.The issue:
For user's of the API, the
backup
option is currently in the wrong place. It's provided as part of the mainOptions
struct for all uses of the API, even though it's only relevant when outputting to a file. It would be appropriate to move the backup option to be part of theOutFile
instead but the downside is that this makes the API more complicated to use.Why we might want to remove it
Why we might want to keep it
Alternatives for people who might be using it
Any comments on this would be welcome 🙂
@shssoichiro Definitely keen to get your input also.
The text was updated successfully, but these errors were encountered: