savoirfairelinux / cqfd

cqfd helps running commands inside the Docker container configured for your project, keeping the user and working directory the same inside the container
GNU General Public License v3.0
64 stars 31 forks source link

Prevent cqfd from globbing release files before the build #88

Closed Ballasi closed 1 year ago

Ballasi commented 1 year ago

The following code:

https://github.com/savoirfairelinux/cqfd/blob/46ea5bc458dec354a5a5cce2e3c8dde51b2fe5c2/cqfd#L382

causes a potential glob of the cqfd release files to happen, in the config_load() function, i.e., before the build command has been started.

If a file has already been built previously, and contains a name that can be different from a build to another (for instance because it contains the build date, the git description, ...), it therefore may break on cqfd release calls as it tries to glob the filename with the previous name.

Here is an example environment that reproduces this bug:

.cqfdrc

[project]
org='org'
name='name'

[build]
command='rm -f file_* && touch file_$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 8 | head -n 1)'
files='file_*'

.cqfd/docker/Dockerfile

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
joufella commented 1 year ago

fixed by 3a7d8c66390.