zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@zanshin.com>
To: zsh-workers@sunsite.dk
Subject: Strange problem with zsh on RedHat Enterprise Linux
Date: Fri, 9 Apr 2004 15:51:01 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0404091441510.18545-100000@aztec.zanshin.com> (raw)

More specifically, on CentOS 3.1 (www.centos.org).

Zsh _always_ forces the "monitor" option to be off when run in a terminal
emulator or even when logging in remotely with ssh.  This is a royal pain.
It affects both the CentOS zsh RPM (4.0.7) and a fresh build from CVS.

For some reason, tcsetpgrp(SHTTY, pgrp) is returning -1 in attachtty()
even though the current process group is already the same as pgrp.  It
appears to set (or leave unset) errno = 0 even though it "failed," but I'm
not sure I can trust what the debugger is reporting as the value of errno,
because the errno != ENOTTY branch is not taken (no zwarn output).  In any
case, this causes us to hit this branch of the code:

            if (pgrp != mypgrp && kill(-pgrp, 0) == -1)
                attachtty(mypgrp);
            else {
                if (errno != ENOTTY)
                {
                    zwarn("can't set tty pgrp: %e", NULL, errno);
                    fflush(stderr);
                }
                opts[MONITOR] = 0;
                ep = 1;
            }

Well, pgrp != mypgrp is false, so we hit the "else" branch without ever
attempting the kill(), and needlessly turn off opts[MONITOR].  Argh.

At this point isset(MONITOR) is false so the "if (jobbing)" around the
entire body of attachtty() is false and we can never try to attach to
the terminal again.

So I changed it like this ...

                opts[MONITOR] = (gettygrp() == pgrp);
		ep = !opts[MONITOR];

... and now all is well.  However, any explanation of why tcsetpgrp() is
"failing" in this strange way would be appreciated.

However ... one other thing, even stranger.  If I actually comment out the
"if (errno != ENOTTY)" to force zwarn to print something, I first get
"inappropriate ioctl for device" and then zsh goes into an infinite loop,
calling attachtty() repeatedly but never again zwarn()ing any output
(even though zwarn() IS being called, so "noerrs" must have become set).

glibc-2.3.2-95.6
gcc-3.2.3-24


                 reply	other threads:[~2004-04-09 22:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0404091441510.18545-100000@aztec.zanshin.com \
    --to=schaefer@zanshin.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).