BUG: command invocation misinterpreted as variable setting, SOMETIMES.

Duncan Roe duncan_roe@optusnet.com.au
Fri Nov 20 22:39:06 GMT 2020


Hi Jason,

On Fri, Nov 20, 2020 at 02:52:09PM +0000, cygwin wrote:
>
> Good day -
>
>  I am using a fairly up-to-date Cygwin:
>    release: cygwin
>    arch: x86_64
>    setup-timestamp: 1603379981
>    include-setup: setup <2.878 not supported
>    setup-minimum-version: 2.895
>    setup-version: 2.905
>  , bash version : 4.4.12(3)-release
>  on Windows 10 :
>    Edition	Windows 10 Pro
>    Version	20H2
>    OS build	19042.630
>    Experience	Windows Feature Experience Pack 120.2212.31.0
>  , which I am forced to use for a work related Visual Studio project,
>  , running in a Qemu/KVM VM under Fedora-32 on a modern X86_64 Dell XPS
>  laptop, and am experiencing some strange and disconcerting behaviour:
>
>  I am a complete novice Windows user, I have used only BSD / Solaris
>  / AIX / HP-UX / MacOSX / z/OS or Linux since 1990, so I am an advanced UNIX
>  shell script user & C/C++ + LISP + PERL programmer (I prefer LISP nowadays).
>
>  I have to run a script with an alternate setting of $HOME, so I do:
>
>    $ HOME="C:\\USERS\\JVD\\" sbcl --script "C:\\${path-to-my-script}.lisp"
>
>  This works, but now:
>
>    $ cd ~
>    -bash: cd: "C:\\USERS\\JVD\\" sbcl --script "C:\\${path-to-my-script}.lisp": No such file or directory
>    $ echo $HOME
>    /home/JVD
>
>  This is very weird! "$HOME" is still set to its /etc/bash.bashrc set
>  default, but evaluation of 'echo ~', which I thought should be
>  equivalent to 'echo $HOME', yields the last command to be prefixed
>  by a command-specific HOME=... setting .
>
>  I think this is a bug. Since setting HOME=... has no effect now,
>  (it still has its correct value),
>  use of '~' is now effectively disabled for this shell session .
>
>  What is 'echo ~' doing other than 'echo $HOME' ?

If you had tried 'set -x' you would have seen what it does: tilde expansion is
done by bash before the echo command is invoked. So you would see something like
'echo /home/jvd'.

Could it be that 'sbcl' has popped a new bash command level?

I can't reproduce your issue with a simple command instead of 'sbcl' e.g.

> 09:33:42$ HOME="C:\\USERS\\DUNCAN\\" pwd
> /home/dunc
> 09:34:02$ echo ~
> /home/dunc
>
[...]
>
Cheers ... Duncan.


More information about the Cygwin mailing list