Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2018 14:38:07 +0000 (UTC)
From:      Kurt Jaeger <pi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r477579 - in head/math/sc-im: . files
Message-ID:  <201808191438.w7JEc7Cw059148@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pi
Date: Sun Aug 19 14:38:07 2018
New Revision: 477579
URL: https://svnweb.freebsd.org/changeset/ports/477579

Log:
  math/sc-im: fix segmentation fault upon :wq
  
  - bug reported upstream as https://github.com/andmarti1424/sc-im/pull/280
  
  PR:		227861
  Submitted by:	Samy Mahmoudi <samy.mahmoudi@gmail.com>
  Approved by:	bapt (maintainer timeout)

Added:
  head/math/sc-im/files/
  head/math/sc-im/files/patch-cmds__command.c   (contents, props changed)
  head/math/sc-im/files/patch-doc   (contents, props changed)
  head/math/sc-im/files/patch-file.c   (contents, props changed)
Modified:
  head/math/sc-im/Makefile

Modified: head/math/sc-im/Makefile
==============================================================================
--- head/math/sc-im/Makefile	Sun Aug 19 14:26:10 2018	(r477578)
+++ head/math/sc-im/Makefile	Sun Aug 19 14:38:07 2018	(r477579)
@@ -1,9 +1,10 @@
 # $FreeBSD$
 
-PORTNAME=	sc-im
-PORTVERSION=	0.7.0
+PORTNAME=		sc-im
+PORTVERSION=		0.7.0
 DISTVERSIONPREFIX=	v
-CATEGORIES=	math
+PORTREVISION=		1
+CATEGORIES=		math
 
 MAINTAINER=	bapt@FreeBSD.org
 COMMENT=	Ncurses spreadsheet program for terminal

Added: head/math/sc-im/files/patch-cmds__command.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/sc-im/files/patch-cmds__command.c	Sun Aug 19 14:38:07 2018	(r477579)
@@ -0,0 +1,11 @@
+--- cmds_command.c.orig	2018-08-03 06:04:39 UTC
++++ cmds_command.c
+@@ -826,7 +826,7 @@ void do_commandmode(struct block * sb) {
+             exec_cmd(line);
+ 
+         } else if ( inputline[0] == L'w' ) {
+-            if (savefile() == 0 && ! wcscmp(inputline, L"wq")) shall_quit = 1;
++            if (savefile() == 0 && ! wcsncmp(inputline, L"wq", 2)) shall_quit = 1;
+ 
+         } else if ( ! wcsncmp(inputline, L"file ", 5) ) {
+ 

Added: head/math/sc-im/files/patch-doc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/sc-im/files/patch-doc	Sun Aug 19 14:38:07 2018	(r477579)
@@ -0,0 +1,11 @@
+--- doc.orig	2018-08-03 06:09:42 UTC
++++ doc
+@@ -328,6 +328,8 @@ Commands for handling cell content:
+      :w {file}   Save the current spreadsheet as {file}.
+      :w! {file}  Save the current spreadsheet as {file}, forcing an overwrite
+                  if {file} already exists.
++     :wq         Save the current spreadsheet and quit SC-IM.
++     :wq {file}  Save the current spreadsheet as {file} and quit SC-IM.
+ 
+      :h          Show this help.
+      :help       Show this help.

Added: head/math/sc-im/files/patch-file.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/sc-im/files/patch-file.c	Sun Aug 19 14:38:07 2018	(r477579)
@@ -0,0 +1,16 @@
+--- file.c.orig	2017-12-13 17:48:59 UTC
++++ file.c
+@@ -202,7 +202,12 @@ int savefile() {
+     del_range_chars(name, 0, 1 + force_rewrite);
+     wordexp(name, &p, 0);
+ 
+-    if (! force_rewrite && p.we_wordv[0] && file_exists(p.we_wordv[0])) {
++    if (wcslen(inputline) > 2 && (!p.we_wordv || !p.we_wordv[0])) {
++       sc_error("Trailing space(s)");
++       return -1;
++    }
++
++    if (! force_rewrite && p.we_wordv && p.we_wordv[0] && file_exists(p.we_wordv[0])) {
+         sc_error("File already exists. Use \"!\" to force rewrite.");
+         wordfree(&p);
+         return -1;



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