Subject: Re: How to debug inetd/sshd services?
From: "Lassi A. Tuura" <[email-masked]>
To: [email-masked]
Date: Thu, 25 Oct 2001 19:12:19 +0200

This is to follow up on my problem where I have cygdrive prefix
set to `/', both system and user setting, but $PATH and other
env vars are initialised to /cygdrive/x.  This happens only when
the process (inetd or sshd) is started as a service under the
system account.  Under the same remote session mount reports
the expected values (`/').  The extra /cygdrive prefixes causes
problems with the $PATH: cygwin thinks those /cygdrive/<x>/...
directories don't exist (which is consistent with mount output).

After some further testing:
  - sshd -d didn't seem to print any useful information
  - sshd started from cygwin/bash command line on my own
    account does not have this problem
  - I managed to get the sshd-as-service to run under strace;
    beginning of the output is attached below.

From the strace output, cygwin seems to happily use the /cygdrive
prefix instead of `/'.  I am not sure how I can debug this further
-- experts, please help.  I am happy to debug this under gdb if
some kind soul can explain to me how do I do that in the service
conditions...

Is there a way to get more output from strace?  Any other debugging
ideas?  I can provide the strace outputs both with and without
/cygdrive prefix set if someone thinks that will be useful.

Registry data:
$ regtool -v list '\machine\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2'
/\ (Cygwin)
/usr/bin\ (Cygwin)
/usr/lib\ (Cygwin)
cygdrive prefix = "/"
cygdrive flags = 0x00000028 (40)
$ regtool -v list '\user\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2'
cygdrive prefix = "/"
cygdrive flags = 0x00000020 (32)

//lat
-- 
A fool-proof method for sculpting an elephant: first, get a huge block
of marble; then you chip away everything that doesn't look like an
elephant.  --George Bernard Shaw

**********************************************
Program name: C:\Users\Lassi\Cygwin\usr\sbin\sshd.exe (1176)
App version:  1003.3, api: 0.39
DLL version:  1003.3, api: 0.46
DLL build:    2001-09-12 23:54
OS version:   Windows NT-5.0
Date/Time:    2001-10-25 18:36:51
**********************************************
18552   54589 [main] sshd 1176 environ_init: 0xA0101B0: ALLUSERSPROFILE=C:\Documents and Settings\All Users
 7253   61842 [main] sshd 1176 environ_init: 0xA0101E8: CLASSPATH=C:\WINNT\System32\QTJava.zip
 4286   66128 [main] sshd 1176 environ_init: 0xA010218: COMMONPROGRAMFILES=C:\Program Files\Common Files
 4161   70289 [main] sshd 1176 environ_init: 0xA010250: COMPUTERNAME=LXCMS57
 6434   76723 [main] sshd 1176 environ_init: 0xA010270: COMSPEC=C:\WINNT\system32\cmd.exe
29939  106662 [main] sshd 1176 parse_options: binmode 65536
 5192  111854 [main] sshd 1176 parse_options: ntsec 1
 5379  117233 [main] sshd 1176 parse_options: tty 1001
 4664  121897 [main] sshd 1176 parse_options: returning
15422  137319 [main] sshd 1176 environ_init: 0xA010298: CYGWIN=binmode ntsec tty
 4850  142169 [main] sshd 1176 environ_init: 0xA0102E8: LOGONSERVER=\\CERNDC02
 5136  147305 [main] sshd 1176 environ_init: 0xA010308: NUMBER_OF_PROCESSORS=1
 4498  151803 [main] sshd 1176 environ_init: 0xA010328: OS2LIBPATH=C:\WINNT\system32\os2\dll;
 5594  157397 [main] sshd 1176 environ_init: 0xA010358: OS=Windows_NT
 4863  162260 [main] sshd 1176 getwinenv: can't set native for PATH= since no environ yet
 5297  167557 [main] sshd 1176 mount_info::conv_to_posix_path: conv_to_posix_path (C:\Users\Lassi\Cygwin\bin, keep-rel, no-add-slash)
 2135  169692 [main] sshd 1176 normalize_win32_path: C:\Users\Lassi\Cygwin\bin = normalize_win32_path (C:\Users\Lassi\Cygwin\bin)
 2789  172481 [main] sshd 1176 mount_info::conv_to_posix_path: /usr/bin = conv_to_posix_path (C:\Users\Lassi\Cygwin\bin)
 2162  174643 [main] sshd 1176 mount_info::conv_to_posix_path: conv_to_posix_path (o:\Oracle\Rdbms8i\bin, keep-rel, no-add-slash)
 3568  178211 [main] sshd 1176 normalize_win32_path: o:\Oracle\Rdbms8i\bin = normalize_win32_path (o:\Oracle\Rdbms8i\bin)
 2107  180318 [main] sshd 1176 mount_info::conv_to_posix_path: /cygdrive/o/Oracle/Rdbms8i/bin = conv_to_posix_path (o:\Oracle\Rdbms8i\bin)
 2630  182948 [main] sshd 1176 mount_info::conv_to_posix_path: conv_to_posix_path (c:\Program Files\Perl\bin\, keep-rel, add-slash)
 2039  184987 [main] sshd 1176 normalize_win32_path: c:\Program Files\Perl\bin\ = normalize_win32_path (c:\Program Files\Perl\bin\)
 2944  187931 [main] sshd 1176 mount_info::conv_to_posix_path: /cygdrive/c/Program Files/Perl/bin/ = conv_to_posix_path (c:\Program Files\Perl\bin\)
 2007  189938 [main] sshd 1176 mount_info::conv_to_posix_path: conv_to_posix_path (c:\WINNT\system32, keep-rel, no-add-slash)
 2549  192487 [main] sshd 1176 normalize_win32_path: c:\WINNT\system32 = normalize_win32_path (c:\WINNT\system32)
 2027  194514 [main] sshd 1176 mount_info::conv_to_posix_path: /cygdrive/c/WINNT/system32 = conv_to_posix_path (c:\WINNT\system32)

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