From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by sourceware.org (Postfix) with ESMTP id D66F63972479 for ; Fri, 20 Nov 2020 22:39:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D66F63972479 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=optusnet.com.au Authentication-Results: sourceware.org; spf=none smtp.mailfrom=dunc@dimstar.local.net Received: from dimstar.local.net (n49-192-79-130.sun3.vic.optusnet.com.au [49.192.79.130]) by mail105.syd.optusnet.com.au (Postfix) with SMTP id 790C63C4C8D for ; Sat, 21 Nov 2020 09:39:06 +1100 (AEDT) Received: (qmail 28277 invoked by uid 501); 20 Nov 2020 22:39:06 -0000 Date: Sat, 21 Nov 2020 09:39:06 +1100 From: Duncan Roe To: Jason Vas Dias Cc: cygwin Subject: Re: BUG: command invocation misinterpreted as variable setting, SOMETIMES. Message-ID: <20201120223906.GB7078@dimstar.local.net> Mail-Followup-To: Jason Vas Dias , cygwin References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=F8MpiZpN c=1 sm=1 tr=0 cx=a_idp_d a=cy70b3iXcB9xLWzPsiLWxQ==:117 a=cy70b3iXcB9xLWzPsiLWxQ==:17 a=kj9zAlcOel0A:10 a=nNwsprhYR40A:10 a=RSmzAf-M6YYA:10 a=OHQyB3PeE4QDW6zJDJsA:9 a=CjuIK1q_8ugA:10 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2020 22:39:10 -0000 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.