git-lint icon indicating copy to clipboard operation
git-lint copied to clipboard

Fix optipng-linter.sh to handle multiple pngs

Open siebert opened this issue 6 years ago • 3 comments

Also clean up the script and make it pass shellcheck.

siebert avatar Oct 17 '18 12:10 siebert

I have no idea why Travis CI complains about formatting in python files when only a shell file is changed by this commit. Seems to me an error in the CI configuration.

siebert avatar Oct 17 '18 12:10 siebert

@siebert I don't see how this PR is handling multiple images. Note though that instead of using that simplistic script a much better alternative would be to use https://github.com/sk-/optimage.

Thanks for pointing the problem with the Python formatting, the reason is because I didn't pin the yapf version in the requirements.

sk- avatar Oct 17 '18 13:10 sk-

The actual fix is this line:

OUTFILE="$(mktemp)"

Using a fixed tempfile name didn't work for me for patches which contains multiple pngs. Apparently the script is run in parallel, so the same tempfile is rewritten/removed by other instances when tried to read by the current instance which then fails.

siebert avatar Oct 17 '18 13:10 siebert