This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Missing APPDATA var in env of ssh sessions?


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@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]