public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Cc: cygwin <cygwin@cygwin.com>
Subject: Re: BUG: command invocation misinterpreted as variable setting, SOMETIMES.
Date: Sat, 21 Nov 2020 09:39:06 +1100	[thread overview]
Message-ID: <20201120223906.GB7078@dimstar.local.net> (raw)
In-Reply-To: <hh4klkully.fsf@jvdspc.jvds.net>

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.

  reply	other threads:[~2020-11-20 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 14:52 Jason Vas Dias
2020-11-20 22:39 ` Duncan Roe [this message]
2020-11-21  9:53 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120223906.GB7078@dimstar.local.net \
    --to=duncan_roe@optusnet.com.au \
    --cc=cygwin@cygwin.com \
    --cc=jason.vas.dias@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).