Skip to content

Commit b2201a5

Browse files
authored
Merge pull request #470 from jmtd/OPENJDK-2824-binary-copy-dir-perms
[OPENJDK-2850] assemble: binary: Don't set times on directories
2 parents b7ac43b + 309d1c9 commit b2201a5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ function maven_s2i_custom_binary_build() {
2929
binary_dir="${S2I_SOURCE_DIR}"
3030
fi
3131
log_info "Copying binaries from ${binary_dir} to ${S2I_TARGET_DEPLOYMENTS_DIR} ..."
32-
rsync --archive --out-format='%n' "${binary_dir}"/ "${S2I_TARGET_DEPLOYMENTS_DIR}"
32+
33+
( # OPENJDK-2850: use glob (dotglob to match hidden files) to stop rsync altering
34+
# timestamps of S2I_TARGET_DEPLOYMENTS_DIR. Don't alter parent shell's dotglob.
35+
shopt -s dotglob
36+
rsync --archive --out-format='%n' "${binary_dir}"/* "${S2I_TARGET_DEPLOYMENTS_DIR}"
37+
)
3338
}
3439

3540
function maven_s2i_deploy_artifacts_override() {

modules/s2i/core/tests/features/s2i-core.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,14 @@ Feature: Openshift S2I tests
66
Scenario: run an s2i build and check that /tmp/src has been removed afterwards
77
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
88
Then run stat /tmp/src in container and immediately check its output does not contain File:
9+
10+
# OPENJDK-2850 - ensure binary-only s2i doesn't try to change timestamps of
11+
# S2I_TARGET_DEPLOYMENTS_DIR. Use /var/tmp as a directory where attempting to
12+
# will fail. This simulates the s2i process running as a random UID, which can't
13+
# change timestamps on the default directory, /deployments.
14+
Scenario: Ensure binary-only build doesn't fail trying to set timestamp of S2I_TARGET_DEPLOYMENTS_DIR (OPENJDK-2850)
15+
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-2408-bin-custom-s2i-assemble with env
16+
| variable | value |
17+
| S2I_TARGET_DEPLOYMENTS_DIR | /var/tmp |
18+
Then s2i build log should not contain rsync: [generator] failed to set permissions on "/var/tmp/.": Operation not permitted
19+
And run stat /var/tmp/spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar in container and check its output for Access:

0 commit comments

Comments
 (0)