Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Poul-Henning Kamp


Go ahead!


In message <[EMAIL PROTECTED]>, Brian Somers writes:
>This makes xterm work again.  Any objections to a commit ?
>
>> David Wolfskill wrote:
>> 
>> > Built -CURRENT & rebooted after mergemaster as usual, and some X
>> > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
>> > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
>> > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
>> > and got an xterm OK.
>> 
>> Known problem.  phk changed the semantics of /dev/tty in the most recent
>> commits.  Traditional behavior for a process *without* a controlling tty
>> when it opens /dev/tty is to get ENXIO.
>> 
>> Formerly, ctty_open() returns ENXIO:
>> cttyopen(dev, flag, mode, p)
>> {
>> struct vnode *ttyvp = cttyvp(p);
>> 
>> if (ttyvp == NULL)
>> return (ENXIO);
>> ...
>> 
>> 
>> and now:
>> ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
>> {
>> struct vnode *vp;
>> 
>> if (*dev != NODEV)
>> return;
>> if (strcmp(name, "tty"))
>> return;
>> vp = cttyvp(curproc);
>> if (vp == NULL)
>> return;  <<< here, leads to ENOENT.
>> *dev = vp->v_rdev;
>> }
>> 
>> There used to be a device for the ctty.  We still maintain it for the
>> non-devfs case.  The following hack may work, I have not tested or even
>> compiled it:
>> 
>> Index: kern/tty_tty.c
>> ===
>> RCS file: /home/ncvs/src/sys/kern/tty_tty.c,v
>> retrieving revision 1.34
>> diff -u -r1.34 tty_tty.c
>> --- tty_tty.c2001/05/14 08:22:56 1.34
>> +++ tty_tty.c2001/05/15 08:30:17
>> @@ -177,6 +177,8 @@
>>  
>>  static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev));
>>  
>> +static dev_t ctty;
>> +
>>  static void
>>  ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
>>  {
>> @@ -187,9 +189,11 @@
>>  if (strcmp(name, "tty"))
>>  return;
>>  vp = cttyvp(curproc);
>> -if (vp == NULL)
>> -return;
>> -*dev = vp->v_rdev;
>> +if (vp == NULL) {
>> +if (ctty)
>> +*dev = ctty;
>> +} else
>> +*dev = vp->v_rdev;
>>  }
>>  
>>  
>> @@ -201,6 +205,7 @@
>>  
>>  if (devfs_present) {
>>  EVENTHANDLER_REGISTER(dev_clone, ctty_clone, 0, 1000);
>> +ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty");
>>  } else {
>>  make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
>>  }
>> 
>> This hack recreates a /dev/ctty hook that works the "old way", and makes
>> /dev/tty switch through to that one instead.  This is evil and is probably
>> even more broken than before, but I think it will work.
>> 
>> The alternative is to edit the XFree86 xterm source and rebuild it.
>> look for xc/programs/xterm/main.c where it opens /dev/tty and then
>> checks an inclusive list of errno's, including ENXIO and ENODEV etc.
>> Add ENOENT to the list of 'acceptable' errors.
>> 
>> Incidently, the xterm binary is broken, it does not use libutil/openpty().
>> 
>> Cheers,
>> -Peter
>> --
>> Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
>> "All of this is for nothing if we don't go to the stars" - JMS/B5
>> 
>> 
>> To Unsubscribe: send mail to [EMAIL PROTECTED]
>> with "unsubscribe freebsd-current" in the body of the message
>> 
>
>-- 
>Brian <[EMAIL PROTECTED]>
>     
>Don't _EVER_ lose your sense of humour !
>
>
>
>To Unsubscribe: send mail to [EMAIL PROTECTED]
>with "unsubscribe freebsd-current" in the body of the message
>

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED] | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Szilveszter Adam

On Tue, May 15, 2001 at 06:32:16PM +0100, Brian Somers wrote:
> Have you got v1.23 of sys/fs/devfs/devfs_vnops.c and are you running 
> as non-root ?

Yes:

ident /usr/src/sys/fs/devfs/devfs_vnops.c

/usr/src/sys/fs/devfs/devfs_vnops.c:
 $FreeBSD: src/sys/fs/devfs/devfs_vnops.c,v 1.23 2001/05/14 08:20:46
phk Exp $

and, uhm, yes:-) But as David pointed out, it may make a difference if you
use startx/xinit or xdm. I did not think of that because I never use xdm.
So, clarfying things a bit, I am running as non-root but using startx, as I
always have.

BTW David, you can use startx too with XFree4 if you want just install the
wrapper script from /usr/ports/x11/wrapper. I did this on a friend's
machine and it works:-)


-- 
Regards:

Szilveszter ADAM
Szeged University
Szeged Hungary

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread David Wolfskill

>Date: Tue, 15 May 2001 19:16:44 +0200
>From: Szilveszter Adam <[EMAIL PROTECTED]>

>> > Built -CURRENT & rebooted after mergemaster as usual, and some X
>> > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
>> > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
>> > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
>> > and got an xterm OK.

>> Known problem.  phk changed the semantics of /dev/tty in the most recent
>> commits.  Traditional behavior for a process *without* a controlling tty
>> when it opens /dev/tty is to get ENXIO.

>I am confused now. I have just finished building and installing world and
>kernel from top-of-the-tree sources:

>...

>and I am (for the first time ever) a proud owner of a devfs-powered FreeBSD
>system. So far things are looking A-OK. 

:-)

>Having read about all the trouble people were having with xterms, I grew a
>bit anxious and fired up X. It crashed because the config file contained
>/dev/mouse and that node no longer exists, but of course correcting it to
>/dev/sysmouse made things work.

What I did was add

ln -fs /dev/sysmouse /dev/mouse

to /etc/rc.devfs, and that part no longer was a problem.

>Then... I proceeded to open an xterm... and
>it opened! Just right-clicked the root window and chose xterm form the
>popup menu and it worked without any patch... although I am confident I do
>have the latest of phk-s commits and I am running on a new kernel... I am
>using XFree-3.3.6 and olvwm if that at all counts... of course I am happy
>to see no problems but why are others seeing them?

How are you starting X?  Based on Peter's analysis, I'd expect that if
you use "startx" or "xinit" after logging in, it should still work...
because you would still have a controlling tty (I think).

In my case, I'm using XFree86-4 (required for the hardware I use), so I
start up X via xdm, so there's no controlling tty.

Then again, I may have a penchant for breaking things  :-}

Cheers,
david
-- 
David H. Wolfskill  [EMAIL PROTECTED]
As a computing professional, I believe it would be unethical for me to
advise, recommend, or support the use (save possibly for personal
amusement) of any product that is or depends on any Microsoft product.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Brian Somers

Have you got v1.23 of sys/fs/devfs/devfs_vnops.c and are you running 
as non-root ?

> On Tue, May 15, 2001 at 01:34:27AM -0700, Peter Wemm wrote:
> > David Wolfskill wrote:
> > 
> > > Built -CURRENT & rebooted after mergemaster as usual, and some X
> > > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
> > > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
> > > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
> > > and got an xterm OK.
> > 
> > Known problem.  phk changed the semantics of /dev/tty in the most recent
> > commits.  Traditional behavior for a process *without* a controlling tty
> > when it opens /dev/tty is to get ENXIO.
> 
> I am confused now. I have just finished building and installing world and
> kernel from top-of-the-tree sources:
> 
> FreeBSD fonix.hos.u-szeged.hu 5.0-CURRENT FreeBSD 5.0-CURRENT #42: Tue May
> 15 18
> :32:49 CEST 2001 [EMAIL PROTECTED]:/usr/src/sys/compile/FONIX
> i386
> 
> and I am (for the first time ever) a proud owner of a devfs-powered FreeBSD
> system. So far things are looking A-OK. 
> 
> Having read about all the trouble people were having with xterms, I grew a
> bit anxious and fired up X. It crashed because the config file contained
> /dev/mouse and that node no longer exists, but of course correcting it to
> /dev/sysmouse made things work. Then... I proceeded to open an xterm... and
> it opened! Just right-clicked the root window and chose xterm form the
> popup menu and it worked without any patch... although I am confident I do
> have the latest of phk-s commits and I am running on a new kernel... I am
> using XFree-3.3.6 and olvwm if that at all counts... of course I am happy
> to see no problems but why are others seeing them?
> 
> -- 
> Regards:
> 
> Szilveszter ADAM
> Szeged University
> Szeged Hungary

-- 
Brian <[EMAIL PROTECTED]>
     
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Szilveszter Adam

On Tue, May 15, 2001 at 01:34:27AM -0700, Peter Wemm wrote:
> David Wolfskill wrote:
> 
> > Built -CURRENT & rebooted after mergemaster as usual, and some X
> > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
> > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
> > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
> > and got an xterm OK.
> 
> Known problem.  phk changed the semantics of /dev/tty in the most recent
> commits.  Traditional behavior for a process *without* a controlling tty
> when it opens /dev/tty is to get ENXIO.

I am confused now. I have just finished building and installing world and
kernel from top-of-the-tree sources:

FreeBSD fonix.hos.u-szeged.hu 5.0-CURRENT FreeBSD 5.0-CURRENT #42: Tue May
15 18
:32:49 CEST 2001 [EMAIL PROTECTED]:/usr/src/sys/compile/FONIX
i386

and I am (for the first time ever) a proud owner of a devfs-powered FreeBSD
system. So far things are looking A-OK. 

Having read about all the trouble people were having with xterms, I grew a
bit anxious and fired up X. It crashed because the config file contained
/dev/mouse and that node no longer exists, but of course correcting it to
/dev/sysmouse made things work. Then... I proceeded to open an xterm... and
it opened! Just right-clicked the root window and chose xterm form the
popup menu and it worked without any patch... although I am confident I do
have the latest of phk-s commits and I am running on a new kernel... I am
using XFree-3.3.6 and olvwm if that at all counts... of course I am happy
to see no problems but why are others seeing them?

-- 
Regards:

Szilveszter ADAM
Szeged University
Szeged Hungary

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Brian Somers

This makes xterm work again.  Any objections to a commit ?

> David Wolfskill wrote:
> 
> > Built -CURRENT & rebooted after mergemaster as usual, and some X
> > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
> > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
> > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
> > and got an xterm OK.
> 
> Known problem.  phk changed the semantics of /dev/tty in the most recent
> commits.  Traditional behavior for a process *without* a controlling tty
> when it opens /dev/tty is to get ENXIO.
> 
> Formerly, ctty_open() returns ENXIO:
> cttyopen(dev, flag, mode, p)
> {
> struct vnode *ttyvp = cttyvp(p);
> 
> if (ttyvp == NULL)
> return (ENXIO);
> ...
> 
> 
> and now:
> ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
> {
> struct vnode *vp;
> 
> if (*dev != NODEV)
> return;
> if (strcmp(name, "tty"))
> return;
> vp = cttyvp(curproc);
> if (vp == NULL)
> return;  <<< here, leads to ENOENT.
> *dev = vp->v_rdev;
> }
> 
> There used to be a device for the ctty.  We still maintain it for the
> non-devfs case.  The following hack may work, I have not tested or even
> compiled it:
> 
> Index: kern/tty_tty.c
> ===
> RCS file: /home/ncvs/src/sys/kern/tty_tty.c,v
> retrieving revision 1.34
> diff -u -r1.34 tty_tty.c
> --- tty_tty.c 2001/05/14 08:22:56 1.34
> +++ tty_tty.c 2001/05/15 08:30:17
> @@ -177,6 +177,8 @@
>  
>  static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev));
>  
> +static dev_t ctty;
> +
>  static void
>  ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
>  {
> @@ -187,9 +189,11 @@
>   if (strcmp(name, "tty"))
>   return;
>   vp = cttyvp(curproc);
> - if (vp == NULL)
> - return;
> - *dev = vp->v_rdev;
> + if (vp == NULL) {
> + if (ctty)
> + *dev = ctty;
> + } else
> + *dev = vp->v_rdev;
>  }
>  
>  
> @@ -201,6 +205,7 @@
>  
>   if (devfs_present) {
>   EVENTHANDLER_REGISTER(dev_clone, ctty_clone, 0, 1000);
> + ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty");
>   } else {
>   make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
>   }
> 
> This hack recreates a /dev/ctty hook that works the "old way", and makes
> /dev/tty switch through to that one instead.  This is evil and is probably
> even more broken than before, but I think it will work.
> 
> The alternative is to edit the XFree86 xterm source and rebuild it.
> look for xc/programs/xterm/main.c where it opens /dev/tty and then
> checks an inclusive list of errno's, including ENXIO and ENODEV etc.
> Add ENOENT to the list of 'acceptable' errors.
> 
> Incidently, the xterm binary is broken, it does not use libutil/openpty().
> 
> Cheers,
> -Peter
> --
> Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> "All of this is for nothing if we don't go to the stars" - JMS/B5
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
> 

-- 
Brian <[EMAIL PROTECTED]>
     
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Huh??!? xterm: Error 14, errno 2: No such file or directory

2001-05-15 Thread Peter Wemm

David Wolfskill wrote:

> Built -CURRENT & rebooted after mergemaster as usual, and some X
> applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
> least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
> a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
> and got an xterm OK.

Known problem.  phk changed the semantics of /dev/tty in the most recent
commits.  Traditional behavior for a process *without* a controlling tty
when it opens /dev/tty is to get ENXIO.

Formerly, ctty_open() returns ENXIO:
cttyopen(dev, flag, mode, p)
{
struct vnode *ttyvp = cttyvp(p);

if (ttyvp == NULL)
return (ENXIO);
...


and now:
ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
{
struct vnode *vp;

if (*dev != NODEV)
return;
if (strcmp(name, "tty"))
return;
vp = cttyvp(curproc);
if (vp == NULL)
return;  <<< here, leads to ENOENT.
*dev = vp->v_rdev;
}

There used to be a device for the ctty.  We still maintain it for the
non-devfs case.  The following hack may work, I have not tested or even
compiled it:

Index: kern/tty_tty.c
===
RCS file: /home/ncvs/src/sys/kern/tty_tty.c,v
retrieving revision 1.34
diff -u -r1.34 tty_tty.c
--- tty_tty.c   2001/05/14 08:22:56 1.34
+++ tty_tty.c   2001/05/15 08:30:17
@@ -177,6 +177,8 @@
 
 static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev));
 
+static dev_t ctty;
+
 static void
 ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
 {
@@ -187,9 +189,11 @@
if (strcmp(name, "tty"))
return;
vp = cttyvp(curproc);
-   if (vp == NULL)
-   return;
-   *dev = vp->v_rdev;
+   if (vp == NULL) {
+   if (ctty)
+   *dev = ctty;
+   } else
+   *dev = vp->v_rdev;
 }
 
 
@@ -201,6 +205,7 @@
 
if (devfs_present) {
EVENTHANDLER_REGISTER(dev_clone, ctty_clone, 0, 1000);
+   ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty");
} else {
make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
}

This hack recreates a /dev/ctty hook that works the "old way", and makes
/dev/tty switch through to that one instead.  This is evil and is probably
even more broken than before, but I think it will work.

The alternative is to edit the XFree86 xterm source and rebuild it.
look for xc/programs/xterm/main.c where it opens /dev/tty and then
checks an inclusive list of errno's, including ENXIO and ENODEV etc.
Add ENOENT to the list of 'acceptable' errors.

Incidently, the xterm binary is broken, it does not use libutil/openpty().

Cheers,
-Peter
--
Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message