-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8341641: Make %APPDATA% and %LOCALAPPDATA% env variables available in *.cfg files #23923
base: master
Are you sure you want to change the base?
8341641: Make %APPDATA% and %LOCALAPPDATA% env variables available in *.cfg files #23923
Conversation
👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@alexeysemenyukoracle The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
@sashamatveev PTAL |
Webrevs
|
If you do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall with minor comment and question.
for (; it != end; ++it) { | ||
if (it->type() == ESCAPED_CHAR) { | ||
ss << it->value().substr(1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else {
in one line for consistency.
src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/TokenReplace.java
Outdated
Show resolved
Hide resolved
…nReplace.java Co-authored-by: Andrey Turbanov <[email protected]>
…koracle/jdk into JDK-8341641-master
|
This is true for any shell behavior. It is also true that some shells fail to expand undefined variables if configured accordingly. Bash, for example:
Output:
.cfg files are not scripts and jpackage app launcher is not an interpreter. Performed string substitution is less variable expansion and more token replacement; if token value is not available, it is not replaced. |
jpackage app laucnher will expand environment variables in .cfg files.
Previously jpackage app launcher only replaced
$APPDIR
,$BINDIR
, and$ROOTDIR
tokens with the corresponding path values. With this patch, any environment variable can be expanded. The syntax is shell-like$ENV_VAR_NAME
or${ENV_VAR_NAME}
. If$ENV_VAR_NAME
syntax is used, the variable name stops at the first character outside of[a-zA-Z0-9_]
character range. If${ENV_VAR_NAME}
syntax is used, the variable name stops at the first}
character after${
substring. E.g:USER-2
is likely to be an invalid env variable name, but jpackage launcher is not validating names.\$
character combination prevents variable expansion:\\
character combination escapes\
:If
\
character is not followed by another\
character or$
character, it is interpreted as a regular character:Expansion is non-recursive:
Values of
APPDIR
,BINDIR
, andROOTDIR
environment variables are ignored, and these names are substituted by values calculated by jpackage app launcher as previously.$APPDIR
is equivalent to${APPDIR}
.$BINDIR
is equivalent to${BINDIR}
.$ROOTDIR
is equivalent to${ROOTDIR}
.You will find two entities dealing with token replacement in this patch:
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23923/head:pull/23923
$ git checkout pull/23923
Update a local copy of the PR:
$ git checkout pull/23923
$ git pull https://git.openjdk.org/jdk.git pull/23923/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23923
View PR using the GUI difftool:
$ git pr show -t 23923
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23923.diff
Using Webrev
Link to Webrev Comment