View | Details | Raw Unified | Return to bug 26773
Collapse All | Expand All

(-)Makefile (-8 / +15 lines)
Lines 6-22 Link Here
6
#
6
#
7
7
8
PORTNAME=	joe
8
PORTNAME=	joe
9
PORTVERSION=	2.8
9
PORTVERSION=	2.9.6
10
PORTREVISION=	3
11
CATEGORIES=	editors
10
CATEGORIES=	editors
12
MASTER_SITES=	ftp://ftp.std.com/src/editors/
11
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
13
DISTNAME=	${PORTNAME}${PORTVERSION}
12
MASTER_SITE_SUBDIR=	joe-editor
14
EXTRACT_SUFX=	.tar.Z
13
EXTRACT_SUFX=	.tgz
15
14
16
MAINTAINER?=	toasty@dragondata.com
15
MAINTAINER=	petef@databits.net
17
16
18
WRKSRC=		${WRKDIR}/joe
17
GNU_CONFIGURE=	yes
19
ALL_TARGET=	joe
18
USE_GMAKE=	yes
19
20
MAN1=		joe.1
20
MAN1=		joe.1
21
22
post-install:
23
.if !defined(NOPORTDOCS)
24
	${MKDIR} ${PREFIX}/share/doc/joe
25
	${INSTALL_DATA} ${WRKSRC}/INFO ${WRKSRC}/README ${PREFIX}/share/doc/joe
26
	${INSTALL_DATA} ${WRKSRC}/LIST ${PREFIX}/share/doc/joe/CommandList
27
.endif
21
28
22
.include <bsd.port.mk>
29
.include <bsd.port.mk>
(-)distinfo (-1 / +1 lines)
Line 1 Link Here
1
MD5 (joe2.8.tar.Z) = bad4221aa63ca432e37dac1a953294b1
1
MD5 (joe-2.9.6.tgz) = 304084bd8e32ec3a4ac2d90bbfef19b3
(-)pkg-descr (-8 / +14 lines)
Lines 1-9 Link Here
1
	JOE is the professional freeware ASCII text screen editor for UNIX. 
1
JOE is the professional freeware ASCII text screen editor for UNIX.
2
It makes full use of the power and versatility of UNIX, but lacks the steep
2
It makes full use of the power and versatility of UNIX, but lacks
3
learning curve and basic nonsense you have to deal with in every other UNIX
3
the steep learning curve and basic nonsense you have to deal with
4
editor. JOE has the feel of most IBM PC text editors: The key-sequences are
4
in every other UNIX editor. JOE has the feel of most IBM PC text
5
reminiscent of WordStar and Turbo-C.  JOE is much more powerful than those
5
editors: the key-sequences are reminiscent of WordStar and Turbo-C.
6
editors, however.  JOE has all of the features a UNIX user should expect:
6
JOE is much more powerful than those editors, however.  JOE has
7
full use of termcap/terminfo, excellent screen update optimizations (JOE is
7
all of the features a UNIX user should expect:  full use of
8
fully useable at 2400 baud), simple installation, and all of the
8
termcap/terminfo, excellent screen update optimizations (JOE is
9
fully usable at 2400 baud), simple installation, and all of the
9
UNIX-integration features of VI.
10
UNIX-integration features of VI.
11
12
WWW: http://sourceforge.net/projects/joe-editor/
13
14
-Pete
15
petef@databits.net
(-)pkg-plist (-5 / +9 lines)
Lines 3-10 Link Here
3
bin/jstar
3
bin/jstar
4
bin/rjoe
4
bin/rjoe
5
bin/jpico
5
bin/jpico
6
lib/joerc
6
etc/joerc
7
lib/jmacsrc
7
etc/jmacsrc
8
lib/jstarrc
8
etc/jstarrc
9
lib/rjoerc
9
etc/rjoerc
10
lib/jpicorc
10
etc/jpicorc
11
%%PORTDOCS%%share/doc/joe/INFO
12
%%PORTDOCS%%share/doc/joe/README
13
%%PORTDOCS%%share/doc/joe/CommandList
14
%%PORTDOCS%%@dirrm share/doc/joe
(-)files/patch-ad (-86 / +54 lines)
Lines 1-98 Link Here
1
--- b.c.orig	Fri Jan 20 00:38:25 1995
1
--- b.c.orig	Wed Apr 11 17:10:49 2001
2
+++ b.c	Sun Dec  3 09:58:21 2000
2
+++ b.c	Sat Apr 21 23:11:38 2001
3
@@ -21,6 +21,9 @@
3
@@ -16,6 +16,9 @@
4
 #include <pwd.h>
4
 #include <pwd.h>
5
 #endif
5
 #endif
6
 #include <errno.h>
6
 #include <errno.h>
7
+#include <sys/file.h>
7
+#include <sys/file.h>
8
+#include <sys/types.h>
8
+#include <sys/types.h>
9
+#include <sys/stat.h>
9
+#include <sys/stat.h>
10
 #include <stdlib.h>
11
 #include <ctype.h>
12
 #include <string.h>
13
@@ -178,6 +181,7 @@
14
 	else
15
 		b->o = pdefault;
16
 	mset (b->marks, 0, sizeof (b->marks));
17
+	b->filehandle = -1;  /* initialize filehandle &&& ob */
18
 	b->rdonly = 0;
19
 	b->orphan = 0;
20
 	b->oldcur = 0;
21
@@ -229,6 +233,11 @@
22
 void brm (B *b) {
23
 	if (b && !--b->count)
24
 	  {
25
+           if (b->filehandle != -1) {
26
+           /* close filehandle, free lock &&& ob */
27
+           close (b->filehandle);
28
+          }
29
+
30
 		  if (b->changed)
31
 			  abrerr (b->name);
32
 		  if (b == errbuf)
33
@@ -1867,7 +1876,8 @@
34
 	B *b;
35
 	long skip, amnt;
36
 	char *n;
37
-	int nowrite = 0;
38
+	struct stat sb;
39
+	int nowrite = 0, fh = -1;
10
 
40
 
11
 #include "config.h"
41
 	if (!s || !s[0])
12
 #include "blocks.h"
42
 	  {
13
@@ -201,6 +204,7 @@
43
@@ -1920,6 +1930,14 @@
14
  if(prop) b->o=prop->o;
44
 		  goto opnerr;
15
  else b->o=pdefault;
45
 	  }
16
  mset(b->marks,0,sizeof(b->marks));
17
+ b->filehandle = -1;	/* initialize filehandle &&& ob */
18
  b->rdonly=0;
19
  b->orphan=0;
20
  b->oldcur=0;
21
@@ -255,6 +259,10 @@
22
  {
23
  if(b && !--b->count)
24
   {
25
+  if (b->filehandle != -1) {
26
+    /* close filehandle, free lock &&& ob */
27
+    close (b->filehandle);
28
+    }
29
   if(b->changed) abrerr(b->name);
30
   if(b==errbuf) errbuf=0;
31
   if(b->undo) undorm(b->undo);
32
@@ -1671,7 +1679,8 @@
33
  B *b;
34
  long skip,amnt;
35
  char *n;
36
- int nowrite=0;
37
+ struct stat sb;
38
+ int nowrite=0,fh=-1;
39
 
46
 
40
  if(!s || !s[0])
47
+	/* Lock the file &&& ob,petef */
41
   {
48
+	if (fi)
42
@@ -1704,6 +1713,28 @@
49
+	  {
43
   else fclose(fi);
50
+	    fh = dup( fileno(fi) );
44
   fi=fopen(n,"r");
51
+	    nowrite = (flock (fh, LOCK_EX | LOCK_NB));
45
   if(!fi) nowrite=0;
52
+	  }
46
+/*printf ("nowrite open=%i\n", nowrite); */
47
+  
48
+  /* check file mod, if no write flags set, 
49
+     joe in read only mode. &&& ob */
50
+
51
+  if (!nowrite) { 
52
+    nowrite = (!stat (n, &sb)) && (!(sb.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)));
53
+    }
54
+/*printf ("nowrite stat=%i\n", nowrite); */
55
+
53
+
56
+  /* lock the file if writable, or go into read only mode if
57
+     already locked,      */
58
+  
59
+  if ((fi) && (!nowrite)) { 
60
+    fh = dup( fileno(fi) ); 
61
+    nowrite = (flock (fh, LOCK_EX | LOCK_NB));
62
+    }
63
+/*printf ("nowrite flock=%i\n", nowrite); */
64
+
54
+
65
+/*nowrite = 1; */	/* for test purpose */
55
 	/* Skip data if we need to */
66
+/*printf ("nowrite=%i\n", nowrite); */
56
 	if (skip && lseek (fileno (fi), skip, 0) < 0)
67
+
57
 	  {
68
   }
58
@@ -1978,6 +1996,8 @@
69
  joesep(n);
59
 	vsrm (n);
70
 
71
@@ -1761,6 +1792,7 @@
72
  vsrm(n);
73
 
60
 
74
  b->er=error;
61
 	b->er = error;
75
+ if( fh != -1 ) b->filehandle = fh;
62
+	if (fh != -1)
76
  return b;
63
+	  b->filehandle = fh;
77
  }
64
 	return b;
65
 }
78
 
66
 
79
@@ -1990,7 +2022,18 @@
80
  {
81
  long tim=time(0);
82
  B *b;
83
- FILE *f=fopen("DEADJOE","a");
84
+ FILE *f;
85
+ struct stat sb;
86
+ if ((lstat("DEADJOE", &sb) == 0) && (((sb.st_mode & S_IFLNK) && (sb.st_uid != getuid())) || (sb.st_nlink > 1))) 
87
+  {
88
+  printf("*** JOE was aborted ");
89
+  if (sig) printf("by signal %d, cannot save DEADJOE due to unsafe symlink\n",sig);
90
+  else printf("because the terminal closed, cannot save DEADJOE due to unsafe symlink\n");
91
+  if(sig) ttclsn();
92
+  _exit(1);
93
+  }
94
+ f=fopen("DEADJOE","a");
95
+ chmod("DEADJOE", S_IRUSR | S_IWUSR);
96
  fprintf(f,"\n*** Modified files in JOE when it aborted on %s",ctime(&tim));
97
  if(sig) fprintf(f,"*** JOE was aborted by signal %d\n",sig);
98
  else fprintf(f,"*** JOE was aborted because the terminal closed\n");
(-)files/patch-ae (-7 / +9 lines)
Lines 1-8 Link Here
1
--- b.h.orig	Wed Dec 21 13:04:46 1994
1
--- b.h.orig	Sat Apr 21 23:15:48 2001
2
+++ b.h	Tue Dec  7 13:35:11 1999
2
+++ b.h	Sat Apr 21 23:16:16 2001
3
@@ -61,4 +61,5 @@
3
@@ -56,6 +56,7 @@
4
  int internal;			/* Set for internal buffers */
4
 	P *oldtop;		/* Last top screen position before orphaning */
5
  int er;			/* Error code when file was loaded */
5
 	int rdonly;		/* Set for read-only */
6
+ int filehandle;		/* File handle for locking */
6
 	int internal;		/* Set for internal buffers */
7
  };
7
+	int filehandle; 	/* File handle for locking */
8
 	int er;			/* Error code when file was loaded */
9
 };

Return to bug 26773