Skip to content

Commit

Permalink
OpamEnv.split_var: use correct split functions
Browse files Browse the repository at this point in the history
The cases of this match were the wrong way around.

Note that this regresses ocaml#4861's quoted directory test.
  • Loading branch information
dra27 committed May 14, 2024
1 parent e66341e commit 2eba281
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ users)

## Env
* [BUG] Fix reverting of environment variables, principally on Windows [#5935 @dra27 fix #5838]
* [BUG] Fix splitting environment variables [#5935 @dra27]

## Opamfile

Expand All @@ -65,7 +66,6 @@ users)
## Format upgrade

## Sandbox

## VCS

## Build
Expand Down
4 changes: 2 additions & 2 deletions src/state/opamEnv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ let split_var ~(sepfmt:sep_path_format) var value =
in
let sep = OpamTypesBase.char_of_separator separator in
match format with
| Target_quoted | Host_quoted ->
OpamStd.String.split value sep
| Target | Host ->
OpamStd.String.split value sep
| Target_quoted | Host_quoted ->
(* we suppose that it is in the form:
- "quoted":unquoted
- unquoted:"quoted"
Expand Down
20 changes: 10 additions & 10 deletions tests/reftests/env.test
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ NV_VARS_5926_M_1=b:a1:a2
NV_VARS_5926_M_2=a1:a2:b
NV_VARS_5926_M_3=b:a1:a2
NV_VARS_5926_M_4=a1:a2:b
NV_VARS_5926_S_1=a:
NV_VARS_5926_S_2=:a
NV_VARS_5926_S_1=a
NV_VARS_5926_S_2=a
NV_VARS_5926_S_3=a:
NV_VARS_5926_S_4=:a
NV_VARS_5926_T_1=b:a:
Expand Down Expand Up @@ -247,8 +247,8 @@ NV_VARS_5926_M_1='b:a1:a2': export NV_VARS_5926_M_1:
NV_VARS_5926_M_2='a1:a2:b': export NV_VARS_5926_M_2:
NV_VARS_5926_M_3='b:a1:a2': export NV_VARS_5926_M_3:
NV_VARS_5926_M_4='a1:a2:b': export NV_VARS_5926_M_4:
NV_VARS_5926_S_1='a:': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2=':a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_1='a': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2='a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_3='a:': export NV_VARS_5926_S_3:
NV_VARS_5926_S_4=':a': export NV_VARS_5926_S_4:
NV_VARS_5926_T_1='b:a:': export NV_VARS_5926_T_1:
Expand Down Expand Up @@ -323,8 +323,8 @@ NV_VARS_5926_M_1=b:a1:a2
NV_VARS_5926_M_2=a1:a2:b
NV_VARS_5926_M_3=b:a1:a2
NV_VARS_5926_M_4=a1:a2:b
NV_VARS_5926_S_1=a:
NV_VARS_5926_S_2=:a
NV_VARS_5926_S_1=a
NV_VARS_5926_S_2=a
NV_VARS_5926_S_3=a:
NV_VARS_5926_S_4=:a
NV_VARS_5926_T_1=b:a:
Expand Down Expand Up @@ -358,8 +358,8 @@ NV_VARS_5926_M_1='b:a1:a2': export NV_VARS_5926_M_1:
NV_VARS_5926_M_2='a1:a2:b': export NV_VARS_5926_M_2:
NV_VARS_5926_M_3='b:a1:a2': export NV_VARS_5926_M_3:
NV_VARS_5926_M_4='a1:a2:b': export NV_VARS_5926_M_4:
NV_VARS_5926_S_1='a:': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2=':a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_1='a': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2='a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_3='a:': export NV_VARS_5926_S_3:
NV_VARS_5926_S_4=':a': export NV_VARS_5926_S_4:
NV_VARS_5926_T_1='b:a:': export NV_VARS_5926_T_1:
Expand Down Expand Up @@ -480,8 +480,8 @@ NV_VARS_5926_M_1='b:a1:a2': export NV_VARS_5926_M_1:
NV_VARS_5926_M_2='a1:a2:b': export NV_VARS_5926_M_2:
NV_VARS_5926_M_3='b:a1:a2': export NV_VARS_5926_M_3:
NV_VARS_5926_M_4='a1:a2:b': export NV_VARS_5926_M_4:
NV_VARS_5926_S_1='a:': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2=':a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_1='a': export NV_VARS_5926_S_1:
NV_VARS_5926_S_2='a': export NV_VARS_5926_S_2:
NV_VARS_5926_S_3='a:': export NV_VARS_5926_S_3:
NV_VARS_5926_S_4=':a': export NV_VARS_5926_S_4:
NV_VARS_5926_T_1='b:a:': export NV_VARS_5926_T_1:
Expand Down
1 change: 1 addition & 0 deletions tests/reftests/env.win32.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Done.
set "MANPATH=:"${BASEDIR}/OPAM/rewriting/man""
set PATH=${BASEDIR}/OPAM/rewriting/bin;C:\Devel\bin1;C:\Devel\bin2;"C:\Devel\bin3;";C:\Devel\bin4;ZZZ:\;
### opam exec -- opam env --shell=cmd --revert | grep 'ZZZ:' | 'ZZZ:\\.*' -> 'ZZZ:\' | 'set "P' -> 'set P'
set PATH=C:\Devel\bin1;C:\Devel\bin2;"C:\Devel\bin3;";C:\Devel\bin4;ZZZ:\
### : Test for #5838
### opam env | grep MANPATH
MANPATH=':"${BASEDIR}/OPAM/rewriting/man"'; export MANPATH;
Expand Down

0 comments on commit 2eba281

Please sign in to comment.