Bug 157313 - cad/spice SEGV
Summary: cad/spice SEGV
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Walter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 10:50 UTC by ksmakoto
Modified: 2013-05-02 09:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ksmakoto 2011-05-25 10:50:10 UTC
cad/spice cause internal error and SEGV.

$ cat sample_bug.spice
sample of bug
V0 1 0 1
.TRAN 1 10
.PRINT TRAN v(1, 0)
.END

$ spice3 -b sample_bug.spice

Circuit: sample of bug


internal error -- segmentation violation

Fix: 

This is workaround.

$ cat sample_nobug.spice
sample of no bug
V0 1 0 1
.TRAN 1 10
.PRINT TRAN v(1,0)
.END
How-To-Repeat: $ cat sample_bug.spice
sample of bug
V0 1 0 1
.TRAN 1 10
.PRINT TRAN v(1, 0)
.END

$ spice3 -b sample_bug.spice

Circuit: sample of bug


internal error -- segmentation violation
Comment 1 Hiroki Sato freebsd_committer freebsd_triage 2011-05-25 11:34:37 UTC
Responsible Changed
From-To: freebsd-ports-bugs->hrs

I'll take this.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2013-03-10 02:46:15 UTC
Responsible Changed
From-To: hrs->freebsd-ports-bugs

Hiroki-san, I am going to reassign this one to the pool because it does 
not appear to have been worked on for a while.
Comment 3 Stefan Walter freebsd_committer freebsd_triage 2013-04-29 13:32:18 UTC
Hello Makoto,

unfortunately, there hasn't been any activity with your problem report for
cad/spice (see [1]) for quite a while. Are you still seeing the problem
you described on an up-to-date system, or should the PR be closed?

The port does not have a maintainer, and I am not familiar with cad/spice
at all. I'm cc'ing Pedro Giffuni, who submitted the last functional
changes to the port, just in case he might be able to help.

Best regards,
Stefan

[1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/157313
Comment 4 Stefan Walter freebsd_committer freebsd_triage 2013-04-29 13:32:33 UTC
State Changed
From-To: open->feedback

Awaiting feedback. 


Comment 5 Stefan Walter freebsd_committer freebsd_triage 2013-04-29 13:32:33 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Track this while waiting for feedback.
Comment 6 Stefan Walter freebsd_committer freebsd_triage 2013-04-30 19:54:04 UTC
Forwarding Pedro's input to GNATS for the record. Thank you Pedro!

giffunip@tutopia.com, 30.04.13, 17:09h CEST:

>  Hello Makoto-san;
> 
>  Sorry for the delay in replying.
> 
>  I wasn't aware of this issue. I think it might be related to
>  an old bug in gcc on 8.2-Release. I suggest testing on a
>  newer release or an updated compiler (should work on clang).
> 
>  Hope that helps;
> 
>  Pedro.
Comment 7 dfilter service freebsd_committer freebsd_triage 2013-04-30 21:30:31 UTC
Author: hrs
Date: Tue Apr 30 20:30:22 2013
New Revision: 316960
URL: http://svnweb.freebsd.org/changeset/ports/316960

Log:
  - Fix SIGSEGV when there are spaces after a comma like ".PRINT TRAN v(2, 1)".
  - Style clean-ups.
  
  PR:		ports/157313
  Spotted by:	Makoto Kishimoto

Added:
  head/cad/spice/files/patch-src_lib_cp_lexical.c   (contents, props changed)
  head/cad/spice/files/patch-src_lib_fte_dotcards.c   (contents, props changed)
  head/cad/spice/files/patch-src_lib_misc_string.c   (contents, props changed)
Modified:
  head/cad/spice/Makefile

Modified: head/cad/spice/Makefile
==============================================================================
--- head/cad/spice/Makefile	Tue Apr 30 20:10:53 2013	(r316959)
+++ head/cad/spice/Makefile	Tue Apr 30 20:30:22 2013	(r316960)
@@ -1,44 +1,45 @@
-# New ports collection makefile for:    spice
-# Date created:         26 Mar 96
-# Whom:                 Julian Jenkins <kaveman@magna.com.au>
-#
+# Created by: Julian Jenkins <kaveman@magna.com.au>
 # $FreeBSD$
-#
 
 PORTNAME=	spice
 PORTVERSION=	3f5.2
-PORTREVISION=	7
+PORTREVISION=	8
 CATEGORIES=	cad
 MASTER_SITES=	http://embedded.eecs.berkeley.edu/pubs/downloads/spice/:sources
+PKGNAMESUFFIX=	${NOX11SUFX}
 DISTFILES=	spice3f5${EXTRACT_SUFX}:sources	\
 		cp.ps toc.ps doc.ps
 DIST_SUBDIR=	spice
 EXTRACT_ONLY=	spice3f5${EXTRACT_SUFX}
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	hrs@FreeBSD.org
 COMMENT=	A general-purpose circuit simulation program
 
 LICENSE=	BSD
 
 WRKSRC=		${WRKDIR}/${PORTNAME}3f5
+MAKEFILE=	${FILESDIR}/Makefile
+MAKE_ENV+=	STRIP_CMD=${STRIP_CMD}
+MAKE_JOBS_UNSAFE=	yes
 MAN1=		sconvert.1 nutmeg.1 spice.1
 MAN3=		mfb.3
 MAN5=		mfbcap.5
 MLINKS=		spice.1 spice3.1
-MAKEFILE=	${FILESDIR}/Makefile
-MAKE_ENV+=	STRIP_CMD=${STRIP_CMD}
-MAKE_JOBS_UNSAFE=	yes
 
-.ifdef WITHOUT_X11
-PKGNAMESUFFIX=	-without-x11
+OPTIONS_DEFINE=	DOCS X11
+OPTIONS_DEFAULT=DOCS X11
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MX11}
+USE_XORG=	x11 xaw xext xmu xt
+NOX11SUFX=
+.else
+NOX11SUFX=	-nox11
 COMMENT=	A general-purpose circuit simulation program (non-X11 version)
 MAKE_ARGS+=	-DWITHOUT_X11
-.else
-USE_XORG=	x11 xaw xext xmu xt
 .endif
 
-.include <bsd.port.pre.mk>
-
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr/ucb|${LOCALBASE}/bin|' ${WRKSRC}/util/build
 
@@ -50,7 +51,7 @@ do-configure:
 	    ${WRKSRC}/conf/FreeBSD ${WRKSRC}/conf/FreeBSD.without_x11
 
 post-install:
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 	${MKDIR} ${DOCSDIR}
 	${CAT} ${DISTDIR}/${DIST_SUBDIR}/*.ps > ${DOCSDIR}/spice3f3.ps
 	${GZIP_CMD} ${DOCSDIR}/*.ps
@@ -58,4 +59,4 @@ post-install:
 	${MKDIR} ${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/examples/*.cir ${EXAMPLESDIR}
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Added: head/cad/spice/files/patch-src_lib_cp_lexical.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/spice/files/patch-src_lib_cp_lexical.c	Tue Apr 30 20:30:22 2013	(r316960)
@@ -0,0 +1,11 @@
+--- src/lib/cp/lexical.c.orig	2013-05-01 05:15:32.000000000 +0900
++++ src/lib/cp/lexical.c	2013-05-01 05:16:36.000000000 +0900
+@@ -145,7 +145,7 @@
+         switch (c) {
+ 	case ' ':
+ 	case '\t':
+-            if (i > 0) {
++            if (paren < 1 && i > 0) {
+                 newword;
+             }
+             break;

Added: head/cad/spice/files/patch-src_lib_fte_dotcards.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/spice/files/patch-src_lib_fte_dotcards.c	Tue Apr 30 20:30:22 2013	(r316960)
@@ -0,0 +1,31 @@
+--- src/lib/fte/dotcards.c.orig	1993-07-30 13:44:28.000000000 +0900
++++ src/lib/fte/dotcards.c	2013-05-01 05:07:55.000000000 +0900
+@@ -405,11 +405,17 @@
+     char *string;
+ {
+     char buf[BSIZE_SP], *s, *t, *ss = string;
++    char *e;
+ 
++    e = string + strlen(string);
+     if (ciprefix("v(", string) && index(string, ',')) {
+         for (s = string; *s && (*s != ','); s++)
+             ;
+         *s++ = '\0';
++	while (s + 1 < e && isspace(*(s + 1))) {
++		*(s + 1) = '\0';
++		s++;
++	}
+         for (t = s; *t && (*t != ')'); t++)
+             ;
+         *t = '\0';
+@@ -589,6 +595,10 @@
+ 
+ 	if (c)
+ 	    *c = 0;
++	while (c + 1 < r && isspace(*(c + 1))) {
++		c++;
++		*c = '\0';
++	}
+ 
+ 	wl = alloc(struct wordlist);
+ 

Added: head/cad/spice/files/patch-src_lib_misc_string.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/spice/files/patch-src_lib_misc_string.c	Tue Apr 30 20:30:22 2013	(r316960)
@@ -0,0 +1,19 @@
+--- src/lib/misc/string.c.orig	2013-05-01 03:50:59.000000000 +0900
++++ src/lib/misc/string.c	2013-05-01 03:58:30.000000000 +0900
+@@ -148,13 +148,15 @@
+         (*s)++;
+     if (!**s)
+         return (NULL);
+-    while ((c = **s) && !isspace(c)) {
++    while ((c = **s)) {
+ 	if (c == '('/*)*/)
+ 	    paren += 1;
+ 	else if (c == /*(*/')')
+ 	    paren -= 1;
+ 	else if (c == ',' && paren < 1)
+ 	    break;
++	else if (isspace(c) && paren < 1)
++	    break;
+         buf[i++] = *(*s)++;
+     }
+     buf[i] = '\0';
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Hiroki Sato freebsd_committer freebsd_triage 2013-04-30 21:40:46 UTC
State Changed
From-To: feedback->patched

A fix has been committed.
Comment 9 Stefan Walter freebsd_committer freebsd_triage 2013-05-01 18:58:44 UTC
Makoto-san,

can you verify that the update that has been committed to cad/spice fixes
the problem you have reported?

Best regards,
Stefan
Comment 10 ksmakoto 2013-05-02 01:47:11 UTC
Hello, Stefan

On Wed, 1 May 2013 19:58:44 +0200
Stefan Walter <stefan@freebsd.org> wrote:
> Makoto-san,
> 
> can you verify that the update that has been committed to cad/spice fixes
> the problem you have reported?
> 
> Best regards,
> Stefan

Sato-sensei's fixes works well. Plese set status fixed and close this PR.
Thanks.
Comment 11 Stefan Walter freebsd_committer freebsd_triage 2013-05-02 09:15:41 UTC
State Changed
From-To: patched->closed

Submitter reports it's fixed.