Nature40 / pimod

Reconfigure Raspberry Pi images with an easy, Docker-like configuration file
GNU General Public License v3.0
127 stars 19 forks source link

Chaining commands with && has unexpected behaviour #47

Closed zabealbe closed 2 years ago

zabealbe commented 2 years ago

RUN apt update && apt install git runs apt install in host environment

RUN apt update RUN apt install git fixes the issue, however this can lead to hours wasted in debugging time expecially if you expect it to work similarly to a Dockerfile. I think a fix is needed if possible, however I did not investigate if the fact that .pimod is just a bash file is a barrier for an actual fix.

oxzi commented 2 years ago

Thanks for trying out pimod and reporting back.

I am sorry hearing your bug hunting odyssey regarding the bashism. Without any intention to sound rude, this is exactly the described behavior. However, especially with the Docker-inspired design, this is might be counterintuitive.

As long as we don't change the software's main architecture - the Pifile is just Bash and the commands are loaded for each step -, I don't see how we can prevent this. And, btw, I don't want to change this design. What I could think of would be a new pre-stage checking the Pifile for lines containing unescaped RUN commands with other Bash commands and printing a warning. How does this sound to you?

zabealbe commented 2 years ago

For my needs I ended up creating a pre stage in python that acts as a precompiler as well using jinja2 templating language.

I think pimod is amazing and using the Dockerfile syntax as a image building schema is something that should have been done before. However using bash only could reveal itself a limiting factor in the future if you plan to expand the project, on the other hand this project is actually very good as is and new features might just not be needed (“except for checkpoints pls”)