lykahb / neotools

Command-line tools for AlphaSmart NEO
GNU General Public License v3.0
39 stars 7 forks source link

`ASAlphaWordText: possibly untrapped escape 182` when operating on a binary file #9

Closed TheTechRobo closed 1 year ago

TheTechRobo commented 2 years ago

What does that warning mean? Should I be worried?

I also got a bunch of similar ones. Here's the full log:

~/NeoStuff ❯❯❯ sudo neotools files read-all --path 15Jul2022/
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 181
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 181
ASAlphaWordText: possibly untrapped escape 168

(run with sudo not because permission denied, but because generator didn't yield - i'm assuming the same root cause )

lykahb commented 2 years ago

The errors are not related to each other.

I could help with the installing neotools if you post the full stack trace for "generator didn't yield". Can you check the version of python used to run neotools?

The error "possibly untrapped escape" tells that neotools cannot process the contents of a file on the device. Likely, one or more files are invalid. Do any files have unusual characters? Is there a small reproducible example? You could start by figuring out which file fails to read and then trim it down.

TheTechRobo commented 2 years ago

I know the generator didn't yield is a separate issue, I was just clarifying why I was using sudo.

I could help with the installing neotools if you post the full stack trace for "generator didn't yield". Can you check the version of python used to run neotools?

It appears it was the normal "permission denied" error but then a RuntimeError was raised so I did not see the permission denied.

The error "possibly untrapped escape" tells that neotools cannot process the contents of a file on the device. Likely, one or more files are invalid. Do any files have unusual characters? Is there a small reproducible example? You could start by figuring out which file fails to read and then trim it down.

Hm, I have two PalmOS Monopoly games. I can put them both here. They are binary files (I transferred them to my NEO2 with IR to see if they were text.)

Let me see...

TheTechRobo commented 2 years ago

It is a binary file that's causing the issue! (Or, rather, probably two.)

Subtracting the garbage output that is the file:

~/N/testing ❯❯❯ sudo neotools files read mono\ poly\ game0
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 181

Here's the actual file (as extracted by neotools): https://thetechrobo.ca/monopoly_file_neo2

I'd recommend adding something to the README that mentions the error or improving the error message, as evidently it's possible to sneak binary files onto the AlphaSmart.

lykahb commented 2 years ago

The access to USB can be denied if some configuration is missing. This is a common problem, described at https://github.com/lykahb/neotools#access-denied.

Yeah, Neotools assumes that the AlphaWord files are text. I doubt that much else can be done here other than aborting the text conversion early with the message that a file is corrupted. I'm curious how Neo handles a binary file.

TheTechRobo commented 2 years ago

Yeah, Neotools assumes that the AlphaWord files are text. I doubt that much else can be done here other than aborting the text conversion early with the message that a file is corrupted. I'm curious how Neo handles a binary file.

It just seems to show it as any ordinary text editor would show a binary file - random characters everywhere.