Update exported $DIRSTACK value in pushd/popd
@@ -29,6 +29,8 @@ | ||
29 | 29 | in a for loop. |
30 | 30 | * The ">" redirection with the noclobber option no longer hangs |
31 | 31 | when the operand names a symbolic link to a non-existing file. |
32 | + * The exported value of the $DIRSTACK variable was not being | |
33 | + updated correctly in the "pushd" and "popd" built-ins. | |
32 | 34 | |
33 | 35 | ---------------------------------------------------------------------- |
34 | 36 | Yash 2.53 (2022-08-23) |
@@ -3114,6 +3114,8 @@ | ||
3114 | 3114 | remove_dirstack_entry_at(var, stackindex); |
3115 | 3115 | if (remove_dups) |
3116 | 3116 | remove_dirstack_dups(var); |
3117 | + if (var->v_type & VF_EXPORT) | |
3118 | + update_environment(L VAR_DIRSTACK); | |
3117 | 3119 | return Exit_SUCCESS; |
3118 | 3120 | } |
3119 | 3121 |
@@ -3231,6 +3233,8 @@ | ||
3231 | 3233 | |
3232 | 3234 | if (stackindex < var->v_valc) { |
3233 | 3235 | remove_dirstack_entry_at(var, stackindex); |
3236 | + if (var->v_type & VF_EXPORT) | |
3237 | + update_environment(L VAR_DIRSTACK); | |
3234 | 3238 | return Exit_SUCCESS; |
3235 | 3239 | } |
3236 | 3240 |
@@ -3243,6 +3247,8 @@ | ||
3243 | 3247 | var->v_vals[var->v_valc] = NULL; |
3244 | 3248 | result = change_directory(newpwd, true, true); |
3245 | 3249 | free(newpwd); |
3250 | + if (var->v_type & VF_EXPORT) | |
3251 | + update_environment(L VAR_DIRSTACK); | |
3246 | 3252 | return result; |
3247 | 3253 | } |
3248 | 3254 |