ZeroPain in FileSwitch
André Timmermans (100) 655 posts |
Got the following ZeroPain after clicking on “add Game…” in s!ScummVM RPi 3 (OS 5.25 15 Aug 2018) Time: Thu Aug 23 19:07:27 2018 R0 = 0227b33c R1 = 0227b33c R2 = 00000001 R3 = 00000000 fc04a3cc : 1354001f : CMPNE R4,#&1F ; =31 |
Sprow (202) 1158 posts |
This is function WildMatch with a null pointer for the wildcarded name. It’s most likely given you pressed a button to add a game, which could involve enumerating a directory, that ScummVM is the origin of the error. What FS are you using? The ResolveWildcardBySteam function is the only caller of WildMatch I can see that doesn’t carefully check R2 for NULL before calling. |
André Timmermans (100) 655 posts |
The FS is irrelevant, I was trying to set a different default path, it is just that I had not set it correctly. It should be / |
Steve Pampling (1551) 8170 posts |
Which I think is similar to the cause of the errors being reported when SyncDiscs does a compare and people report a zeropain error from FilerAction. As I said in the SyncDiscs thread I think SyncDiscs is feeding incorrect values to the OS in certain circumstances. The real question on this is should the OS check and refuse if the values are incorrect or should we insist that application authors have to fix all their code? |
Jeffrey Lee (213) 6048 posts |
Why not both? If the program is passing in a bogus wildcard / path then regardless of whether the SWI returns an error, I doubt the SWI is going to be doing what the programmer intended. |
Steffen Huber (91) 1953 posts |
Yes, of course. Especially if it would result in an illegal memory access.
The code cannot do anything sensible anyway, so it needs o be fixed anyway. Ah, Jeffrey says the same. Good :-) |
Rick Murray (539) 13840 posts |
I’m still trying to work out what OS change (in 5.25) caused the HidePtr module to go nuts. It’s a pretty moot point (HidePtr isn’t exactly essential), but it does hidelight how changes can have…consequences in unexpected places.
Define “API”. What the nearly thirty year old documentation says even if it doesn’t match what the firmware actually does, [and this will be the moment nemo thinks “oh, Rick finally gets it” ;-) ]
And all the other SWIs within RISC OS that take pointers? ;-) I’m not sure the OS needs to be changed. My understanding of this is that FileSwitch is causing a zeropain issue because something is providing it with a rubbish pointer. In keeping with RISC OS in general, it tries to do something with the bad pointer, and obviously fails. But the fault is neither RISC OS nor FileSwitch. It’s the software providing the bad pointer. Fix that, and the problem is resolved. Fix FileSwitch, then it will cope better with bad pointers but the broken program will still be broken. |
Chris Johnson (125) 825 posts |
Could I reinterate that as far as I know, SyncDiscs does not raise zero pain errors when comparing directories or synchronising directories. I have done a lot of testing recently trying to provoke such errors, and have seen no entries in the log. If people are seeing zero pain log entries involving SyncDiscs, then I hope they will (a) tell me and (b) provide a copy of the log. I have also added some code to deal with situations where a network filing system is either not present or the disc is not mounted, etc. This is mainly to prevent SyncDiscs stalling when a job is initiated at some specified time when the machine is unattended, rather than for zero pain. I will put the latest version up on my site. |
Steve Pampling (1551) 8170 posts |
There’s this guy called Rick Murray that has in the past suggested the OS should be more robust…
The point is while the OS accepts the incorrect input, albeit with a bad reaction of varying degree in different instances, authors don’t fix the software. |
Steve Pampling (1551) 8170 posts |
Why not both? Well, that would be ideal if you can persuade all authors to accept that when the change results in their software not working it’s not the fault of the OS. Given the reaction I’ve seen in recent years to (medical) software with a web front end breaking because MS fixed security holes in IE that their1 software relied on I’d say there may be a few “spirited discussions”. This is a smaller pond. 1 GE Medical first among others. |
Rick Murray (539) 13840 posts |
Indeed it should be, but I’d be first concentrating on design flaws (such as code and data strewn across the RMA).
That requires complaints from users that the software doesn’t work correctly? Some zero pain problems are innocuous – for example in a certain DTP package it liked to check if an array was null or if an element of that array was null… leading to an unnecessary check of an offset of a null pointer. That’s innocuous. Let’s wait until this one is unwound a little more. What we know is that FileSwitch is getting a null pointer for a wildcarded name…
Yup. A fake zero page. Which, these days, is one of the options for people who just want to run the machine like before and have their software run like before (even if it’s a creeping cesspit of bugs) because, as you said:
End users, too, if it’s something unlikely to be further developed.
GE? As in the makers of the minigun? The oil for food thing? The “let’s dump radioactive waste all over the place and see what the effect is on civilians”? The “let’s make your balls glow in the dark” (Walla Walla prison)? The let’s dump toxic waste in the river (multiple locations)? If that’s the GE we’re talking about, it’s probably a good thing if their software doesn’t work… |
Chris Johnson (125) 825 posts |
I rechecked the thread, and was a bit puzzled why the thread sort of fizzled out without any mention of a fix. However, checking back in my archived emails with the user who had the problems reminded me a bit more about the resolution. To cut a long story short, it was due to power supply problems to the board and accessories. The supply was loaded ‘to the limit’. Once this was addressed, the zero pain problems involving SyncDiscs immediately disappeared. It would appear that both USB and SSDs draw extra current when being worked hard. Applications such as SyncDiscs obviously exercise the drive(s) continuously so power supply problems are more likely to show up. I am not sure why the resolution of that particular problem was never posted back to the forum. |
Steve Fryatt (216) 2105 posts |
You’re kind of supposed to do that, are you not…? In a sensible language (ie. not BASIC), that kind of OR won’t even bother testing the second “index of” clause if the initial “is the pointer NULL?” test fails. I thought the problem was that a certain DTP package had the clauses the wrong way around: test the index, then test the pointer? The overall result is the same, but the pointer is always dereferenced first – even if the second test then shows it to be NULL and causes the subsequent code to be skipped. |
Steve Pampling (1551) 8170 posts |
Might be interesting (and possibly useful) if Fileswitch (for one) were rewritten to check the input for naff values and available as a softload to see what software breaks.
Yes. The GE with fingers in so many pies that apparently employees are provided with a catalogue of goods and services they can get from the different sections. |
Steffen Huber (91) 1953 posts |
Ah, but I define “sensible language” as one to provide the developer with an easy way to either enforce full evaluation or else as short-circuit. Unfortunately, this reduces the number of sensible languages available a lot…hint: one of them uses “or else”, another “or_else” :-) |
David Gee (1833) 268 posts |
BASIC isn’t the only language that doesn’t short circuit; Pascal is similar. ISTR the same applies to Fortran. Don’t know what languages Steffen is thinking of, but Visual Basic has OrElse (and AndAlso), as well as And and Or; that makes it a sensible language! |
Steve Drain (222) 1620 posts |
A syntax that might be implemented in BBC BASIC is However, it is quite simple to implement the functionality of these shortcuts in BBC BASIC for branching, so does that make it “a sensible language” or not? ;-) |
Steffen Huber (91) 1953 posts |
Ada uses “and then” and “or else”, DEC Pascal (which was internally a kind of Ada with a Pascal parser bolted on) uses “and_then” and “or_else” to keep ISO Pascal compatibility. Of course both “full” and “short circuit” variants are easily “simulated” with other language elements if not directly available, so the “sensible language” comment is more tongue-in-cheek. I was often surprised how many seasoned developers using a specific language did not know about those semantics of the language they were using! And if you are switching languages often, you really have to think about it every time to avoid easy mistakes. |