php icon indicating copy to clipboard operation
php copied to clipboard

generate-stackbrew-library.sh: Fix detection of deleted files in COPY command

Open teohhanhui opened this issue 6 years ago • 5 comments

Don't let the shell do glob expansion, because it would not find deleted files. git can.

(Discovered when I did https://github.com/coopTilleuls/docker-varnish/pull/39, and fixed in https://github.com/coopTilleuls/docker-varnish/pull/40)

/cc @tianon

References: https://github.com/koalaman/shellcheck/wiki/SC2207 https://github.com/koalaman/shellcheck/wiki/SC2068

teohhanhui avatar Mar 28 '19 17:03 teohhanhui

We don't really have the problem of files deleted without some other change in the Dockerfile context directory. php is the only one we maintain with a glob in the COPY/ADD and I doubt we'll be deleting any of the docker-php-ext- scripts anytime soon.

yosifkit avatar Mar 28 '19 22:03 yosifkit

Well, I don't see any down side to this change. Do you? :)

It makes the script more robust and removes a shellcheck warning.

teohhanhui avatar Mar 28 '19 22:03 teohhanhui

Anyway, I think it might be very useful for Alpine variants, where patches may be routinely required (because not everybody cares so much about musl, unfortunately).

teohhanhui avatar Mar 28 '19 22:03 teohhanhui

The downside is the extra initial churn to PRing and/or committing this to our other 30+ repos in order to keep their generate-stackbrew functions in sync.

As for shellcheck warnings, they are irrelevant. We don't use shellcheck.

where patches may be routinely required.

If there is an obsolete patch, then the next version bump would fail to build and thus necessitate that we remove the patch in order to bump the version (ie "some other change in the Dockerfile context directory"). We don't commit a version bump without a successful build and test. On the other hand, if it builds successfully with a obsolete patch, then the patch is harmless and can be removed at the next context change (version bump).

yosifkit avatar Mar 28 '19 22:03 yosifkit

The downside is the extra initial churn to PRing and/or committing this to our other 30+ repos in order to keep their generate-stackbrew functions in sync.

Happy to wait until some other necessary change comes along, of course. :)

As for shellcheck warnings, they are irrelevant. We don't use shellcheck.

Shellcheck helps us write better shell scripts. Of course, you don't have to use shellcheck, but it's a valid warning in this case.

teohhanhui avatar Mar 28 '19 22:03 teohhanhui