Re: startx hanging - startup problem located

2005-04-29 Thread Alexander Gottwald
On Thu, 28 Apr 2005, martouf . wrote:

 in reference to my earlier message
   http://cygwin.com/ml/cygwin-xfree/2005-03/msg00048.html
 and the following message
   http://cygwin.com/ml/cygwin-xfree/2005-04/msg00152.html
 
 I can state I am -not- having a personal firewall problem.  With the
 help of 'Process Explorer' from sysinternals.com, I have been able to
 determine it is caused by 'cat.exe' using 90% CPU.

XWin tries to start xkbcomp. This process start fails because ZoneAlarm 
has broken the network stack and the cygwin fork emulation does not work
properly. Disabling XKB is a workaround but not the solution. Every user
which had this problem could confirm that uninstalling ZoneAlarm 5 (just
disabling does not help) did solve the problem. So this is obviously a 
firewall problem.

bye
ago
-- 
 [EMAIL PROTECTED] 
 http://www.gotti.org   ICQ: 126018723


Re: startx hanging - startup problem located

2005-04-29 Thread martouf .
I don't have ZoneAlarm.

I get past the xkbcomp problem by disabling keyboard extensions, at
which point 'cat' spins at 90% CPU on .Xauthority instead of 'sh'
spinning on xkbcomp.

I did not have this problem with an older cygwin.dll (see my earlier message).
  http://cygwin.com/ml/cygwin-xfree/2005-03/msg00048.html

Is the fork emulation not wait()ing properly?  'cat' seems to be
defunct at the time it is spinning, and yet it consumes CPU.  trying
to deliver SIGCHLD?  return value from exit()?

On 4/29/05, Alexander Gottwald [EMAIL PROTECTED] wrote:
 XWin tries to start xkbcomp. This process start fails because ZoneAlarm
 has broken the network stack and the cygwin fork emulation does not work
 properly. Disabling XKB is a workaround but not the solution. Every user
 which had this problem could confirm that uninstalling ZoneAlarm 5 (just
 disabling does not help) did solve the problem. So this is obviously a
 firewall problem.



Re: startx hanging - startup problem located

2005-04-29 Thread Alexander Gottwald
On Fri, 29 Apr 2005, martouf . wrote:

 I don't have ZoneAlarm.
 
 I get past the xkbcomp problem by disabling keyboard extensions, at
 which point 'cat' spins at 90% CPU on .Xauthority instead of 'sh'
 spinning on xkbcomp.

maybe /tmp mounted in textmode? 

strace will show unlimited cycles of textmode/binmode tests then.

 I did not have this problem with an older cygwin.dll (see my earlier message).
   http://cygwin.com/ml/cygwin-xfree/2005-03/msg00048.html
 
 Is the fork emulation not wait()ing properly?  'cat' seems to be
 defunct at the time it is spinning, and yet it consumes CPU.  trying
 to deliver SIGCHLD?  return value from exit()?

No. It does.

Check 
http://cvs.freedesktop.org/xorg/xc/programs/Xserver/os/utils.c?rev=1.15view=auto
for the actual code (check Fopen and Fclose)

 bye
ago
-- 
 [EMAIL PROTECTED] 
 http://www.gotti.org   ICQ: 126018723


Re: startx hanging - startup problem located

2005-04-29 Thread martouf .
uhh, don't you mean System(), Popen() and Pclose() ?  They're
contained within and entire #if !defined(WIN32) stanza and I'm not
sure what that means with respect to Cygwin.

Did something change in fork(), exec() or exit() between 1.5.12 and 1.5.13 ?

On 4/29/05, Alexander Gottwald [EMAIL PROTECTED] wrote:
 No. It does.
 
 Check 
 http://cvs.freedesktop.org/xorg/xc/programs/Xserver/os/utils.c?rev=1.15view=auto
 for the actual code (check Fopen and Fclose)



Re: startx hanging - startup problem located

2005-04-29 Thread martouf .
I don't have /tmp mounted as anything.  / is mounted in binmode.

$ mount
C:\cygwin\bin on /usr/bin type system (binmode)
C:\cygwin\lib on /usr/lib type system (binmode)
C:\cygwin on / type system (binmode)
c: on /cygdrive/c type system (binmode,noumount)

On 4/29/05, Alexander Gottwald [EMAIL PROTECTED] wrote:

 maybe /tmp mounted in textmode?
 
 strace will show unlimited cycles of textmode/binmode tests then.



Re: startx hanging - startup problem located

2005-04-29 Thread Alexander Gottwald
On Fri, 29 Apr 2005, martouf . wrote:

 uhh, don't you mean System(), Popen() and Pclose() ?  

No. I mean Fopen. This is the only place where /bin/cat is mentioned.

 They're
 contained within and entire #if !defined(WIN32) stanza and I'm not
 sure what that means with respect to Cygwin.

WIN32 is only for mingw and native compiler like msvc.

I've compiled XWin with HAS_SAVED_IDS_AND_SETEUID in os/utils.c
http://www.freedesktop.org/~ago/XWin.exe.bz2

Feel free to try.

bye
ago
-- 
 [EMAIL PROTECTED] 
 http://www.gotti.org   ICQ: 126018723


ssh -Y is not an option

2005-04-29 Thread ab2540
Hi
I'm trying to run some apps on our unix server remotely from a
windows XP box running cygwin/X.  I have read and re-read all the
posts and troubleshooting guides.  First ssh -Y is not accepted as
an option in the openssh I have installed second even following all
the instructions I get the following

$ DISPLAY=windows-jferrera:0.0 ssh -X nimbus
[EMAIL PROTECTED]'s password:
Warning: No xauth data; using fake authentication data for X11
forwarding.
Last login: Fri Apr 29 15:44:14 2005 from windows-jferrer

As I said ssh -Y just gives
$ DISPLAY=windows-jferrera:0.0 ssh -X nimbus
[EMAIL PROTECTED]'s password:
Warning: No xauth data; using fake authentication data for X11
forwarding.

Any clues ?

Regards
Anna



ssh -Y is not an option

2005-04-29 Thread ab2540
Sorry the second paragraph should have read 

As I said ssh -Y just gives
$ DISPLAY=windows-jferrera:0.0 ssh -Y nimbus
ssh: unknown option -- Y
Usage: ssh [options] host [command]

regards
Anna


Re: startx hanging - startup problem located

2005-04-29 Thread martouf .
On Fri, 29 Apr 2005, Alexander Gottwald wrote:
 uhh, don't you mean System(), Popen() and Pclose() ?  

 No. I mean Fopen. This is the only place where /bin/cat is mentioned.

oh yes, ok, I see now.  thanks.

 They're contained within an entire #if !defined(WIN32) stanza and I'm not
 sure what that means with respect to Cygwin.

 WIN32 is only for mingw and native compiler like msvc.

ok.  first time looking through XWin source, so I am completely
unfamiliar with its cpp vars.

 I've compiled XWin with HAS_SAVED_IDS_AND_SETEUID in os/utils.c
 http://www.freedesktop.org/~ago/XWin.exe.bz2

 Feel free to try.

thanks!  I did try, and it behaved like this:

1.  with -kb (kb ext disabled) it starts up just fine.

2. without -kb it 'hangs' with sh consuming 90% CPU right after the
'Rules' line. Ending the sh process causes XWin to wake back up and
finish starting up then runs just fine.

An interesting code pattern I see (and am not sure if it's
significant) in os/utils.c:

[paraphrasing]
Popen() {
 .
 .
switch (pid = fork()) {
 .
 .  execl(/bin/sh, sh, -c, command, (char *)NULL);
_exit(127);
 }

/* Avoid EINTR during stdio calls */
OsBlockSignals ();
 .
 .
}

Pclose(){
 .
 .
do {
pid = waitpid(cur-pid, pstat, 0);
} while (pid == -1  errno == EINTR);
 .
 .
/* allow EINTR again */
OsReleaseSignals ();
 .
 .
}
// with SIGCHLD set to SIG_IGN/SIG_BLOCK, then waitpid() should never
be interrupted
// by a signal and will never exit with EINTR.  It may exit with ECHILD, though.
// Does Cygwin behave the same way?

[more paraphrasing -- this next bit is more interesting to me]
Fopen(){
 .
 .
#ifndef HAS_SAVED_IDS_AND_SETEUID
switch (pid = fork()) {
 .
 .
execl(/bin/cat, cat, file, (char *)NULL);
_exit(127);
}

/* Avoid EINTR during stdio calls */
OsBlockSignals ();
 .
 .
#else
 .
 .
}

Fclose(){
#ifdef HAS_SAVED_IDS_AND_SETEUID
return fclose(iop);
#else
return Pclose(iop);
#endif
}

// any chance at all what I'm seeing has something to do with the
EINTR || ECHILD possibility above?


read bug in Cygwin xterm window only

2005-04-29 Thread Peter Farley
Hi all,

The following program demonstrates what looks to me
like a bug in the read function in an xterm (as
opposed to a Cygwin console window).  To run the test,
compile with:

gcc -g -o xtermbug.exe xtermbug.c

When you run it in a console window, you can enter
normal keyboard characters, then a return to see
cmdline=what you typed.  Press the Esc key to exit
the program.

When run in an xterm window, the first keypress causes
this behavior:

1. Select returns with rc = 0 and readset set to
indicate that a key was received
2. read returns with kblen = 1 and kbbuf[0] = '\0'
3. (1) and (2) repeat forever.

I put in a maxdbg parameter and terminate the
program after 5 occurrences of this loop.

This problem was first detected trying to run a copy
of the hercules IBM mainframe emulator in a Cygwin
xterm window.  The code below is extracted and
minimalized as much as possible from the hercules
keyboard input routine.

Peter Farley

xtermbug.c:

/*---*/
/* This is a test program to show a cygwin xterm bug,
possibly   */
/* in the read function.  
  */
/*---*/

/*---*/
/* Definitions for keyboard input sequences   
  */
/*---*/
#define KBD_DELETE  \x1B[3~

#include stdio.h
#include unistd.h
#include sys/time.h
#include string.h
#include errno.h
#include termios.h

#define MSG_SIZE80  /* Size of one
message   */
#define CMD_SIZE 32767  /* Length of
command line*/

#define BYTE unsigned char

int ttyreset = 0;
struct  termios kbattr; /* Terminal I/O
structure*/

/*---*/
/* xterm display subroutine   
  */
/*---*/

void xterm_display (void)
{
int rc; /* Return code
  */
int i;  /* Array
subscripts  */
charcmdline[CMD_SIZE+1];/* Command
line buffer   */
int cmdoff = 0; /* Cursor
position in cmdline*/
int cmdlen = 0; /* Number of
bytes in cmdline*/
//BYTEc;  /* Character
work area   */
FILE   *confp;  /* Console
file pointer  */
size_t  kbbufsize = CMD_SIZE;   /* Size of
keyboard buffer   */
char   *kbbuf = NULL;   /* Keyboard
input buffer */
int kblen;  /* Number of
chars in kbbuf  */
int keybfd; /* Keyboard
file descriptor  */
int maxfd;  /* Highest
file descriptor   */
fd_set  readset;/* Select file
descriptors   */
struct  timeval tv; /* Select
timeout structure  */
int maxdbg = 0;

/* Set up the input file descriptors */
confp = stdout;
keybfd = STDIN_FILENO;

fprintf(confp, start kbbuf=%8.8X,kbbuf=%8.8X\n,

kbbuf, kbbuf);

/* Obtain storage for the keyboard buffer */
if (!(kbbuf = (char *)malloc (kbbufsize)))
{
fprintf(stderr, HHCPN002S Cannot obtain
keyboard buffer: %s\n,
strerror(errno));
return;
}

fprintf(confp, start
kbbuf=%8.8X,kbbuf=%8.8X,*kbbuf=%8.8X\n, 
kbbuf, kbbuf, *kbbuf);

/* Set screen output stream to fully buffered */
setvbuf (confp, NULL, _IOFBF, 0);

/* Put the terminal into cbreak mode */
tcgetattr (keybfd, kbattr);
kbattr.c_lflag = ~(ECHO | ICANON);
kbattr.c_cc[VMIN] = 0;
kbattr.c_cc[VTIME] = 0;
tcsetattr (keybfd, TCSANOW, kbattr);
ttyreset = 1;

fprintf(confp, Starting while(1) loop.\n);
fflush(confp);

/* Process messages and commands */
while (1)
{
/* Set the file descriptors for select */
FD_ZERO (readset);
FD_SET (keybfd, readset);
maxfd = keybfd;

/* Wait for a key to be pressed,
   or the inactivity interval to expire */
tv.tv_sec = 1;
tv.tv_usec = 1 % 100;
rc = select (maxfd + 1, readset, NULL, NULL,
tv);
if (rc  0 )
{
if (errno == EINTR) continue;
fprintf (stderr,
HHCPN004E select: %s\n,
strerror(errno));
break;
}

fprintf(confp, rc=%d,readset={%8.8X,%8.8X}\n, rc,
readset.fds_bits[0], readset.fds_bits[1]);
fflush(confp);

/* If keyboard input has arrived then process
it */

if (FD_ISSET(keybfd, readset))
{
/* Read character(s) from the keyboard */
kblen = read (keybfd,