Today I ran into a fun little bug while debugging the shell I've been working on, while also using my VT420.
My terminal has been weird for a while, and will sometimes fail to backspace on things such as password inputs. In this case, with my shell, it would print
^H instead of actually deleting a character.
So, what happens if you run
ls -l foo ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H?
You get the wonderful
: No such file or directory. But it should be listing the contents of
foo. What's going on?
From this, we can infer some code in
printf("%s: cannot access %s: No such file or directory\n", command, filename);
As we can see, because the
filename string has backspace characters in it, C will print it out, including the backspace characters, thus deleting the printing about the command being run and the filename.
Thankfully, this wasn't an issue with my shell, but rather my terminal. Changing firmware settings for the backspace key fixed things, including backspacing on password input.