[PATCH] Line editing in emacs mode: minor fixes

Corinna Vinschen vinschen at redhat.com
Wed Aug 23 00:30:05 EEST 2006


Hi Christos,

On Aug 22 13:29, Christos Zoulas wrote:
> On Aug 22,  4:57pm, Martin.Kraemer at Fujitsu-Siemens.com (Martin Kraemer) wrote:
> -- Subject: [PATCH] Line editing in emacs mode: minor fixes
> 
> | When using the "Mark" and "Cursor" positions is emacs mode (set
> | using ^@, show using ^X^X), there are still some regressions:
> | 
> | If a word is deleted and the Mark is inside the deleted word, then
> | after deletion the Mark position is wrong.  The appended patch fixes
> | that.
> 
> Thanks, I applied it... Since there hasn't been a lot of activity, how
> about we cut a release in a couple of weeks? It is not like we are actively
> finding and fixing bugs? Does anyone know of any outstanding critical problems?

I get a build error on Cygwin:

  sh.lex.c:1602: error: structure has no member named `Bfclens'

The fclens stuff must be guarded by `#ifdef WIDE_STRINGS', afaics:

Index: sh.lex.c
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/sh.lex.c,v
retrieving revision 3.73
diff -p -u -r3.73 sh.lex.c
--- sh.lex.c    5 Jul 2006 15:07:03 -0000       3.73
+++ sh.lex.c    22 Aug 2006 21:16:07 -0000
@@ -1598,8 +1598,11 @@ bgetc(void)
            size_t i;
 
            bytes = fbobp;
-           for (i = 0; i < (size_t)(feobp - fbobp); i++)
-               bytes += fclens[i];
+#ifdef WIDE_STRINGS
+           if (use_fclens)
+                   for (i = 0; i < (size_t)(feobp - fbobp); i++)
+                       bytes += fclens[i];
+#endif
            fbobp = fseekp = feobp = bytes;
            c = wide_read(SHIN, fbuf[0], BUFSIZE, 1);
 #ifdef convex

After having built tcsh with that patch, tcsh crashed in weird ways.  It
took me a couple of hours to find the cause.  The problem is in
sh.init.c, function mesginit.  If SIGRTMIN is defined, the function
assumes that at least 4 realtime signals are available.  This isn't the
case on Cygwin which only provides one realtime signal, and SIGRTMIN ==
SIGRTMAX.  The result of this invalid assumption is that important
datastructures (for instance labuf) are overwritten with arbitrary
values right from the start.  The below patch fixes this for Cygwin.
Actually I think it would be better to create a generic solution which
does not make these assumtions, but checks carefully again for each 
SIGRT entry to mesg.  If you like, I can provide an appropriate patch.

Index: sh.init.c
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/sh.init.c,v
retrieving revision 3.61
diff -p -u -r3.61 sh.init.c
--- sh.init.c   2 Mar 2006 18:46:44 -0000       3.61
+++ sh.init.c   22 Aug 2006 21:16:06 -0000
@@ -751,7 +751,7 @@ mesginit(void)
            mesg[SIGRTMIN].iname = "RTMIN";
            mesg[SIGRTMIN].pname = CSAVS(2, 68, "First Realtime Signal");
        }
-
+#ifndef __CYGWIN__
        if (mesg[SIGRTMIN+1].pname == NULL) {
            mesg[SIGRTMIN+1].iname = "RTMIN+1";
            mesg[SIGRTMIN+1].pname = CSAVS(2, 69, "Second Realtime Signal");
@@ -766,6 +766,7 @@ mesginit(void)
            mesg[SIGRTMIN+3].iname = "RTMIN+3";
            mesg[SIGRTMIN+3].pname = CSAVS(2, 71, "Fourth Realtime Signal");
        }
+#endif /* __CYGWIN__ */
     }
 #endif /* SIGRTMIN */
 



Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the Tcsh mailing list