Skip to content

Commit

Permalink
[#309] ydb_env_set should not clear gtm_prompt env var in case ydb_pr…
Browse files Browse the repository at this point in the history
…ompt env var is undefined

ydb_env_set called ydbenv.mpt which checked if ydb_prompt is defined and if so generated a
line that set gtm_prompt env var to the value of $ydb_prompt. This had an issue starting
YottaDB r1.22 when ydb_prompt env var is undefined but gtm_prompt env var is defined.

Some context first. As part of #209 in r1.22, support was added for ydb_* environment variables
to automatically inherit the value of gtm_* environment variables at process startup if the
ydb_* variable is not defined but the gtm_* variable is. Because of this change, a scenario
where a mumps process is started with gtm_prompt defined and ydb_prompt not defined implies
ydb_prompt env var is set at process startup to the same value so inside M code one can never
find themselves in a situation where ydb_prompt is undefined and gtm_prompt is defined.
Because of this, in ydbenv.mpt, in r1.22 and later versions, one would always go inside the
below else condition in ydbenv.mpt.
	else  write "export gtm_prompt=$ydb_prompt",!

But since this is a generated file that is sourced by the parent script (ydb_env_set) after
the mumps process terminates, ydb_prompt env var is undefined at that point and so the env
var gtm_prompt gets set to "" inside ydb_env_set and after it returns to the caller.

This is now fixed by removing the entire block of code which tried to generate shell commands
to set gtm_prompt and/or ydb_prompt to the appropriate values. None of this is needed since
YottaDB automatically handles the case where only one of gtm_prompt/ydb_prompt is defined.
  • Loading branch information
nars1 committed Sep 20, 2018
1 parent 5ae6d39 commit 06a4be1
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions sr_unix/ydbenv.mpt
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ set ; Set up environment (environment variables, database, etc.) with default st
. if $zlength(tmp2) write "export ydb_retention=$gtm_retention",!
. else write "export ydb_retention=42",!,"export gtm_retention=$ydb_retention",!
else write "export gtm_retention=$ydb_retention",!
set tmp1=$ztrnlnm("ydb_prompt"),tmp2=$ztrnlnm("gtm_prompt")
if '$zlength(tmp1) do:$zlength(tmp2)
. set tmp3=$zpiece(tmp2,"GTM",1) for i=2:1:$zlength(tmp2,"GTM") set tmp3=tmp3_"YDB"_$zpiece(tmp2,"GTM",i)
. write "export ydb_prompt=",tmp3,!,"export gtm_prompt=$ydb_prompt",!
else write "export gtm_prompt=$ydb_prompt",!
set tmp1=$ztrnlnm("LD_LIBRARY_PATH")
write:'($zlength(tmp1,dist)-1) "export LD_LIBRARY_PATH=""",dist,$select($zlength(dist):":"_tmp1,1:""),"""",!
write "alias dse=$ydb_dist/dse",!
Expand Down

0 comments on commit 06a4be1

Please sign in to comment.