NetBSD Problem Report #59981
From www@netbsd.org Sun Feb 8 04:43:39 2026
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)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 67C9F1A923D
for <gnats-bugs@gnats.NetBSD.org>; Sun, 8 Feb 2026 04:43:39 +0000 (UTC)
Message-Id: <20260208044338.889281A923E@mollari.NetBSD.org>
Date: Sun, 8 Feb 2026 04:43:38 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: xentools418 rc.d/xencommons: test: -z: unexpected operator
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 59981
>Category: pkg
>Synopsis: xentools418 rc.d/xencommons: test: -z: unexpected operator
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bouyer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 08 04:45:00 +0000 2026
>Last-Modified: Sat Mar 07 11:00:01 +0000 2026
>Originator: Taylor R Campbell
>Release:
>Organization:
>Environment:
>Description:
# service xencommons status
test: -z: unexpected operator
xenstored is running as pid 1090.
xenconsoled is not running.
Arises from these conditionals -- first one is fine, second one is not:
if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
then
echo "xencommons are running as pids $pids."
return 0
fi
if test -a -z "$xenconsoled_pid" -a -z "$xenstored_pid";
then
echo "xencommons are not running."
return 0
fi
>How-To-Repeat:
service xencommons status
>Fix:
change `test -a -z ...' to `test -z ...'
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->bouyer
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Sun, 08 Feb 2026 06:37:07 +0000
Responsible-Changed-Why:
over to maintainer
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org, pkgsrc-bugs@netbsd.org
Cc:
Subject: Re: pkg/59981: xentools418 rc.d/xencommons: test: -z: unexpected operator
Date: Mon, 09 Feb 2026 01:41:27 +0700
Date: Sun, 8 Feb 2026 04:45:00 +0000 (UTC)
From: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
Message-ID: <20260208044500.AC11B1A923F@mollari.NetBSD.org>
| Arises from these conditionals -- first one is fine, second one is not:
|
| if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
That's not fine, it just happens to work (currently), it should be
if test -n "$xenconsoled_pid" && test -n "$xenstored_pid"
(the "-n" operators can be omitted if desired).
| if test -a -z "$xenconsoled_pid" -a -z "$xenstored_pid";
That one should probably (given what I see of the context) be
if test -z "$xenconsoled_pid" || test -z "$xenstored_pid"
since it seems to be attempting to be the inverse of the first one
(ie: xencommons are running if both vars are set, and isn't otherwise.
that is, if either is not set.)
The second one could also be written
if test -z "$xenconsoled_pid$xenstored_pid"
but that's obscure, and saves nothing worth saving, so don't go that way.
However that whole second if test (and the "fi" which precedes it, and
the "then" which follows) might just be able to be replaced by "else",
if what is in the PR is exactly as it is in the sources. If that can be
done, it would certainly be better.
kre
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, campbell+netbsd@mumble.net
Subject: Re: pkg/59981: xentools418 rc.d/xencommons: test: -z: unexpected
operator
Date: Sat, 7 Mar 2026 11:58:00 +0100
On Sun, Feb 08, 2026 at 06:45:01PM +0000, Robert Elz via gnats wrote:
> The following reply was made to PR pkg/59981; it has been noted by GNATS.
>
> From: Robert Elz <kre@munnari.OZ.AU>
> To: gnats-bugs@netbsd.org, pkgsrc-bugs@netbsd.org
> Cc:
> Subject: Re: pkg/59981: xentools418 rc.d/xencommons: test: -z: unexpected operator
> Date: Mon, 09 Feb 2026 01:41:27 +0700
>
> Date: Sun, 8 Feb 2026 04:45:00 +0000 (UTC)
> From: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
> Message-ID: <20260208044500.AC11B1A923F@mollari.NetBSD.org>
>
> | Arises from these conditionals -- first one is fine, second one is not:
> |
> | if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
>
> That's not fine, it just happens to work (currently), it should be
>
> if test -n "$xenconsoled_pid" && test -n "$xenstored_pid"
Why ? the man page for test(1) show -a being a valid option
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.