X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Message-ID: <4C6225D9.2060604@cwilson.fastmail.fm> Date: Wed, 11 Aug 2010 00:23:53 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: Cygwin Mailing List Subject: Missing APPDATA var in env of ssh sessions? Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 The mingw.org folks are developing a new installer, which uses WININET.dll facilities for d/l support. When I ran the application from within a cygwin shell, I ended up with the following debris in my testing /bin dir: $ pwd /c/msys-src/__xml/_test/bin $ ls libgcc_s_dw2-1.dll mingw-get.exe* $ ./mingw-get.exe update $ ls %APPDATA%/ libgcc_s_dw2-1.dll mingw-get.exe* $ find %APPDATA% %APPDATA% %APPDATA%/Microsoft %APPDATA%/Microsoft/Windows %APPDATA%/Microsoft/Windows/IETldCache %APPDATA%/Microsoft/Windows/IETldCache/index.dat Some googling indicates that this stuff is part of the network support provided by IE8 (or, the bits of Windows' networking that is provided by the DLLs associated with IE8). index.dat is a database for determining which domains are TLDs, and is user-customizable. If missing, it appears the IE8/WININET.dll/SHLWAPI.dll create it automatically. But the key is, it appears that the culprit, SHLWAPI.dll, checks the environment for %APPDATA% rather than using the MS-approved mechanism: SHGetSpecialFolderPath( 0, // Hwnd strPath, // String buffer. CSIDL_APPDATA, // CSLID of folder FALSE ); // Create if doesn't exists? $ strings /c/Windows/System32/SHLWAPI.dll | grep -i APPDATA %APPDATA% Now, a cmd box has this variable set: C:\Users\me>echo %APPDATA% C:\Users\me\AppData\Roaming If I start a bash shell within that cmd box: C:\Users\me>c:\cygwin-1.7\bin\bash --login the variable is still set: me AT computer[1.7] ~ $ echo $APPDATA C:\Users\me\AppData\Roaming The trick is, when I ssh in to the machine (even loopback), I don't have that env var: $ ssh localhost $ echo $APPDATA $ Now, this is a minor issue (does "mingw-get" work when invoked from a cygwin shell as part of a remote session?) However, I expect that the same flaw -- windows networking DLLs checking for %APPDATA% rather than using the Win32 API function -- would affect any native networking program that is launched from a cygwin remote session. Can ssh (or is it cygwin1.dll?) ensure that the user's APPDATA variable is populated, since it appears to be a pretty important var for Windows Vista+? -- Chuck -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple