Skip to content

Commit

Permalink
ash: -X option shouldn't alter environment variables
Browse files Browse the repository at this point in the history
When a shell was started with the -X option, environment variables
had forward slashes changed to backslashes.  This is unnecessary
and counterproductive.

Adjust how the state of winxp is handled to avoid this.

(GitHub issue #415)
  • Loading branch information
rmyorston committed May 10, 2024
1 parent fdff0f9 commit bb12807
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shell/ash.c
Original file line number Diff line number Diff line change
Expand Up @@ -2944,11 +2944,11 @@ listvars(int on, int off, struct strlist *lp, char ***end)
static void
setwinxp(int on)
{
static smallint is_winxp;
static smallint is_winxp = 1;
struct var **vpp;
struct var *vp;

if (++on == is_winxp)
if (on == is_winxp)
return;
is_winxp = on;

Expand All @@ -2959,7 +2959,7 @@ setwinxp(int on)
if (!end || is_prefixed_with(vp->var_text, "COMSPEC=") ||
is_prefixed_with(vp->var_text, "SYSTEMROOT="))
continue;
if (!winxp)
if (!on)
bs_to_slash(end + 1);
else
slash_to_bs(end + 1);
Expand Down

0 comments on commit bb12807

Please # to comment.