Hi,

Here are various fixes for editors/elvis:

* Fix a build failure with clang; some <termcap.h> symbols were
  redefined (patch-guitcap_c).

* Fix a startup crash that's extremely easy to trigger on OpenBSD
  (patch-draw_c).

* Various fixes from a forked Github version (there was no official
  elvis release since 2004), clang warns about most of them.

* Remove some questionable/broken/dangerous features: backtick
  support in filenames, WYSIWYG for nroff/tex files, and
  HTTP/FTP support.  Looking at the code, I'd feel better having
  less features, here.  Please complain if you really want them.

* Remove dead FTP mirrors from MASTER_SITES, and use an HTTP server
  instead.

* Remove some previous patches of mine which only dealt with
  whitespace in man pages: fixing that was just useless noise.

* Add myself as a MAINTAINER, because well, I've already contributed
  some fixes in the past, and I guess I'm almost its last user... and
  I'd rather not lose it.

Tested on amd46+clang/gcc and loongson+clang/gcc, most of these
patches have been in use here for months if not years.


Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/elvis/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- Makefile    18 May 2015 11:29:37 -0000      1.23
+++ Makefile    17 Apr 2017 13:29:48 -0000
@@ -4,17 +4,18 @@ COMMENT=      clone of the ex/vi text editor
 
 DISTNAME=      elvis-2.2_0
 PKGNAME=       ${DISTNAME:S/_/./}
-REVISION=      2
+REVISION=      3
 CATEGORIES=    editors
 HOMEPAGE=      http://elvis.the-little-red-haired-girl.org/
 
+MAINTAINER=    Donovan Watteau <tso...@gmail.com>
+
 # Clarified Artistic License
 PERMIT_PACKAGE_CDROM=  Yes
 
 WANTLIB=               c curses
 
-MASTER_SITES=  ftp://ftp.cs.pdx.edu/pub/elvis/ \
-               ftp://ftp.fh-wedel.de/pub/elvis/
+MASTER_SITES=  http://www.the-little-red-haired-girl.org/pub/elvis/
 
 FLAVORS=       no_x11
 FLAVOR?=
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/editors/elvis/patches/patch-configure,v
retrieving revision 1.1
diff -u -p -r1.1 patch-configure
--- patches/patch-configure     11 Dec 2008 13:58:14 -0000      1.1
+++ patches/patch-configure     17 Apr 2017 13:29:48 -0000
@@ -1,7 +1,43 @@
 $OpenBSD: patch-configure,v 1.1 2008/12/11 13:58:14 jasper Exp $
---- configure.orig     Tue Dec  9 12:08:27 2008
-+++ configure  Tue Dec  9 12:08:32 2008
-@@ -794,8 +794,6 @@ case "$SYS" in
+
+Disable some questionable/broken/dangerous features.
+
+We also don't require -lipc anymore.
+
+--- configure.orig     Tue Oct 21 04:32:25 2003
++++ configure  Mon Apr 17 14:24:03 2017
+@@ -463,26 +463,10 @@ case "$FEATURE_XFT" in
+       ;;
+ esac
+ 
+-# if network protocols are unspecified, and the network header files are
+-# present, then assume they should be used.
+-if [ "$PROTOCOL_HTTP" = "" -a "$inet" ]
+-then
+-      why "Assuming HTTP should be supported because Internet headers were 
found"
+-      PROTOCOL_HTTP=define
+-elif [ "$PROTOCOL_HTTP" = "" ]
+-then
+-      why "Assuming HTTP should not be supported because Internet headers 
were not found"
+-      PROTOCOL_HTTP=undef
+-fi
+-if [ "$PROTOCOL_FTP" = "" -a "$inet" ]
+-then
+-      why "Assuming FTP should be supported because Internet headers were 
found"
+-      PROTOCOL_FTP=define
+-elif [ "$PROTOCOL_FTP" = "" ]
+-then
+-      why "Assuming FTP should not be supported because Internet headers were 
not found"
+-      PROTOCOL_FTP=undef
+-fi
++why "Assuming HTTP should not be supported because it's dangerous"
++PROTOCOL_HTTP=undef
++why "Assuming FTP should not be supported because it's dangerous" 
++PROTOCOL_FTP=undef
+ 
+ 
################################################################################
+ 
+@@ -794,8 +778,6 @@ case "$SYS" in
        why "For OpenBSD, we ignore the <sys/select.h> file"
        NEED_SELECT_H="undef"
        TLIBS="-lcurses"
@@ -10,3 +46,22 @@ $OpenBSD: patch-configure,v 1.1 2008/12/
        ;;
  
    *netbsd*)
+@@ -979,15 +961,15 @@ cat >config.h <<eof-config
+  */
+ #define       DISPLAY_HEX     /* hex          interactive hex dump */
+ #define       DISPLAY_HTML    /* html         formatted text */
+-#define       DISPLAY_MAN     /* man          formatted text */
+-#define       DISPLAY_TEX     /* tex          formatted text */
++#undef        DISPLAY_MAN     /* man          formatted text */
++#undef        DISPLAY_TEX     /* tex          formatted text */
+ #define       DISPLAY_SYNTAX  /* syntax       generic syntax coloring */
+ #${PROTOCOL_HTTP}     PROTOCOL_HTTP   /* define to enable HTTP; undef to 
disable */
+ #${PROTOCOL_FTP}      PROTOCOL_FTP    /* define to enable FTP; undef to 
disable */
+ #define       FEATURE_ALIAS   /* the :alias command */
+ #define       FEATURE_ARRAY   /* arrays in :calc expressions */
+ #define       FEATURE_AUTOCMD /* the :autocmd command */
+-#define       FEATURE_BACKTICK /* the \`program\` notation in file names */
++#undef        FEATURE_BACKTICK /* the \`program\` notation in file names */
+ #define       FEATURE_BROWSE  /* the :browse and :sbrowse commands */
+ #define       FEATURE_CACHEDESC /* store syntax/markup descriptions in RAM */
+ #define       FEATURE_CALC    /* built-in calculator -- see command below */
Index: patches/patch-ctags_c
===================================================================
RCS file: /cvs/ports/editors/elvis/patches/patch-ctags_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-ctags_c
--- patches/patch-ctags_c       11 Dec 2008 13:58:14 -0000      1.2
+++ patches/patch-ctags_c       17 Apr 2017 13:29:48 -0000
@@ -1,6 +1,15 @@
 $OpenBSD: patch-ctags_c,v 1.2 2008/12/11 13:58:14 jasper Exp $
---- ctags.c.orig       Tue Dec  9 12:02:33 2008
-+++ ctags.c    Tue Dec  9 12:04:16 2008
+
+getc() returns an int.
+
+Prevent an endless loop:
+https://github.com/mbert/elvis/commit/f0ca07a429d1
+
+Fix a segmentation fault:
+https://github.com/mbert/elvis/commit/8a42aebd91bd
+
+--- ctags.c.orig       Tue Oct 21 04:32:25 2003
++++ ctags.c    Mon Apr 17 12:58:42 2017
 @@ -241,7 +241,7 @@ int file_copyline(seek, fp, buf)
  {
        long    oldseek;/* where the file's pointer was before we messed it up 
*/
@@ -10,3 +19,36 @@ $OpenBSD: patch-ctags_c,v 1.2 2008/12/11
        char    *build; /* where to store the next character */
  
        /* go to the start of the line */
+@@ -640,9 +640,10 @@ int lex_gettoken()
+                                        */
+                                       if (ch == '/')
+                                       {
+-                                              while ((ch = cpp_getc()) != 
'\n')
++                                              do
+                                               {
+-                                              }
++                                                      ch = cpp_getc();
++                                              } while (ch != '\n' && ch != 
EOF);
+                                       }
+ 
+                                       /* the last name before a comma, '=', or
+@@ -969,7 +970,7 @@ void maketag(scope, name, lnum, seek, number, kind, in
+                               for (; scan && !strcmp(scan->TAGNAME,name); 
scan = next)
+                               {
+                                       if (warn_duplicate)
+-                                              printf("duplicate tag \"%s\" is 
typedef: keeping one from %s, not %ss\n", name, file_name, scan->TAGFILE);
++                                              printf("duplicate tag \"%s\" is 
typedef: keeping one from %s, not %s\n", name, file_name, scan->TAGFILE);
+ 
+                                       /* make any references to it point to
+                                        * the next tag instead.
+@@ -984,7 +985,10 @@ void maketag(scope, name, lnum, seek, number, kind, in
+                                                       ref->bighop = 
scan->next;
+                                       }
+                                       if (taglist == scan)
++                                      {
+                                               taglist = scan->next;
++                                              next = taglist;
++                                      }
+ 
+                                       /* delete this one */
+                                       (void)tagfree(scan);
Index: patches/patch-doc_ctags_man
===================================================================
RCS file: /cvs/ports/editors/elvis/patches/patch-doc_ctags_man,v
retrieving revision 1.2
diff -u -p -r1.2 patch-doc_ctags_man
--- patches/patch-doc_ctags_man 5 May 2012 14:03:15 -0000       1.2
+++ patches/patch-doc_ctags_man 17 Apr 2017 13:29:48 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-doc_ctags_man,v 1.2 2012/05/05 14:03:15 sthen Exp $
 --- doc/ctags.man.orig Tue Oct 21 04:32:26 2003
-+++ doc/ctags.man      Sat May  5 13:48:52 2012
++++ doc/ctags.man      Mon Apr 17 12:50:13 2017
 @@ -1,8 +1,8 @@
 -.TH CTAGS 1
 +.TH ELVCTAGS 1
@@ -13,30 +13,3 @@ $OpenBSD: patch-doc_ctags_man,v 1.2 2012
  .RB [ -D
  .IR word ]
  .RB [ -FBNgitvshlpdxra ]
-@@ -18,7 +18,7 @@ See
- .B ctags
- generates the
- .I tags
--and 
-+and
- .I refs
- files from a group of C source files.
- The
-@@ -84,7 +84,7 @@ and regular expressions for anything else.
- .IP \fB-g\fR
- For static tags, generate entries that look like global tags.
- (I.e., never generate an extra "file:" attribute.)
--This implies -s and -h.
-+This implies \-s and \-h.
- .IP \fB-i\fR
- Include inline definitions.
- A tag will be generated for each function which is declared as being
-@@ -151,7 +151,7 @@ the tag is defined, and the text of that line.
- .IP \fB-r\fP
- This causes
- .B ctags
--to generate both 
-+to generate both
- .I tags
- and
- .IR refs .
Index: patches/patch-doc_elvis_man
===================================================================
RCS file: patches/patch-doc_elvis_man
diff -N patches/patch-doc_elvis_man
--- patches/patch-doc_elvis_man 5 May 2012 14:03:15 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
-$OpenBSD: patch-doc_elvis_man,v 1.1 2012/05/05 14:03:15 sthen Exp $
---- doc/elvis.man.orig Tue Oct 21 04:32:26 2003
-+++ doc/elvis.man      Sat May  5 13:48:08 2012
-@@ -1,4 +1,4 @@
--.TH elvis 1
-+.TH ELVIS 1
- .SH NAME
- elvis \- a clone of the ex/vi text editor
- .SH SYNOPSIS
-@@ -46,7 +46,7 @@ you can give the command ":q" in each of its windows.
- If you've modified the buffer in a window, and you want to abandon those
- changes, then give the command ":q!" instead.
- .SH "HELP PAGES"
--For more information please take a look at 
-+For more information please take a look at
- .BR Elvis '
- help pages.
- These pages should have been installed together with
-@@ -83,7 +83,7 @@ by running...
- .B Elvis
- to output more status messages.
- You can use multiple \fB-V\fP flags to get even more detailed
--information.  
-+information.
- \fB-VVV\fP can be handy when
- .B Elvis
- isn't initializing itself quite the way you
-@@ -150,7 +150,7 @@ The \fB-S\fR flag is just used to make
- permanently paranoid, for the duration of this process.
- .IP \fB-SS\fR
- Sets security=restricted.
--This is more extreme security than "-S".
-+This is more extreme security than "\-S".
- The intent is to protect the system against reading by malicious users.
- .IP "\fB-f \fIsession\fR"
- Makes
-@@ -163,13 +163,13 @@ Redirects messages and trace information out to
- .I logfile
- instead of going to stdout/stderr as usual.
- This is useful under Windows95, where stdout/stderr don't show anywhere.
--If you're having trouble configuring WinElvis, try running "WinElvis -VVV -o 
log"
-+If you're having trouble configuring WinElvis, try running "WinElvis \-VVV 
\-o log"
- and then you can find the trace and error messages in the file "log".
- .IP "\fB-G \fIgui\fR"
- Makes
- .B Elvis
- use the named \fIgui\fR user interface instead of the default.
--To see a list of supported user interfaces, give the command "elvis -?".
-+To see a list of supported user interfaces, give the command "elvis \-?".
- .IP "\fB-c \fIcommand\fR"
- After loading the first file, interpret \fIcommand\fR as an ex command line.
- Several ex command lines can be sent in one line, separated by "|".
-@@ -334,9 +334,9 @@ First, the server
- temporarily sets security=safer while the
- command is executed, for security reasons.
- Second, the command is executed by the server's existing window, not the
--new one, so (for example) "elvis -client -c 20 foo" creates a new window for 
the file
--"foo", and then moves the OLD WINDOW's cursor to line 20 of whatever file
--it was showing.
-+new one, so (for example) "elvis \-client \-c 20 foo" creates a new window for
-+the file "foo", and then moves the OLD WINDOW's cursor to line 20 of whatever
-+file it was showing.
- .SS "X11 Mouse"
- .PP
- I've tried to reach a balance between the mouse behavior of
-@@ -454,7 +454,7 @@ when looking for a header file such as <stdio.h>.
- .IP "LC_ALL, LC_MESSAGES, and LANG"
- If LANG is defined, then
- .B Elvis
--will look for for its message translations in
-+will look for its message translations in
- .IR $LANG/elvis.msg ,
- and only use just plain
- .I elvis.msg
-@@ -500,7 +500,7 @@ containing a file named
- .IP TERM
- For the termcap interface, this is the name of the terminal's termcap/terminfo
- entry.
--Also, if its value is "kvt" or ends with "-r" or "-rv", then the background
-+Also, if its value is "kvt" or ends with "\-r" or "\-rv", then the background
- option will be "light" by default; else it will be "dark".
- .IP TERMCAP
- For the termcap interface, this can either store the name of a termcap file
Index: patches/patch-doc_ref_man
===================================================================
RCS file: patches/patch-doc_ref_man
diff -N patches/patch-doc_ref_man
--- patches/patch-doc_ref_man   5 May 2012 14:03:15 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-$OpenBSD: patch-doc_ref_man,v 1.1 2012/05/05 14:03:15 sthen Exp $
---- doc/ref.man.orig   Tue Oct 21 04:32:26 2003
-+++ doc/ref.man        Sat May  5 13:48:30 2012
-@@ -17,7 +17,7 @@ See
- quickly locates and displays the header of a function.
- To do this,
- .B ref
--looks in the "tags" file for the line that describes the function, and then 
-+looks in the "tags" file for the line that describes the function, and then
- scans the source file for the function.
- When it locates the function, it displays an introductory comment
- (if there is one), the function's declaration, and the declarations of all
-@@ -28,8 +28,8 @@ Output tag info, instead of the function header.
- The tag info consists of the three standard fields from each tag.
- The fields will be separated by tab characters, just like records from the
- traditional tags file format.
--Consequently, you can use "ref -t -a >oldtags" to convert a new-style tags 
file
--back to an old-style tags file.
-+Consequently, you can use "ref \-t \-a >oldtags" to convert a new-style tags
-+file back to an old-style tags file.
- .IP \fB-v\fR
- Output verbose tag info, instead of the function header.
- The verbose tag info shows the names and values of all attributes for each
-@@ -65,7 +65,7 @@ would only output the single most likely tag.)
- Search all tags files.
- Without this option,
- .B ref
--would stop searching after processing the first tags file which 
-+would stop searching after processing the first tags file which
- contained any tags which met the restrictions.
- .IP "\fB-p\fI tagpath\fR"
- List of directories or tags files to search through.
-@@ -122,7 +122,7 @@ global tags whose address mentions "Foo" \-
- probably friends of the Foo class.
- .TP
- .IB value [, value ...]
--Short for 
-+Short for
- .BI tagname: value [, value ...]
- .PP
- The sorting hints follow a similar form:
-@@ -160,10 +160,10 @@ I needed to generate extern declarations for all the f
- To find the global function headers, I used the command...
- .nf
- 
--              ref -a kind:f file:dummy
-+              ref \-a kind:f file:dummy
- .fi
- .PP
--The "-a" causes
-+The "\-a" causes
- .B ref
- to output all headers, instead of just the first one that it finds.
- "kind:f" causes it to exclude any non-functions.
-@@ -184,7 +184,7 @@ For each source file, I also needed to find the static
- there, so for each "file.c" I used the command...
- .nf
- 
--              ref -a kind:f file:=file.c
-+              ref \-a kind:f file:=file.c
- .fi
- .PP
- This is very similar to the earlier command.
Index: patches/patch-draw_c
===================================================================
RCS file: patches/patch-draw_c
diff -N patches/patch-draw_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-draw_c        17 Apr 2017 13:29:48 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix a crash that's easily triggered by our malloc().
+
+https://github.com/mbert/elvis/commit/5c3c8ec827fe
+
+--- draw.c.orig        Tue Oct 21 04:32:25 2003
++++ draw.c     Tue Aug 16 19:59:52 2016
+@@ -1114,7 +1114,7 @@ static void updateimage(win)
+                       logicaltab = 0;
+               else
+               {
+-                      for (i = 0; di->newline[i].startrow < row && 
di->newline[i + 1].startrow - 1 < row; i++)
++                      for (i = 0; di->newline[i].startrow < row && di->nlines 
> i && di->newline[i + 1].startrow - 1 < row; i++)
+                       {
+                       }
+                       logicaltab = (row - di->newline[i].startrow) * ncols;
Index: patches/patch-guitcap_c
===================================================================
RCS file: patches/patch-guitcap_c
diff -N patches/patch-guitcap_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-guitcap_c     17 Apr 2017 13:29:48 -0000
@@ -0,0 +1,44 @@
+$OpenBSD$
+
+Don't try to redefine what's already in <termcap.h>.
+
+--- guitcap.c.orig     Tue Oct 21 04:32:25 2003
++++ guitcap.c  Mon Apr 17 14:20:08 2017
+@@ -11,27 +11,6 @@
+ 
+ #define       MINHEIGHT       4
+ 
+-/* Some termcap packages require the application code to supply a "BC"
+- * variable.  Others (particularly ncurses) forbid it.  The nice ones
+- * supply one if you don't, so they'll work either way.
+- */
+-#ifdef NEED_BC
+-       char   *BC;    /* :bc=: move cursor left */
+-#else
+-extern char   *BC;    /* :bc=: move cursor left */
+-#endif
+-
+-/* HP-UX, and maybe some others, require the application code to supply
+- * an "ospeed" variable.
+- */
+-#ifdef NEED_OSPEED
+-# ifdef NEED_SPEED_T
+-      speed_t ospeed;
+-# else
+-      short   ospeed;
+-# endif
+-#endif
+-
+ /* This macro is used to reset attributes and colors to normal values. */
+ #define revert(tw)    if ((tw) == current)\
+                               change(colorinfo[COLOR_FONT_NORMAL].fg,\
+@@ -105,9 +84,7 @@ static void cursorshape P_((ELVCURSOR shape));
+ /* termcap values */
+ static ELVBOOL        AM;             /* :am:  boolean: auto margins? */
+ static ELVBOOL        PT;             /* :pt:  boolean: physical tabs? */
+-       char   PC;             /* :pc=: pad character (not a string var!) */
+ static char   *VB;            /* :vb=: visible bell */
+-       char   *UP;            /* :up=: move cursor up */
+ static char   *AF;            /* :AF=: change the foreground color */
+ static char   *SO;            /* :so=: standout start */
+ static char   *SE;            /* :se=: standout end */
Index: patches/patch-move_c
===================================================================
RCS file: /cvs/ports/editors/elvis/patches/patch-move_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-move_c
--- patches/patch-move_c        5 May 2012 14:03:15 -0000       1.1
+++ patches/patch-move_c        17 Apr 2017 13:29:48 -0000
@@ -4,8 +4,10 @@ From Debian:
   "Fix a bug in the ) vi command that could cause a segmentation
   fault (patch from elvis-almost-2.2.1)"
 
+Also fix a very likely typo.
+
 --- move.c.orig        Tue Oct 21 04:32:25 2003
-+++ move.c     Sat May  5 13:53:51 2012
++++ move.c     Tue Aug 16 19:51:36 2016
 @@ -1620,6 +1620,7 @@ RESULT m_fsentence(win, vinf)
        long    para;
        long    offset;
@@ -22,3 +24,12 @@ From Debian:
        }
        marksetoffset(win->state->cursor, offset);
        if (para == offset)
+@@ -1892,7 +1894,7 @@ RESULT m_bsentence(win, vinf)
+                       {
+                               scannext(&cp);
+                       }
+-                      if (&cp)
++                      if (cp)
+                               marksetoffset(win->state->cursor, 
markoffset(scanmark(&cp)));
+                       else
+                       {
Index: patches/patch-osunix_ostext_c
===================================================================
RCS file: patches/patch-osunix_ostext_c
diff -N patches/patch-osunix_ostext_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-osunix_ostext_c       17 Apr 2017 13:29:48 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix an obvious typo.
+
+--- osunix/ostext.c.orig       Tue Oct 21 04:32:26 2003
++++ osunix/ostext.c    Tue Aug 16 19:52:22 2016
+@@ -46,7 +46,7 @@ int txtopen(filename, rwa, binary)
+       fd = open(filename, mode, 0666);
+       if (fd < 0)
+       {
+-              if (errno == EPERM || EACCES)
++              if (errno == EPERM || errno == EACCES)
+                       return -1;
+               else if (errno == EISDIR)
+                       return -2;
Index: patches/patch-region_c
===================================================================
RCS file: patches/patch-region_c
diff -N patches/patch-region_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-region_c      17 Apr 2017 13:29:48 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix an obvious typo.
+
+--- region.c.orig      Tue Oct 21 04:32:25 2003
++++ region.c   Tue Aug 16 19:52:41 2016
+@@ -409,7 +409,7 @@ RESULT ex_region(xinf)
+               if (comment)
+               {
+                       *comment++ = '\0';
+-                      while (*comment == ' ');
++                      while (*comment == ' ')
+                               comment++;
+                       if (*comment == '\0')
+                               comment = xinf->rhs;
Index: patches/patch-window_c
===================================================================
RCS file: patches/patch-window_c
diff -N patches/patch-window_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-window_c      17 Apr 2017 13:29:48 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix a very likely typo.
+
+--- window.c.orig      Tue Oct 21 04:32:25 2003
++++ window.c   Tue Aug 16 14:53:38 2016
+@@ -401,7 +401,7 @@ void winresize(win, rows, columns)
+ 
+ #ifdef FEATURE_AUTOCMD
+       /* handle OptChanged event for lines or columns now */
+-      if (changed);
++      if (changed)
+               auperform(win, ElvFalse, NULL, AU_OPTCHANGED, changed);
+ #endif
+ }

Reply via email to