pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/59981: xentools418 rc.d/xencommons: test: -z: unexpected operator
The following reply was made to PR pkg/59981; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost
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@localhost via gnats" <gnats-admin%NetBSD.org@localhost>
Message-ID: <20260208044500.AC11B1A923F%mollari.NetBSD.org@localhost>
| 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
Home |
Main Index |
Thread Index |
Old Index