-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Forward slash in env paths can break some tools #322
Comments
ping? |
Although 'winxp' is a shell option it could only be set with '-X' on the command line. Fully implement 'winxp' so it can also be set within the shell by 'set -o winxp' and 'set +o winxp'. '-X' no longer needs to be the first option on the command line. Track which shell variables have been imported from a native Windows environment so only those are affected when 'winxp' is changed. The tracking persists in a subshell but is lost when shell variables are exported to the environment so 'set -/+o winxp' is ineffective in a child shell. Costs 48-52 bytes. (GitHub issue #322)
It makes is easier to port Unix scripts and applications to Windows. If the forward slashes are a problem it's possible to use |
It might somewhat, though it's a double-edge sword. On one hand, I'm guessiung there aren't many portable scripts which use ENV vars other than maybe However, it's true that if an existing portable procedure is used on paths with backslashes then things would break. That being said, if one wants a script to work in busybox-w32, then it's almost inevitable that a path argument would contain backslashes, e.g. when executed from cmd.exe prompt, or a batch file, or windows "Send-To", etc, because scripts which operate exclusively on ENV vars inputs are not very common... And then there's the issue that some windows program expect the ENV to have backslashes... Dunno, I think for me I prefer to keep it with backslashes and ensure it's handled correctly equally for ENV vars and elsewhere. But I get that it can be a subjective thing.
Yup. I've mentioned it above too, and I've been using it since.
Nice. Thanks. |
It very much depends on circumstances. For what I was doing in 2012 having forward slashes was ideal.
And (unlike some others we could mention) the |
Some tools, notably
cmd.exe
commands, have issues with forward slashes in values.e.g. consider the resulting batch file here:
cmd.exe
itself even refuses to run if it's invoked with forward slashes in its own path, e.g. the value of$COMSPEC
if it had forward slashes likeAPPDATA
has.busybox-w32 does convert backslashes in
PATH
and few more (APPDATA
, possibly others) to forward slashes.Other than for (questionable?) aesthetic reasons, is there a value in converting backslashes to forward slashes in ENV?
If yes, shouldn't it be converted back to backslashes when executing an application? as demonstrated, some might have issues with forward slashes.
EDIT
I'm noticing it's not a general busybox-w32 thing, but rather an
ash
thing (and possibly more, but not all). E.g. incmd.exe
prompt, this prints path with backslashes (and also unlikeash
, upper casePATH
doesn't work)busybox.exe awk "BEGIN{ print ENVIRON[\"Path\"] }"
EDIT2
This conversion was added more than 10 years ago - d5891f9 and it doesn't say why. Later commits added "xp mode" (-X) and unconditional exceptions for COMSPEC and SYSTEMROOT, but I don't think I've seen an explanation of what it's good for in any of them...
The text was updated successfully, but these errors were encountered: