Re: Xterm hangs with latest Cygwin (-62?)

2009-10-06 Thread Corinna Vinschen
On Oct  5 17:46, Yaakov S wrote:
 On 05/10/2009 13:47, Corinna Vinschen wrote:
 --- sys.c.ORIG   2009-10-05 19:23:58.0 +0200
 +++ sys.c2009-10-05 19:18:34.0 +0200
 @@ -408,7 +408,11 @@ openTty(char *line)
   int rc;
   int tty = -1;

 +#ifdef __CYGWIN__
 +tty = open(line, O_RDWR);
 +#else
   tty = open(line, O_RDWR | O_NOCTTY);
 +#endif

 For portability, perhaps this should also be #ifdef TIOCSCTTY, if these two 
 sections go hand-in-hand?

Sure, sounds much better than #ifdef __CYGWIN__.


Thanks,
Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Corinna Vinschen
On Oct  4 17:06, Jim Reisert AD1C wrote:
 On 10/4/2009 1:52 PM, Corinna Vinschen wrote:

 Stracing shows that luit is called with `luit -argv0 -tcsh', but nowhere
 in the strace tcsh is actually started.  Rather, it looks like luit
 starts /bin/sh with argv[0] set to -tcsh instead.

 Interesting.  When I was experimenting with -62, I noticed several tcsh.exe 
 processes in the Windows task manager.  Maybe they're sort of starting, but 
 don't get connected to the xterm somehow?

Neither the strace, nor Task Manager show any tcsh process in my case.

There's a difference, though, when starting xterm via the `run -p xterm
-ls' shortcut.  With Cygwin -61, xterm just starts tcsh and it works,
with Cygwin -62, xterm tries to start the shell via luit, and that
fails.  If luit is missing on the system (renamed), xterm starts with
a message Can't execvp /usr/bin/luit: No such file or directory, and
then starts tcsh just fine afterwards.

Since there's no difference otherwise, it's not clear to me why this
occurs.  In both cases the locale is set to the default C locale.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Andy Koppe
2009/10/5 Corinna Vinschen:
 There's a difference, though, when starting xterm via the `run -p xterm
 -ls' shortcut.  With Cygwin -61, xterm just starts tcsh and it works,
 with Cygwin -62, xterm tries to start the shell via luit, and that
 fails.  If luit is missing on the system (renamed), xterm starts with
 a message Can't execvp /usr/bin/luit: No such file or directory, and
 then starts tcsh just fine afterwards.

 Since there's no difference otherwise, it's not clear to me why this
 occurs.  In both cases the locale is set to the default C locale.

Perhaps its behaviour depends on MB_CUR_MAX?

Andy

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: [Fwd: Re: Xterm hangs with latest Cygwin (-62?)]

2009-10-05 Thread Jon TURNEY

On 05/10/2009 11:30, Fergus wrote:

The only difference is the Cygwin version. -61 works, -62 hangs.



Likewise.


But this is not the same problem.  Being unable to start the Xserver
is not the same as being unable to start an Xterm.

 With everything up to date (cygwin, luit, xorg-server, ... --

see attached cygwin.srv) the command
~ run XWin -nolisten local -multiwindow 
fails with an instruction to view /var/log/XWin.0.log (attached) which
closes with
Fatal server error:
Can't read lock file /tmp/.X0-lock
If I simply revert to the cygwin1.dll from -61, leaving all else
unchanged, the command works just fine and xterm can be started with
~ /bin/xterm -display localhost:0.0


This problem has been reported a few times before, but we don't know
why it happens.  You might try the suggestions in the FAQ [1] and see ifhtey 
help.

If you have more information, please add it to the bugzilla for this issue [2]

It's interesting that this is apparently provoked by a change in cygwin DLL. 
I see a few items in the ChangeLog which relate to link(), but nothing that 
seems relevant...


[1] http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-cant-read-lock-file
[2] http://sourceware.org/bugzilla/show_bug.cgi?id=9778

--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Corinna Vinschen
On Oct  5 10:20, Andy Koppe wrote:
 2009/10/5 Corinna Vinschen:
  There's a difference, though, when starting xterm via the `run -p xterm
  -ls' shortcut.  With Cygwin -61, xterm just starts tcsh and it works,
  with Cygwin -62, xterm tries to start the shell via luit, and that
  fails.  If luit is missing on the system (renamed), xterm starts with
  a message Can't execvp /usr/bin/luit: No such file or directory, and
  then starts tcsh just fine afterwards.
 
  Since there's no difference otherwise, it's not clear to me why this
  occurs.  In both cases the locale is set to the default C locale.
 
 Perhaps its behaviour depends on MB_CUR_MAX?

Probably, but that's not the actual problem.  The same happens in any
other, valid non-C locale, evey time tcsh is started via luit.

I digged deeper into this and it appears to be a bug in luit in the
first place.  In the second place it appears to be a bug in Cygwin as
well.  In the third place tcsh is not as smart as bash making the
current terminal on the stdio descriptors its controlling tty.

What happens is this, somewhat simplified:

Xterm creates a pty, make that the controlling tty and starts luit.
Luit creates another pty to run tcsh in it:

  /* Give up own controlling tty. */
  close (0);
  close (1);
  close (2);
  /* Set process group to own pid and set controlling tty to -1. */
  setsid ();
  /* Open tty as non-controlling tty. */
  new_tty = open (line, O_RDWR | O_NOCTTY);
  /* Make new tty controlling tty. */
  #ifdef TIOCSCTTY 
ioctl(tty, TIOCSCTTY, (char *)0);
  #endif

And here's the problem.  Cygwin doesn't have TIOCSCTTY, and the only way
to make a terminal a controlling tty in Cygwin is to call open() on it,
which tcsh misses to do.  Bash, however, calls open(/dev/tty, O_RDWR),
so bash doesn't have this problem.

Unfortunately, luit has no alternative way to make the new tty the
controlling tty.  What we need is a patch like this in luit:

--- sys.c.ORIG  2009-10-05 19:23:58.0 +0200
+++ sys.c   2009-10-05 19:18:34.0 +0200
@@ -408,7 +408,11 @@ openTty(char *line)
 int rc;
 int tty = -1;
 
+#ifdef __CYGWIN__
+tty = open(line, O_RDWR);
+#else
 tty = open(line, O_RDWR | O_NOCTTY);
+#endif
  
 if(tty  0)
 goto bail;

This works fine for me with tcsh now as well.  This patch is really
important, since not only tcsh is affected by this.  If you call, for
instance, `xterm -e /bin/vim', vim works, but it has no controlling tty
either, as easily visible in `ps -e' output.  So a patch to tcsh would
only fix this for tcsh, but not for any other application.

As for the Cygwin bug, it has to do with the return value of tcgetpgrp,
which appears to be incorrect in a couple of situations.  I'm not
quite sure how to explain this, yet, nor if I really understood it.
I'll follow up on this later this week on the cygwin-developers list.

Yaakov, could you please generate a new luit package with the above
patch?


Thanks,
Corinna


P.S: I had to build luit manually for testing.  Building with cyport
failed:

  configure.ac:30: error: must install xorg-macros 1.3 or later before
  running autoconf/autogen


-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Corinna Vinschen
On Oct  5 20:47, Corinna Vinschen wrote:
 Unfortunately, luit has no alternative way to make the new tty the
 controlling tty.  What we need is a patch like this in luit:
 
 --- sys.c.ORIG2009-10-05 19:23:58.0 +0200
 +++ sys.c 2009-10-05 19:18:34.0 +0200
 @@ -408,7 +408,11 @@ openTty(char *line)
  int rc;
  int tty = -1;
  
 +#ifdef __CYGWIN__
 +tty = open(line, O_RDWR);
 +#else
  tty = open(line, O_RDWR | O_NOCTTY);
 +#endif
   
  if(tty  0)
  goto bail;
 
 This works fine for me with tcsh now as well.

Oh, btw., this only works with tcsh for me if the shortcut is

  run xterm -e /bin/tcsh -l

In that case xterm calls `luit -- /bin/tcsh'.  Or, it works to call
`xterm -ls' from a Cygwin shell.

However, it still behaves weird if the shortcut is

  run xterm -ls

or if you start `xterm -ls' from a cmd shell.  This results in xterm
calling

  luit -argv0 -tcsh

which in turn starts /bin/sh with argv[0] set to tcsh.  This looks
somehow like a bug in xterm.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Jim Reisert AD1C
I start my xterms this way:

xterm  EXEC  xterm -e /usr/bin/tcsh

Is there an inherent problem with this?

- Jim

-- 
Jim Reisert AD1C, jjreis...@alum.mit.edu, http://www.ad1c.us

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Yaakov (Cygwin/X)

On 05/10/2009 13:47, Corinna Vinschen wrote:

And here's the problem.  Cygwin doesn't have TIOCSCTTY, and the only way
to make a terminal a controlling tty in Cygwin is to call open() on it,
which tcsh misses to do.  Bash, however, calls open(/dev/tty, O_RDWR),
so bash doesn't have this problem.


Out of curiosity, what about implementing TIOCSCTTY?


Unfortunately, luit has no alternative way to make the new tty the
controlling tty.  What we need is a patch like this in luit:

--- sys.c.ORIG  2009-10-05 19:23:58.0 +0200
+++ sys.c   2009-10-05 19:18:34.0 +0200
@@ -408,7 +408,11 @@ openTty(char *line)
  int rc;
  int tty = -1;

+#ifdef __CYGWIN__
+tty = open(line, O_RDWR);
+#else
  tty = open(line, O_RDWR | O_NOCTTY);
+#endif


For portability, perhaps this should also be #ifdef TIOCSCTTY, if these 
two sections go hand-in-hand?



This works fine for me with tcsh now as well.  This patch is really
important, since not only tcsh is affected by this.  If you call, for
instance, `xterm -e /bin/vim', vim works, but it has no controlling tty
either, as easily visible in `ps -e' output.  So a patch to tcsh would
only fix this for tcsh, but not for any other application.

As for the Cygwin bug, it has to do with the return value of tcgetpgrp,
which appears to be incorrect in a couple of situations.  I'm not
quite sure how to explain this, yet, nor if I really understood it.
I'll follow up on this later this week on the cygwin-developers list.

Yaakov, could you please generate a new luit package with the above
patch?


Sure.


P.S: I had to build luit manually for testing.  Building with cyport
failed:

   configure.ac:30: error: must install xorg-macros 1.3 or later before
   running autoconf/autogen


xorg-util-macros 1.3 is part of the upcoming X11R7.5, which I planned to 
release in one upload once all the components are available, built, and 
tested.  The luit update was also slated to be part of that, but I moved 
it ahead to fix the previous bug reports.



Yaakov
Cygwin/X

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-05 Thread Christopher Faylor
On Mon, Oct 05, 2009 at 05:46:21PM -0500, Yaakov (Cygwin/X) wrote:
On 05/10/2009 13:47, Corinna Vinschen wrote:
 And here's the problem.  Cygwin doesn't have TIOCSCTTY, and the only way
 to make a terminal a controlling tty in Cygwin is to call open() on it,
 which tcsh misses to do.  Bash, however, calls open(/dev/tty, O_RDWR),
 so bash doesn't have this problem.

Out of curiosity, what about implementing TIOCSCTTY?

It's something that we really should do.  I'll put it on my todo list.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-04 Thread Corinna Vinschen
On Oct  4 11:44, Jim Reisert AD1C wrote:
  Did you upgrade xorg-server at the same time? Maybe your problem is caused 
  by the change in system.XWinrc that I reported yesterday:
 
  http://cygwin.com/ml/cygwin-xfree/2009-10/msg00023.html
 
 I already had the latest Xorg server.   The only difference is the
 Cygwin version.  -61 works, -62 hangs.

This looks like a problem with the latest luit.  I can start xterm,
but I only get a /bin/sh prompt, not my usual tcsh prompt.

Stracing shows that luit is called with `luit -argv0 -tcsh', but nowhere
in the strace tcsh is actually started.  Rather, it looks like luit
starts /bin/sh with argv[0] set to -tcsh instead.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Xterm hangs with latest Cygwin (-62?)

2009-10-04 Thread Jim Reisert AD1C

On 10/4/2009 1:52 PM, Corinna Vinschen wrote:


Stracing shows that luit is called with `luit -argv0 -tcsh', but nowhere
in the strace tcsh is actually started.  Rather, it looks like luit
starts /bin/sh with argv[0] set to -tcsh instead.


Interesting.  When I was experimenting with -62, I noticed several 
tcsh.exe processes in the Windows task manager.  Maybe they're sort of 
starting, but don't get connected to the xterm somehow?


- Jim

--
Jim Reisert AD1C, jjreis...@alum.mit.edu, http://www.ad1c.us

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/