diff --git a/master_changes.md b/master_changes.md index 8fe7a426764..86269887bb3 100644 --- a/master_changes.md +++ b/master_changes.md @@ -61,6 +61,7 @@ users) * [BUG] When opam creates an empty variable then appends/prepends a value, ensure no additional separator is added [#5935 @dra27 - fix #5925] * [BUG] Fix `x-env-path-rewrite` splitting of values when reverting [#5935 @dra27 - fix #5838] * [BUG] Rework the logic of := and =: so that an empty entry is correctly preserved on multiple updates [#5935 @dra27 - fix #5926] + * [BUG] Fix incorrect reverting of `=+` and `=:` [#5935 @dra27 - fix #5926] ## Opamfile diff --git a/src/state/opamEnv.ml b/src/state/opamEnv.ml index e0cc8a44ee5..6922c9df87a 100644 --- a/src/state/opamEnv.ml +++ b/src/state/opamEnv.ml @@ -402,7 +402,7 @@ let reverse_env_update ~sepfmt var op arg cur_value = | EqPlus | Cygwin -> (match unzip_to ~sepfmt var arg (List.rev cur_value) with | None -> None - | Some (rl1, l2) -> Some (List.rev l2, List.rev rl1)) + | Some (rl1, l2) -> Some (l2, List.rev rl1)) | ColonEq -> (match unzip_to var ~sepfmt arg cur_value with | Some ([], [{ tr_entry = ""; _}]) -> Some ([], []) @@ -410,7 +410,7 @@ let reverse_env_update ~sepfmt var op arg cur_value = | EqColon -> (match unzip_to ~sepfmt var arg (List.rev cur_value) with | Some ([], [{ tr_entry = ""; _}]) -> Some ([], []) - | Some (rl1, l2) -> Some (List.rev l2, List.rev rl1) + | Some (rl1, l2) -> Some (l2, List.rev rl1) | None -> None) let map_update_names env_keys updates = diff --git a/tests/reftests/env.test b/tests/reftests/env.test index b9ac0d6f6ea..9dd62d28083 100644 --- a/tests/reftests/env.test +++ b/tests/reftests/env.test @@ -273,15 +273,15 @@ NV_VARS_5925_8='': export NV_VARS_5925_8: NV_VARS_5926_L_1='': export NV_VARS_5926_L_1: NV_VARS_5926_L_2=':a': export NV_VARS_5926_L_2: NV_VARS_5926_L_3='': export NV_VARS_5926_L_3: -NV_VARS_5926_L_4='a:': export NV_VARS_5926_L_4: +NV_VARS_5926_L_4=':a': export NV_VARS_5926_L_4: NV_VARS_5926_L_5='': export NV_VARS_5926_L_5: NV_VARS_5926_L_6=':a': export NV_VARS_5926_L_6: NV_VARS_5926_L_7='': export NV_VARS_5926_L_7: -NV_VARS_5926_L_8='a:': export NV_VARS_5926_L_8: +NV_VARS_5926_L_8=':a': export NV_VARS_5926_L_8: NV_VARS_5926_M_1='a1::a2': export NV_VARS_5926_M_1: -NV_VARS_5926_M_2='a2::a1': export NV_VARS_5926_M_2: +NV_VARS_5926_M_2='a1::a2': export NV_VARS_5926_M_2: NV_VARS_5926_M_3='a1::a2': export NV_VARS_5926_M_3: -NV_VARS_5926_M_4='a2::a1': export NV_VARS_5926_M_4: +NV_VARS_5926_M_4='a1::a2': export NV_VARS_5926_M_4: NV_VARS_5926_S_1='': export NV_VARS_5926_S_1: NV_VARS_5926_S_2='': export NV_VARS_5926_S_2: NV_VARS_5926_S_3='': export NV_VARS_5926_S_3: @@ -289,11 +289,11 @@ NV_VARS_5926_S_4='': export NV_VARS_5926_S_4: NV_VARS_5926_T_1='': export NV_VARS_5926_T_1: NV_VARS_5926_T_2='a:': export NV_VARS_5926_T_2: NV_VARS_5926_T_3='': export NV_VARS_5926_T_3: -NV_VARS_5926_T_4=':a': export NV_VARS_5926_T_4: +NV_VARS_5926_T_4='a:': export NV_VARS_5926_T_4: NV_VARS_5926_T_5='': export NV_VARS_5926_T_5: NV_VARS_5926_T_6='a:': export NV_VARS_5926_T_6: NV_VARS_5926_T_7='': export NV_VARS_5926_T_7: -NV_VARS_5926_T_8=':a': export NV_VARS_5926_T_8: +NV_VARS_5926_T_8='a:': export NV_VARS_5926_T_8: ### NV_VARS=/another/path ### NV_VARS2=/another/different/path ### NV_VARS3=/yet/another/different/path @@ -384,15 +384,15 @@ NV_VARS_5925_8='': export NV_VARS_5925_8: NV_VARS_5926_L_1='': export NV_VARS_5926_L_1: NV_VARS_5926_L_2=':a': export NV_VARS_5926_L_2: NV_VARS_5926_L_3='': export NV_VARS_5926_L_3: -NV_VARS_5926_L_4='a:': export NV_VARS_5926_L_4: +NV_VARS_5926_L_4=':a': export NV_VARS_5926_L_4: NV_VARS_5926_L_5='': export NV_VARS_5926_L_5: NV_VARS_5926_L_6=':a': export NV_VARS_5926_L_6: NV_VARS_5926_L_7='': export NV_VARS_5926_L_7: -NV_VARS_5926_L_8='a:': export NV_VARS_5926_L_8: +NV_VARS_5926_L_8=':a': export NV_VARS_5926_L_8: NV_VARS_5926_M_1='a1::a2': export NV_VARS_5926_M_1: -NV_VARS_5926_M_2='a2::a1': export NV_VARS_5926_M_2: +NV_VARS_5926_M_2='a1::a2': export NV_VARS_5926_M_2: NV_VARS_5926_M_3='a1::a2': export NV_VARS_5926_M_3: -NV_VARS_5926_M_4='a2::a1': export NV_VARS_5926_M_4: +NV_VARS_5926_M_4='a1::a2': export NV_VARS_5926_M_4: NV_VARS_5926_S_1='': export NV_VARS_5926_S_1: NV_VARS_5926_S_2='': export NV_VARS_5926_S_2: NV_VARS_5926_S_3='': export NV_VARS_5926_S_3: @@ -400,11 +400,11 @@ NV_VARS_5926_S_4='': export NV_VARS_5926_S_4: NV_VARS_5926_T_1='': export NV_VARS_5926_T_1: NV_VARS_5926_T_2='a:': export NV_VARS_5926_T_2: NV_VARS_5926_T_3='': export NV_VARS_5926_T_3: -NV_VARS_5926_T_4=':a': export NV_VARS_5926_T_4: +NV_VARS_5926_T_4='a:': export NV_VARS_5926_T_4: NV_VARS_5926_T_5='': export NV_VARS_5926_T_5: NV_VARS_5926_T_6='a:': export NV_VARS_5926_T_6: NV_VARS_5926_T_7='': export NV_VARS_5926_T_7: -NV_VARS_5926_T_8=':a': export NV_VARS_5926_T_8: +NV_VARS_5926_T_8='a:': export NV_VARS_5926_T_8: ### : Full revert of uninstalled package with setenv : ### opam-version: "2.0"