On Thu, 6 Mar 2025 21:51:37 GMT, Alexander Matveev <almat...@openjdk.org> wrote:

>>> If you do echo on macOS in terminal for unset variable it will be expanded 
>>> to empty string, so for "Unset variables are not expanded." should we have 
>>> Welcome ! instead of Welcome $USER!?
>> 
>> This is true for any shell. It is also true that some shells fail to expand 
>> undefined variables if configured accordingly. Bash, for example:
>> 
>> bash -c 'FOO=10; echo FOO=$FOO; unset FOO; set -u; echo FOO=$FOO'
>> 
>> 
>> output:
>> 
>> FOO=10
>> bash: line 1: FOO: unbound variable
>> 
>> 
>> .cfg file is not a script, and the jpackage app launcher is not a shell. The 
>> substitution performed is less of a variable expansion and more a token 
>> replacement, and a token is not replaced if it doesn't have a value.
>> 
>> Regardless of the handling of undefined variables, users have to deal with 
>> the case of undefined variables in .cfg files. Imagine they pass 
>> `--java-options -DmyAppData=$HOME/.myData` to jpackage and `HOME` happens to 
>> be undefined on the machine where the app runs. Is `/.myData` any better 
>> than `$HOME/.myData`?
>
> Agree. Makes sense.

Oh, I thought I posted my reply in the main thread and then didn't find it 
there, assumed my comment was lost and wrote it again 🤦

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23923#discussion_r1984135948

Reply via email to