←back to thread

217 points tanelpoder | 1 comments | | HN request time: 0s | source
Show context
jandrese ◴[] No.26492618[source]
This seems to be more of "don't paste garbage into a terminal, especially as root." With a sidenote that it might be safer if your custom application command interpreter didn't use > as the prompt character. I note that Bourne shell defaults to the safer % and # characters for the prompt. The # character for root is especially safe.
replies(6): >>26492739 #>>26492951 #>>26494723 #>>26499063 #>>26499191 #>>26501459 #
tanelpoder ◴[] No.26492951[source]
Yep (author here), not pasting garbage into a terminal is the main point of this article. Partially, it's a rant against the way-too-trigger-happy "paste clipboard on right mouse click" terminals too.

I decided to finally write this article, after seeing a yet another "mysterious" case of a missing binary in some Oracle database server. Linux/Bash defaults are ok, but historically (coming from traditional Unix background?), people who engineer environments at least in the Oracle database server world, configure their prompts to some "corporate standard". And sometimes they end up suffixing prompts by a nice-looking ">" character, leading to this problem.

I've also seen someone set their root prompt to `root#>`. Since there's no space between the username and #, the "comment start" is not recognized and the redirection clobbering problem is still there.

replies(2): >>26493955 #>>26495384 #
adrian_b ◴[] No.26495384[source]
Because of this problem, good terminals require confirmation before pasting any strings that contain suspicious characters, e.g. carriage returns.
replies(1): >>26498491 #
tinus_hn ◴[] No.26498491[source]
I have seen a ‘good terminal’, apparently. Can you name one?
replies(3): >>26498639 #>>26499237 #>>26517765 #
1. andrey_utkin ◴[] No.26517765[source]
Xfce4-terminal prompts for confirmation when there's newline in the pasted contents.