NetBSD Problem Report #54690

From www@netbsd.org  Mon Nov 11 17:48:13 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 3803B7A184
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 11 Nov 2019 17:48:13 +0000 (UTC)
Message-Id: <20191111174812.47CB27A27F@mollari.NetBSD.org>
Date: Mon, 11 Nov 2019 17:48:12 +0000 (UTC)
From: scole_mail@gmx.com
Reply-To: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Subject: fix for pkgsrc/emulators/ski crashing on amd64
X-Send-Pr-Version: www-1.0

>Number:         54690
>Category:       pkg
>Synopsis:       fix for pkgsrc/emulators/ski crashing on amd64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 11 17:50:00 +0000 2019
>Closed-Date:    Mon Nov 18 16:43:24 +0000 2019
>Last-Modified:  Mon Nov 18 16:43:24 +0000 2019
>Originator:     scole_mail
>Release:        pkgsrc-2019Q3
>Organization:
none
>Environment:
NetBSD dstar.dstar.net 8.1_STABLE NetBSD 8.1_STABLE (GENERIC) #0: Wed Nov  6 16:12:22 PST 2019  scole@dstar.dstar.net:/home/scole/nbsd/cvs/8_0/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
The ia64 emulators "xski" & "gski" from pkgsrc/emulators/ski crash on amd64 but not i386.

It is apparently caused by an uncast 0 as a NULL arg to execlp().  Casting the terminanting argument from "0" to "(char *)0" prevents the crash.  My patches below also include the same fix for the freebsd version.

I'm not sure if using NULL would be more portable, but the arg to execlp() looks like it is expecting a char*.

Feel free to modify my patch to something more appropriate that still works...

Summary of changes:  (A/? = New, R/D = Removed, M = Modified)
=============================================================
? patches/patch-src_freebsd_ssc.c
M Makefile
M distinfo
M patches/patch-an

Apply patch with "cd .../pkgsrc/emulators/ski ; patch -s -p0 < .../patchfile"

--- /dev/null	2019-11-11 09:22:33.196109056 -0800
+++ patches/patch-src_freebsd_ssc.c	2019-11-11 08:51:25.030547512 -0800
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_freebsd_ssc.c,v 1.1 2019/11/11 16:50:11 scole Exp $
+
+Cast argument to execlp() appropriately
+
+--- src/freebsd/ssc.c.orig	2008-02-04 20:11:38.000000000 -0800
++++ src/freebsd/ssc.c	2019-11-11 08:49:35.285330731 -0800
+@@ -128,7 +128,7 @@
+ 		tty = name + namelen + 1;
+ 		sprintf(tty, "-S%s%d", name + namelen - 2, master);
+ 		execlp("xterm", "xterm", tty, "-geo", "80x24", "-name",
+-		    "xski console", 0);
++		    "xski console", (char *)0);
+ 		abort();
+ 	default: /* parent */
+ 		close(master);
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/ski/Makefile,v
retrieving revision 1.31
diff -b -u -r1.31 Makefile
--- Makefile	3 Nov 2019 19:24:34 -0000	1.31
+++ Makefile	11 Nov 2019 17:24:25 -0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.31 2019/11/03 19:24:34 rillig Exp $
+# $NetBSD: Makefile,v 1.32 2019/11/11 17:00:14 scole Exp $
 #

 DISTNAME=	ski-1.3.2
-PKGREVISION=	14
+PKGREVISION=	15
 CATEGORIES=	emulators
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=ski/}

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/ski/distinfo,v
retrieving revision 1.6
diff -b -u -r1.6 distinfo
--- distinfo	14 Aug 2016 18:27:05 -0000	1.6
+++ distinfo	11 Nov 2019 17:24:26 -0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2016/08/14 18:27:05 scole Exp $
+$NetBSD: distinfo,v 1.7 2019/11/11 17:01:30 scole Exp $

 SHA1 (ski-1.3.2.tar.gz) = fc067041a70cf45cad6af42da7ffe5bf100d7c65
 RMD160 (ski-1.3.2.tar.gz) = 1ff739eac7b8163026d208ee9b51d134f524e73f
@@ -18,12 +18,13 @@
 SHA1 (patch-ak) = 0abaa09fb172ebbc8715908f5c6f49936b22aefa
 SHA1 (patch-al) = 1911d6c8e051ab2b64055cf1c64856188268619e
 SHA1 (patch-am) = 0965936933424ab4af4d1fa3384808f4e92f9b04
-SHA1 (patch-an) = 72f18e509d371e4724a35b4be195a21dbcdac859
+SHA1 (patch-an) = 2120e04b76345665f55389714976cd0b121abd8b
 SHA1 (patch-ao) = 8f2eabd4d8dc6ccef593a5f50d00485a905ee523
 SHA1 (patch-ap) = a98cd0aa55a002020c26fb70e5549bd16270bf39
 SHA1 (patch-src-line_separator.h) = 2c9b0c2fdace6bc59735cbeb9588aea21b19b1db
 SHA1 (patch-src_eparse.y) = c82918d36047e51273cc1aa0e20a4ce1649668f5
 SHA1 (patch-src_freebsd_signal.h) = 265bd4e3f18dcfda791595b1356b37398c055349
+SHA1 (patch-src_freebsd_ssc.c) = 7218bd4e77b1d7eb591f1d432bd66d55a29026bf
 SHA1 (patch-src_program.c) = d364a8a0ababfbc48333d5e48962f53677bcfeb9
 SHA1 (patch-src_ssDCmd.c) = 9062b2107f72171644e27d83ec45260aa40019fe
 SHA1 (patch-src_ssX.c) = 01c24b8d6b62b51798ae4a33e69cfb323a66f8d5
Index: patches/patch-an
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/ski/patches/patch-an,v
retrieving revision 1.2
diff -b -u -r1.2 patch-an
--- patches/patch-an	14 Aug 2016 18:27:05 -0000	1.2
+++ patches/patch-an	11 Nov 2019 17:24:28 -0000
@@ -133,7 +133,7 @@
 +
 +		sprintf(tty, "-S%s/%d", name, slave); 
 +		execlp("xterm", "xterm", tty, "-geo", "80x24", "-name",
-+		    "xski console", 0);
++		    "xski console", (char *)0);
 +		perror("execlp(\"xterm\", ...) failed.");
 +		abort();
 +



>How-To-Repeat:
On amd64 build ia64 kernel and "skiload" boot loader

cd .../pkgsrc/emulators/ski && bmake install

cd to directory where "skiload" and ia64 kernel exist

run "xski skiload"

type "run" in command window

xski will crash


make sure xterm opens with "xski console" appears with "OK" boot prompt, and "Running" window with increasing "icnt: ...." counter appears

>Fix:
Build with included patches.

Can tell problem is fixed if running xski and
xterm opens with "xski console" appearing with "OK" boot prompt, and "Running" window with increasing "icnt: ...." counter appears

>Release-Note:

>Audit-Trail:
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/54690: fix for pkgsrc/emulators/ski crashing on amd64
Date: Mon, 11 Nov 2019 10:29:20 -0800

 Just to be clear, using "NULL" and "(char *)0" both worked for me.

 I looked in the kernel code and looks like almost all execlp() calls use
 "NULL", execpt for one case that used "(char *)NULL".

 Thanks

State-Changed-From-To: open->closed
State-Changed-By: scole@NetBSD.org
State-Changed-When: Mon, 18 Nov 2019 08:43:24 -0800
State-Changed-Why:
checked in fix to current


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.