[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

terminal problems with emacs



Hi, I'm experiencing two terminal-related problems with Emacs.  I suspect
they're related.  The terminal issues involved are beyond me, so I'm not
confident enough to submit a good bug report: I don't know where the problem
is, it could be emacs, it could be X, or something regarding terminfo, I really
don't know.

Could someone with more knowledge of the issues involved tell me whether to
submit this as a bug -- and in what package.   Thanks, I'm stumped!

1)

I run under X in general.  I have the following problem under all instances of
Emacs EXCEPT when I launch emacs from my fvwm menu, which does "exec emacs".  I
have tried as many combinations of launching from: xterm, from rxvt, from su
root, emacs on terminal (i.e., -nw) or as X window.  I have the problem with no
~/.bashrc (or other startup files), and launching emacs with -nw -q.

The problem is I can't use ange-ftp because the terminal process is screwy and
can't be parsed properly.  When I try to open "/swift:acs:", I type in my
password, and it connects, but then dies because it can't parse the ftp buffer,
which looks like this:

---------
[?1h=open acs
ftp> [?1l>Connected to acs.bu.edu.
220 acs FTP server (Version wu-2.4.2-academ[BETA-5](13) Tue Aug 29 09:26:22 EDT 1995) ready.
Remote system type is UNIX.
Using binary mode to transfer files.
[?1h=ftp> 
----------

It ought to look like this:
------------
ftp> open acs
Connected to acs.bu.edu.
220 acs FTP server (Version wu-2.4.2-academ[BETA-5](13) Tue Aug 29 09:26:22 EDT 1995) ready.
user "swift" Turtle Power!
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 331 Password required for swift.
230 User swift logged in.
hash
ftp> Hash mark printing on (1024 bytes/hash mark).
----------------

My /etc/profile is tame and looks like this:

----------------
PATH="/usr/local/bin:/usr/local/bin/X11:/usr/bin:/usr/bin/X11:/bin:/usr/games:."
PS1="\\$ "
HOSTNAME=$(hostname)
INDEXSTYLE=.:/usr/lib/texmf/makeindex:/usr/local/lib/texmf/makeindex:~/library/texmf/makeindex

export PATH PS1 HOSTNAME INDEXSTYLE

ulimit -c unlimited
umask 022
-----------------

My .xsession looks like this:

----------
#!/bin/bash -login
  # for when a shaped icon for xbiff is available....
  xbiff -shape &
  # shorten up the bell:  actually this is supposed to make it quieter....
  xset b 5
  fvwm
----------

---------------------------------------------------------------------------
2) 

I wrote a small sh script which calls popclient.  I have biff
installed and running.  When I call it from
the command line or have cron call it, everything works fine.  When I
have Emacs call the same thing by setting `mh-inc-prog' to the script,
it works fine except for these two permissions errors:

  popclient: clearbiffbit: fchmod: Operation not permitted

  popclient: restorebiffbit: fchmod: Operation not permitted

I tried to see what's going on with strace, but I could not add
anything to the above information: sure enough, in the one case an
fchmod() call fails.  The file descriptor that fchmod() operates on is
0 in both cases, but I can't find an open() that returns 0 -- is zero
the stdin? 

Here's the code that mh-e.el is executing:
------------
(mh-exec-cmd-output mh-inc-prog nil "-width" (window-width))

;; in mh-utils.el
(defun mh-exec-cmd-output (command display &rest args)
  ;; Execute MH command COMMAND with DISPLAY flag and ARGS.
  ;; Put the output into buffer after point.  Set mark after inserted text.
  ;; Output is expected to be shown to user, not parsed by mh-e.
  (push-mark (point) t)
  (apply 'call-process
	 (expand-file-name command mh-progs) nil t display
	 (mh-list-to-string args))
  (exchange-point-and-mark))
----------------

Here's the relevant parts of popclient.c in popclient-2.21:

/*********************************************************************
  function:      clearbiffbit
  description:   clear the owner execute bit on the controlling tty, so
                 that biff messages do not appear on the terminal with
                 the program output.

  arguments:     none.
  return value:  none.
  calls:         none.
  globals:       writes biffwas
 *********************************************************************/

int clearbiffbit ()
{
  struct stat buf;
 
  if (fstat(0,&buf) < 0) {
    perror("popclient: clearbiffbit: fstat");  /* fuss but don't quit */
    return;
  }

  if (buf.st_mode & S_IFCHR) {
    buf.st_mode &= 0777;        /* isolate the device permissions */
    biffwas = buf.st_mode;	/* save for restore */
    buf.st_mode &= ~S_IEXEC;    /* clear the execute bit */
    if (fchmod(0,buf.st_mode) < 0) {
      perror("popclient: clearbiffbit: fchmod");  /* fuss but don't quit */
      return;
    }
  }
}

/*********************************************************************
  function:      restorebiffbit
  description:   restore the previous state of the owner execute bit
                 on the controlling tty.
  arguments:     none.
  return value:  none.
  calls:         none.
  globals:       reads biffwas
 *********************************************************************/

int restorebiffbit ()
{
  if (biffwas == -1)
    return;    /* not a tty */
  else {
    if (fchmod(0,biffwas) < 0) 
      perror("popclient: restorebiffbit: fchmod");   /* fuss but don't quit */
  }
}


Reply to: