Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Dec 1999 08:40:03 -0800 (PST)
From:      Will Andrews <andrews@TECHNOLOGIST.COM>
To:        freebsd-ports@FreeBSD.org
Subject:   RE: ports/15741: joe editor coredumps when read a file using ^K-
Message-ID:  <199912281640.IAA05454@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/15741; it has been noted by GNATS.

From: Will Andrews <andrews@TECHNOLOGIST.COM>
To: serg@dor.zaural.ru
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: RE: ports/15741: joe editor coredumps when read a file using ^K-
Date: Tue, 28 Dec 1999 11:33:43 -0500 (EST)

 On 28-Dec-99 serg@dor.zaural.ru wrote:
 > 
 >>Number:         15741
 >>Category:       ports
 >>Synopsis:       joe editor coredumps when read a file using ^K-R
 
 Please send this kind of thing to me before sending it to GNATS, so you can get
 a "Reviewed By:" stamp from me BEFORE sending it in.. I am the maintainer for 
 this port after all.. ;)
 
 >>Confidential:   no
 >>Severity:       non-critical
 >>Priority:       low
 >>Responsible:    freebsd-ports
 >>State:          open
 >>Quarter:        
 >>Keywords:       
 >>Date-Required:
 >>Class:          change-request
 >>Submitter-Id:   current-users
 >>Arrival-Date:   Tue Dec 28 03:30:00 PST 1999
 >>Closed-Date:
 >>Last-Modified:
 >>Originator:     Sergey N. Voronkov
 >>Release:        FreeBSD 3.4-STABLE i386
 
 I used these machines:
 
 [ 3.4-STABLE as of December 28 ]
 FreeBSD shadow.blackdawn.com 3.4-STABLE FreeBSD 3.4-STABLE #0: Tue Dec 28
 10:44:21 EST 1999     root@shadow.blackdawn.com:/usr/src/sys/compile/SHADOW 
 i386
 
 [ 4.0-CURRENT as of September 29 ]
 FreeBSD argon.blackdawn.com 4.0-CURRENT FreeBSD 4.0-CURRENT #0: Tue Nov 30
 10:14:31 EST 1999     root@argon.blackdawn.com:/usr/src/sys/compile/ARGON  i386
 
 >       Joe dump core file when read a file using ^K-R.
 >       Problem is NULL-pointer assigment in b.c, patched line with 
 >       b->filehandle (b is uninitialized).
 
 Interesting.. I get the same problem using joe v2.8 (port Makefile v1.6)..:
 
 Name of file to insert (^C to abort): prdesczsh: segmentation fault (core
 dumped)  joe
 
 Have you reported this to the joe author?
 
 >       Change patch-ad to this:
 > 
 > --- b.c.orig  Fri Jan 20 13:38:25 1995
 > +++ b.c       Tue Dec 28 15:56:10 1999
 > @@ -22,4 +22,7 @@
 >  #endif
 >  #include <errno.h>
 > +#include <sys/file.h>
 > +#include <sys/types.h>
 > +#include <sys/stat.h>
 >  
 >  #include "config.h"
 > @@ -202,4 +205,5 @@
 >   else b->o=pdefault;
 >   mset(b->marks,0,sizeof(b->marks));
 > + b->filehandle = -1; /* initialize filehandle &&& ob */
 >   b->rdonly=0;
 >   b->orphan=0;
 > @@ -256,4 +260,8 @@
 >   if(b && !--b->count)
 >    {
 > +  if (b->filehandle != -1) {
 > +    /* close filehandle, free lock &&& ob */
 > +    close (b->filehandle);
 > +    }
 >    if(b->changed) abrerr(b->name);
 >    if(b==errbuf) errbuf=0;
 > @@ -1672,5 +1680,6 @@
 >   long skip,amnt;
 >   char *n;
 > - int nowrite=0;
 > + struct stat sb;
 > + int nowrite=0,fh=-1;
 >  
 >   if(!s || !s[0])
 > @@ -1705,4 +1714,26 @@
 >    fi=fopen(n,"r");
 >    if(!fi) nowrite=0;
 > +/*printf ("nowrite open=%i\n", nowrite); */
 > +  
 > +  /* check file mod, if no write flags set, 
 > +     joe in read only mode. &&& ob */
 > +
 > +  if (!nowrite) { 
 > +    nowrite = (!stat (n, &sb)) && (!(sb.st_mode & (S_IWUSR | S_IWGRP |
 > S_IWOTH)));
 > +    }
 > +/*printf ("nowrite stat=%i\n", nowrite); */
 > +
 > +  /* lock the file if writable, or go into read only mode if
 > +     already locked,      */
 > +  
 > +  if ((fi) && (!nowrite)) { 
 > +    fh = dup( fileno(fi) ); 
 > +    nowrite = (flock (fh, LOCK_EX | LOCK_NB));
 > +    }
 > +/*printf ("nowrite flock=%i\n", nowrite); */
 > +
 > +/*nowrite = 1; */    /* for test purpose */
 > +/*printf ("nowrite=%i\n", nowrite); */
 > +
 >    }
 >   joesep(n);
 > @@ -1762,4 +1793,5 @@
 >  
 >   b->er=error;
 > + if( fh != -1 ) b->filehandle = fh;
 >   return b;
 >   }
 
 Thanks for your work on this! Unfortunately, however, it did not work on my
 -CURRENT machine. But I suspect it may be because the -CURRENT machine is still
 a very old version due to problems with if_ep. Thus the compiler is very out of
 date now (gcc 2.91.66, although this compile worked fine with gcc 2.7.2.3 on
 the -STABLE machine). In addition, who knows what changes might have been
 committed since the date indicated above; maybe the error below is obsolete.
 
 Could someone with a newer version of -CURRENT test it on their machine? I get
 errors like this:
 
 <1 5019-0> (99-12-28 11:26:50) [root@argon /usr/ports/editors/joe]# make
 ===>  Extracting for joe-2.8
 >> Checksum OK for joe2.8.tar.Z.
 ===>  Patching for joe-2.8
 ===>  Applying FreeBSD patches for joe-2.8
 ===>  Configuring for joe-2.8
 ===>  Building for joe-2.8
 cc conf.c -o conf
 ./conf /usr/local/lib 0
 cc -O -pipe -c b.c
 b.c: In function `bmkchn':
 b.c:207: structure has no member named `filehandle'
 b.c: In function `brm':
 b.c:262: structure has no member named `filehandle'
 b.c:264: structure has no member named `filehandle'
 b.c: In function `bload':
 b.c:1795: structure has no member named `filehandle'
 *** Error code 1
 
 Stop in /usr/ports/editors/joe/work/joe.
 *** Error code 1
 
 Stop in /usr/ports/editors/joe.
 *** Error code 1
 
 Stop in /usr/ports/editors/joe.
 *** Error code 1
 
 Stop in /usr/ports/editors/joe.
 
 (kinda looks like the structures in the std includes have been changed here.) I
 won't comment on whether the patch is ready to be committed, since it doesn't
 work on my -CURRENT machine, and I won't say it ISN'T ok, since my -CURRENT
 machine is out of date.
 
 Thanks for the patch, again. Fixes it on the latest -STABLE.
 
 --
 Will Andrews <andrews@technologist.com>
 GCS/E/S @d- s+:+>+:- a--->+++ C++ UB++++ P+ L- E--- W+++ !N !o ?K w---
 ?O M+ V-- PS+ PE++ Y+ PGP+>+++ t++ 5 X++ R+ tv+ b++>++++ DI+++ D+ 
 G++>+++ e->++++ h! r-->+++ y?
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912281640.IAA05454>