NetBSD Problem Report #57272

From www@netbsd.org  Wed Mar 15 21:56:35 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_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 E016F1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 15 Mar 2023 21:56:34 +0000 (UTC)
Message-Id: <20230315215620.E5F501A923A@mollari.NetBSD.org>
Date: Wed, 15 Mar 2023 21:56:20 +0000 (UTC)
From: uwe@stderr.spb.ru
Reply-To: uwe@stderr.spb.ru
To: gnats-bugs@NetBSD.org
Subject: devel/cmake: incorrect ps(1) command selected on sparc
X-Send-Pr-Version: www-1.0

>Number:         57272
>Category:       pkg
>Synopsis:       devel/cmake: incorrect ps(1) command selected on sparc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 15 22:00:01 +0000 2023
>Last-Modified:  Sat Sep 30 08:55:01 +0000 2023
>Originator:     Valery Ushakov
>Release:        pkgsrc-2022Q4
>Organization:
>Environment:
NetBSD aurinko 10.99.2 NetBSD 10.99.2 (GENERIC) #0: Tue Mar 14 02:29:01 MSK 2023  uwe@sampo:/home/uwe/work/netbsd/cvs/src/sys/arch/sparc/compile/GENERIC sparc

>Description:
cmake built on NetBSD/sparc picks up wrong ps(1) invocation.

Trying to run cmake on self (the language) I get:

...
-- Preparing for NetBSD on sparc
ps: unknown option -- f
usage:  ps [-AaCcdehjlmrSsTuvwx] [-G group] [-k key] [-M core] [-N system]
           [-O fmt] [-o fmt] [-p pid] [-t tty] [-U user] [-W swap]
        ps -L

The problem is in Source/kwsys/ProcessUNIX.c:2485 where
KWSYSPE_PS_COMMAND macro is defined.

There is no case that handles NetBSD, so a case further down the #if
tree is picked up (b/c of __sparc).

>How-To-Repeat:
Build cmake on sparc.  I don't know anything about cmake.
Get a copy of https://github.com/nbuwe/self/tree/feature/netbsd-macppc
and do e.g.

  $ cmake -B build -DCMAKE_BUILD_TYPE=Debug .

>Fix:
Explicitly handle NetBSD in that #if

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/57272: devel/cmake: incorrect ps(1) command selected on sparc
Date: Wed, 15 Mar 2023 23:06:30 +0100

 On Wed, Mar 15, 2023 at 10:00:01PM +0000, Valeriy E. Ushakov wrote:
 > >Number:         57272
 > >Category:       pkg
 > >Synopsis:       devel/cmake: incorrect ps(1) command selected on sparc

 Can you please report this upstream?
  Thomas

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/57272: devel/cmake: incorrect ps(1) command selected on sparc
Date: Thu, 16 Mar 2023 02:41:20 +0300

 On Wed, Mar 15, 2023 at 22:10:01 +0000, Thomas Klausner wrote:

 > Can you please report this upstream?

 I'd prefer the package maintener to come up with the right fix.  I
 have zero clue abouit cmake, so I'm don't know if adding NetBSD to the
 same branch as FreeBSD is enough.

 -uwe

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/57272: devel/cmake: incorrect ps(1) command selected on sparc
Date: Thu, 16 Mar 2023 07:53:11 +0100

 On Wed, Mar 15, 2023 at 11:45:01PM +0000, Valeriy E. Ushakov wrote:
 >  On Wed, Mar 15, 2023 at 22:10:01 +0000, Thomas Klausner wrote:
 >  
 >  > Can you please report this upstream?
 >  
 >  I'd prefer the package maintener to come up with the right fix.  I
 >  have zero clue abouit cmake, so I'm don't know if adding NetBSD to the
 >  same branch as FreeBSD is enough.

 The package maintainer is pkgsrc-users, so the chances of this
 happening are quite low.

 If you report this upstream, upstream see they have NetBSD users, and
 you can test the patches they come up with yourself - I'm not sure how
 many other people use cmake on sparc.
  Thomas

From: Niclas Rosenvik <nros@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/57272: devel/cmake: incorrect ps(1) command selected on
 sparc
Date: Wed, 17 May 2023 12:03:24 +0200

 Here is my analysis on this problem:
 KWSYSPE_PS_COMMAND is used to recursively
 kill the children of a process, as can be
 seen in the function kwsysProcessKill in
 Source/kwsys/ProcessUNIX.c .
 CMake on NetBSD does not try to kill the
 children of a process since CMake does
 not define KWSYSPE_PS_COMMAND on NetBSD.
 So I think that this bug report has stumbled
 across a runtime bug in CMake when running
 on NetBSD.
 Regarding Valery:s question, "I'm don't know
 if adding NetBSD to the same branch as
 FreeBSD is enough". The output from
 "ps axo pid,ppid" is the same on FreeBSD as
 on NetBSD. So adding NetBSD to the same branch
 as FreeBSD should be safe.
 CMake problems have happend before with NetBSD
 and Sparc, see CMake issue 10362.
 OK to file an issue on the CMake issue tracker
 with uwe's fix? and apply it to pkgsrc?

From: "Niclas Rosenvik" <nros@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57272 CVS commit: pkgsrc/devel/cmake
Date: Sat, 30 Sep 2023 08:52:52 +0000

 Module Name:	pkgsrc
 Committed By:	nros
 Date:		Sat Sep 30 08:52:52 UTC 2023

 Modified Files:
 	pkgsrc/devel/cmake: distinfo
 Added Files:
 	pkgsrc/devel/cmake/patches: patch-Source_kwsys_ProcessUNIX.c

 Log Message:
 cmake: use the right ps command to get child process info on NetBSD

 CMake uses ps to pid get information on childs of a process
 to recursivly kill the childs. Not having KWSYSPE_PS_COMMAND
 set means that CMake won't try to kill the child processes.
 Not checking for the __NetBSD__ define also causes NetBSD
 Sparc to use the ps command for Solaris leading to run-time
 breaks, see PR pkg/57272.
 This change was suggested by Valry Ushakov on PR pkg/57272.


 To generate a diff of this commit:
 cvs rdiff -u -r1.220 -r1.221 pkgsrc/devel/cmake/distinfo
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/devel/cmake/patches/patch-Source_kwsys_ProcessUNIX.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.