jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.15k stars 1.07k forks source link

Escape the pylib path when using it in a shell command #2062

Open willaerk opened 4 months ago

willaerk commented 4 months ago

Ran into an error creating a deb package from a python package when the current working directory contains spaces.

{:timestamp=>"2024-05-16T15:17:42.793044+0000", :message=>"Process failed: /bin/bash failed (exit code 127). Full command was:[\"/bin/bash\", \"-c\", \"env PYTHONPATH=/var/lib/jenkins-swarm-client/workspace/publiq packages/packages/vendor/bundle/ruby/2.7.0/gems/fpm-1.15.1/lib/fpm/package:$PYTHONPATH python3 setup.py --command-packages=pyfpm get_metadata --output=/tmp/package-python-build-627893c057255449a6af5622973a2c6df56cf6dde757466135f518e6bcdc/metadata.json\"]", :level=>:error}

The pylib variable gets passed to a shell command unescaped which causes the problem. Adding a simple .shellescape solves the problem locally.