Closed madhogs closed 2 months ago
I assume you are running bash. Please double check whether your TOTP input files are correct. The code you posted does not do what you think it does. The &
is a command separator that runs the previous command in a subprocess.
This:
echo otpauth://totp/Aaaaaaa?secret=JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBAA&period=30&digits=6&issuer=AA&algorithm=SHA1
Will really execute this:
echo otpauth://totp/Aaaaaaa?secret=JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBAA &
period=30 &
digits=6 &
issuer=AA &
algorithm=SHA1
So it could be that your file contains only this line:
otpauth://totp/Aaaaaaa?secret=JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXPJBAA
I don't quite remember if the TOTP LFS parser can handle that format with missing parameters.
My guess is that the lfs face behaved poorly when it ran out of memory and that the littlefs code did as well, though I'm currently using totp_lfs with 10 or so codes and haven't noticed any issues. Sorry about this! Didn't realise how tight it was when I wrote it like that.
You can check @matheusmoreira's theory by using cat.
I'll probably rewrite it to reparse the lines each time to avoid any memory issues.
@matheusmoreira The environment in the serial connection does not interpret the & symbol. I have double checked with quotes too but it makes no difference, the totp_uris.txt file looks correct, see below image.
@wryun I think that makese sense, I have a feeling this is a bug in both the lfs face (probably running out of memory as you suggested) and the filesystem code (failures seem to break it completely and it has to be reformatted).
The environment in the serial connection does not interpret the & symbol.
I see, I assumed that was being run on a normal Linux command line. It makes sense now, thank you for confirming.
My guess is that the lfs face behaved poorly when it ran out of memory
Probably... The regular TOTP face also ran into out of memory issues when I refactored it, and I used dynamic memory allocation because I read the LFS face code and thought it was alright. Fixed it by keeping most of the encoded data in static memory and only decoding the current TOTP code to RAM.
I was trying out the totp lfs face with the same codes as I use on the normal totp face but it not only fails with a watch reset but seems to cause some kind of filesystem breakage when it does. Steps to recreate:
To fix the watch again after following the above I had to modify filesystem_init in filesystem.c to format the lfs storage on boot.
The above is all on the RED board.
Also just to clarify this is an issue on the totp_face_lfs only, the regular totp_face works fine with no issues.