Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20030127042932.70624.qmail@web21404.mail.yahoo.com> Date: Sun, 26 Jan 2003 20:29:32 -0800 (PST) From: Rick Rankin Subject: Re: Fw: cygwin 1.3.19 Windows 2000 Professional SP3 bash $home /usr/bin/%USERPROFILE% To: cygwin AT cygwin DOT com In-Reply-To: <4.3.1.2.20030126192524.01752888@pop.rcn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- "Larry Hall (RFK Partners, Inc)" wrote: > At 07:23 PM 1/26/2003, Christopher Faylor wrote: > >On Sun, Jan 26, 2003 at 06:30:23PM -0500, Larry Hall (RFK Partners, Inc) > wrote: > > >At 05:55 PM 1/26/2003, David Christensen wrote: > > >>However, I still say there is a Bash/Cygwin bug -- if Bash/Cygwin reads > > >>the Windows HOME environment variable and gets "%USERPROFILE%", it > > >>should evaluate that to get "C:\Documents and Settings\dpchrist" and > > >>set my home directory to "/cygdrive/c/Documents and Settings/dpchrist". > > >>Starting in, and setting HOME to, "/usr/bin/%USERPROFILE%" is bad. > > > > > >Sorry, I can't reproduce this bug with Cygwin 1.3.17 or 1.3.19 (and > > >latest bash). If I set HOME="%USERPROFILE%" at my command (cmd) > > >prompt, start bash with "bash --login -i", and "echo $HOME", I get > > >exactly what I expect. I see the name of the directory specified by > > >"%USERPROFILE%". If I "cd ~", I get there too. Can you provide any > > >insight as to how you get HOME set to "/usr/bin/%USERPROFILE%" in bash? > > >This seems to be the root of the problem you saw but I can't reproduce > > >it. > > > >I think the assumption is that bash should be doing expansion of any > >%DELIMITED% variables it sees in the environment. It is possible to set > >an environment variable to %SOMETHING% via the control panel, I think. > >And, the %SOMETHING% will not be expanded as it would when you set HOME > >above. bash just reads the environment variables directly via a Win32 > >API. It doesn't and shouldn't be doing any % expansion. > > > Agreed. AFAICS, this is all taken care of very nicely when set in the > control panel or at the command prompt. Expansion happens automatically > and Cygwin POSIXizes the expanded value without problem. It's a mystery > to me how one could get %USERPROFILE% in the HOME environment variable and > get it into Cygwin as %USERPROFILE%. Information on this could be of some > value to the list. But even if there were some valid way for some other It would depend, at least partly, on how the HOME environment variable is created in the registry. If it's created as a REG_EXPAND_SZ, then expansion of % delimited variables occurs automatically. If it's created as REG_SZ, no expansion will happen. I believe, but am not certain, that when an environment variable is created via control panel, the value of the environment variable is scanned for % delimited variables and if one appears, the variable is created in the registry as REG_EXPAND_SZ; otherwise, it's created as REG_SZ. If the env var is created by direct manipulation of the registry, then all bets are off. I've seen cases, for example, where an installer wants to add a directory to PATH. I use lots of %XYZ_HOME%\bin type entries in my system PATH var, but sometimes an installer will screw it up and change it from type REG_EXPAND_SZ to REG_SZ. Then when I start bash, I end up will all those unexpanded %XYZ_HOME%\bin entries in my path, and I have to go edit the registry to fix it. FWIW, --Rick -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/