5 ms·
> If my application depends on some of those zero'd fields, it seems like that has potential to cause serious debugging problems, as opposed to just causing an
by chii 9y ago
> If my application depends on some of those zero'd fields, it seems like that has potential to cause serious debugging problems, as opposed to just causing an error on the parse.
if your app didn't used to handle the 'zero' case (assuming zero was a "valid" value for said field), then the app was poorly written and would'be been broken in the first place. However, if the app _did_ handle the 'zero' case, then the app continued to work! The end user would've been none-the-wiser about the change (mostly), and some time later, the app could be upgraded to ignore those known fields.
Causing a parse error would mean the app stopped working altogether. Much worse a result for the end user.
- piker 9y agoI guess that depends on whether or not zeros were valid in the first instance. My post assumed they were. I agree with your point if zero would be outside of the valid range in the first instance.
- hyperpape 9y agoThere are many cases where continuing with invalid data is much worse than a parse error. Perhaps that's less likely in this case (hopefully your credit card payment doesn't depend on the values in /proc/<pid>/stat), but as a rule, silently continuing with meaningless data is scary.
- deleted 9y ago[deleted]
- notheguyouthink 9y agoYea that's what I was thinking. If the behavior changes, what "works" entirely depends on the context of that specific application. I can understand mitigating complete failures as much as possible, but trying to trick programs into thinking that they're running the same as they were before seems.. well, scary as hell. I'm honestly not sure what's worse - breaking the application, or making it think everything is fine.
- spdionis 9y agoNot when the application was to supposed to handle the invalid data anyway before. Because you had to handle the zero case before right? The idea is that in the worst case you get an error message, not an altogether crash.
- deleted 9y ago[deleted]
- cmiles74 9y agoIf your application relies on these sort of interfaces with the kernel, then presumably you're paying attention when you upgrade the kernel.
- hasenj 9y agoIt sounds like a chance for logical errors to go undetected before they cause issues somewhere totally unrelated.
- catpolice 9y agoZero could be a perfectly "valid" value and still break your application if changing the function to always return zero breaks an implicit contract. Suppose the previous behavior of the function returned something you could use as an ID for some internal representation in a database that you could look up and write to. Before, the ID you got back depended on the input, but now it doesn't. And you can't tell you're not getting real IDs back anymore, so you just happily write to the database. Now you're corrupting your database because the implicit behavioral contract you were relying on was broken - I'd MUCH rather the program just crash than for it to continue "working" in a way that irrecoverably corrupts data.
- nialv7 9y ago> then the app was poorly written and would'be been broken in the first place. If you present this argument to Linus, you will certainly get yelled at. Not breaking the user space means not breaking the user space even when it's broken. A couple years back glibc broke Adobe Flash because Flash used memcpy wrong. Linus was quite vocal about it.