fix: use profile.d to append CLASSPATH instead of WriteEnvFile#1180
Open
ramonskie wants to merge 1 commit intofeature/go-migrationfrom
Open
fix: use profile.d to append CLASSPATH instead of WriteEnvFile#1180ramonskie wants to merge 1 commit intofeature/go-migrationfrom
ramonskie wants to merge 1 commit intofeature/go-migrationfrom
Conversation
WriteEnvFile overwrites the single env file on every call, so the last
framework to run won the CLASSPATH, silently dropping all others.
Additionally, the old code read os.Getenv("CLASSPATH") at staging time
which is always empty, and embedded staging-time absolute paths that are
wrong at container runtime.
Switch all five affected Finalize() methods to WriteProfileD with the
standard prepend pattern:
export CLASSPATH="$DEPS_DIR/<idx>/<subdir>/<jar>:${CLASSPATH:-}"
Each profile.d script is sourced in order at startup so every framework
safely accumulates its entry without clobbering the others.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Five framework
Finalize()methods were usingWriteEnvFile("CLASSPATH", ...)to add their JAR to the classpath. This has two bugs:WriteEnvFilewrites a single file at$DEPS_DIR/<idx>/env/CLASSPATH. Every subsequent call replaces the file, so the last framework to run wins and all others' JARs are silently dropped.os.Getenv("CLASSPATH")at staging time (always empty) and stored staging-time absolute paths (e.g./tmp/staging/deps/...) that are invalid at container runtime.Fix
Switch all five affected
Finalize()methods toWriteProfileDwith the standard prepend pattern used consistently elsewhere in the codebase (e.g.metric_writer,container_customizer,dist_zip,play):Profile.d scripts are sourced in sequence at container startup, so each framework safely accumulates its JAR without clobbering others.
Affected files
src/java/frameworks/java_cf_env.gosrc/java/frameworks/client_certificate_mapper.gosrc/java/frameworks/spring_auto_reconfiguration.gosrc/java/frameworks/postgresql_jdbc.gosrc/java/frameworks/maria_db_jdbc.go