GetPoplog / Seed

Scripts for getting Poplog onto your Linux machine
MIT License
7 stars 3 forks source link

Escape newlines in the environment. #96

Closed sfkleach closed 3 years ago

sfkleach commented 3 years ago

Although newlines in environment variables are a very unusual situation generally and will not arise for the Poplog environment variables at all, I have taken a shot at managing this situation.

What this exposes is that there are quite a few unpleasant and unhandled possibilities for non-printing characters to cause mayhem. And this fix actually makes the situation slightly worse, because some transformation is done on the makeStage2.sh side and some on the makePoplogCommander.sh side, which is why I have isolated it in a separate spike.

At the moment I think it would be better to throw an error if any captured environment variable had a newline in it. If only I could work out a neat way of doing that! To do it more properly, I think I would reach for the Python3 monkey wrench and do everything, including the transformation to C-code in Python3.