Skip to content

Commit

Permalink
Fix wrong split function
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 authored and rjbou committed May 10, 2024
1 parent 04d5d5c commit ee23499
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
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 @@ -23,6 +23,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 "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 ee23499

Please sign in to comment.