All of lore.kernel.org
 help / color / mirror / Atom feed
* [OSSTEST PATCH 0/4] Use ^ for negation, not !
@ 2018-05-03 14:58 Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 1/4] mg-allocate: Use ^ for deallocation, " Ian Jackson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ian Jackson @ 2018-05-03 14:58 UTC (permalink / raw)
  To: xen-devel

People keep having trouble with the ! syntax for negation, because of
the !-history feature in some shells (notably, enabled by default in
bash in all distros).

The result is that attempts to deallocate hosts, or do some other
things, produces an incomprensible "event not found" message.

I don't suffer from this because I have it turned off, with set -H.
IMO it should be off by default.  (This is Debian #897422.)

Avoid this whole problem by using ^ everywhere we previously used !
for negation.  (We continue to honour !.)

Places where ! is still the necessary syntactic character to do
something in osstest are:

 * In the ms-queuedaemon protocol, ! is used to indicate an
   unsolicited response.

 * In sg-run-job, ! in an IFFAIL means to run a step even if
   the job has failed or is being truncated.

These go nowhere near a shell and are not, conceptually, negation.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OSSTEST PATCH 1/4] mg-allocate: Use ^ for deallocation, not !
  2018-05-03 14:58 [OSSTEST PATCH 0/4] Use ^ for negation, not ! Ian Jackson
@ 2018-05-03 14:58 ` Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 2/4] mg-hosts: Use ^ for flag negation, " Ian Jackson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2018-05-03 14:58 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

! is annoying because some shells enable !-history expantion by
default even though few users have any idea about it.  In general users
are confused by the error message and do not know what to do next.

We still honour ! for the benefit of old wrapper scripts, finger
macros, etc.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 README.dev              | 4 ++--
 mg-allocate             | 8 ++++----
 mg-schema-test-database | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README.dev b/README.dev
index 95fc66c..5787bd8 100644
--- a/README.dev
+++ b/README.dev
@@ -13,10 +13,10 @@ e.g.
 $ ./mg-hosts manual-task-create ianc@kazak
 
 Borrow, estimating 1 day duration (for the planner):
-$ ./mg-allocate -U 1d marilith-n5 
+$ ./mg-allocate -U 1d marilith-n5
 
 Return (not automatic, even with an estimate given):
-$ ./mg-allocate \!marilith-n5 
+$ ./mg-allocate ^marilith-n5
 
 Removing machines for servicing/outage
 ======================================
diff --git a/mg-allocate b/mg-allocate
index c30dd15..087b14b 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -5,11 +5,11 @@
 #  ./mg-allocate [-l] [-l] [-l]
 #
 # <resource-spec> syntax:
-#   [!][<type>/]<name>[/<share>]      type defaults to 'host'
+#   [^][<type>/]<name>[/<share>]      type defaults to 'host'
 #                                     type=='S' means 'shared-host'
 #                                     type=='F' means 'shared-flight'
 #                                     share defaults to *
-#                                     "!" prefix means deallocate
+#                                     "^" prefix (or "!") means deallocate
 #                                     name=option|option|... means
 #                                       any one of those options
 #                                     option={flag,flag...} means anything
@@ -38,7 +38,7 @@
 #                  be owned by the current task (or perhaps by a task
 #                  named in --steal).
 #
-#                  Not compatible with the !<resource> deallocation
+#                  Not compatible with the ^<resource> deallocation
 #                  syntax: donation implies deallocation, in a sense.
 #
 #   --steal <task-spec>
@@ -125,7 +125,7 @@ END
 sub parse_1res ($) {
     my ($res) = @_;
 
-    $res =~ m,^(\!?) (?: ([^/]+)/ )? ([^/]+) (?: /(\d+|\*) )?$,x
+    $res =~ m,^([!^]?) (?: ([^/]+)/ )? ([^/]+) (?: /(\d+|\*) )?$,x
         or die "bad resource $res ?";
     my $allocate= !$1;
     my $restype= defined($2) ? $2 : 'host';
diff --git a/mg-schema-test-database b/mg-schema-test-database
index 641aadb..6aeedd1 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -71,7 +71,7 @@
 #    ./mg-schema-test-database drop [_SUFFIX]
 #   This will throw away all of the information in the test DB.
 #
-#  5. OSSTEST_TASK=iwj@testing ./mg-allocate !a-host
+#  5. OSSTEST_TASK=iwj@testing ./mg-allocate ^a-host
 #   Hosts that were marked in the main DB as borrowed, are returned by
 #   mg-schema-test-database to the main DB task that previously owned
 #   them, but not freed.  So you need to explicitly free them.
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [OSSTEST PATCH 2/4] mg-hosts: Use ^ for flag negation, not !
  2018-05-03 14:58 [OSSTEST PATCH 0/4] Use ^ for negation, not ! Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 1/4] mg-allocate: Use ^ for deallocation, " Ian Jackson
@ 2018-05-03 14:58 ` Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 3/4] mg-adjust-flight-makexrefs: Use ^ for excluding jobs, " Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 4/4] Standalone HostFlags: Use ^ for negation, " Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2018-05-03 14:58 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

We still honour (and document) !

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 README.dev |  2 +-
 mg-hosts   | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/README.dev b/README.dev
index 5787bd8..ddfac30 100644
--- a/README.dev
+++ b/README.dev
@@ -145,7 +145,7 @@ Bless
 Once machines are ready for production use remove the commission
 blessing and add the production ones, e.g.
 
- $ ./mg-hosts setflags mudcake{0,1} -- \!blessed-commission blessed-{real,play,adhoc}
+ $ ./mg-hosts setflags mudcake{0,1} -- ^blessed-commission blessed-{real,play,adhoc}
 
 
 Shutting down the whole system
diff --git a/mg-hosts b/mg-hosts
index 9ac1990..5361eb6 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -70,9 +70,9 @@
 #  ./mg-hosts showflags
 #               Print a table showing the flags of all hosts.
 #
-#  ./mg-hosts setflags HOSTGLOB... -|-- !FLAG|-FLAG|FLAG...
-#               Updates some flags of the specified hosts.  !FLAG and
-#               -FLAG both clear the flag; FLAG sets it.
+#  ./mg-hosts setflags HOSTGLOB... -|-- ^FLAG|FLAG...
+#               Updates some flags of the specified hosts.  ^FLAG
+#               (or -FLAG or !FLAG) clears the flag; FLAG sets it.
 #
 #  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
 #               Sets or clears some flags of the specified hosts,
@@ -84,8 +84,9 @@
 #               decreasing order of precedence):
 #                   FLAG         true iff FLAG is set for the host
 #                   (EXPR)       override precedence
-#                   !EXPR        boolean negation } alternative
-#                   ~EXPR        boolean negation }  equivalent syntax
+#                   ^EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent
+#                   !EXPR        boolean negation }  syntax
 #                   EXPR&EXPR    boolean "and"
 #                   EXPR|EXPR    boolean inclusive-or
 #               Spaces and tabs are disregarded (outside FLAG names).
@@ -428,8 +429,8 @@ sub cmd_setflags () {
 	die unless @$section;
 	foreach my $flagorig (@$section) {
 	    my $flag = $flagorig;
-	    # each flag may start with - or ! to remove
-            my $remove= $flag =~ s/^[-!]//;
+	    # each flag may start with ^ (or - or !) to remove
+            my $remove= $flag =~ s/^[-!^]//;
 	    setflagval($dst,$flag,!$remove);
         }
     });
@@ -443,14 +444,14 @@ END
 	my ($dst,$section) = @_;
 	die unless @$section == 2;
 	my ($dstflag, $expr) = @$section;
-	die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~ \t]/;
+	die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~ \t^]/;
 
 	my %inputs;
 	$expr =~ s{[-0-9a-z_]+}{
                 $inputs{$&} = undef;
                 " \$inputs{'$&'} ";
             }ge;
-	$expr =~ s/\~/!/g;
+	$expr =~ s/[~^]/!/g;
 	$expr =~ s/[&|]/$&$&/g;
 
 	foreach my $flagorig (sort keys %inputs) {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [OSSTEST PATCH 3/4] mg-adjust-flight-makexrefs: Use ^ for excluding jobs, not !
  2018-05-03 14:58 [OSSTEST PATCH 0/4] Use ^ for negation, not ! Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 1/4] mg-allocate: Use ^ for deallocation, " Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 2/4] mg-hosts: Use ^ for flag negation, " Ian Jackson
@ 2018-05-03 14:58 ` Ian Jackson
  2018-05-03 14:58 ` [OSSTEST PATCH 4/4] Standalone HostFlags: Use ^ for negation, " Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2018-05-03 14:58 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

The ! here doesn't cause shell rune trouble in practice very much, but
we want to move to using ^ everywhere for consistency.

We still honour !.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 cr-daily-branch            | 2 +-
 mg-adjust-flight-makexrefs | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cr-daily-branch b/cr-daily-branch
index 14e8595..a06d5a4 100755
--- a/cr-daily-branch
+++ b/cr-daily-branch
@@ -343,7 +343,7 @@ xen-unstable-smoke)
 	: ${SMOKE_HARNESS_REV:=$harness_rev}
 
 	./mg-adjust-flight-makexrefs -v $flight \
-		'!build-*-xsm !build-*-libvirt build-*-*' \
+		'^build-*-xsm ^build-*-libvirt build-*-*' \
 		--debug --blessings=real				\
 		--branch=xen-unstable,xen-unstable-smoke,osstest	\
 		--revision-osstest=$SMOKE_HARNESS_REV
diff --git a/mg-adjust-flight-makexrefs b/mg-adjust-flight-makexrefs
index 3e02ef3..16a0d98 100755
--- a/mg-adjust-flight-makexrefs
+++ b/mg-adjust-flight-makexrefs
@@ -1,15 +1,16 @@
 #!/bin/bash
 #
 # usage: ./mg-adjust-flight-makexrefs [OPTIONS..] FLIGHT	\
-#		'[!]JOB-GLOB ...'		  		\
+#		'[^]JOB-GLOB ...'		  		\
 #		REF-CONDS...
 #
 # JOB-GLOB is as for shell `case'.  Sense of first match is used.
 # If no match for a job, uses reverse of sense of last glob.
 #
-# ! means keep such jobs in FLIGHT.  Without ! means delete each such
+# ^ means keep such jobs in FLIGHT.  Without ^ means delete each such
 # job from FLIGHT and replace intra-flight references to it with
 # references to the same job in a suitable other flight.
+# (! may be used instead of ^.)
 #
 # `Suitable' means one in which the required job passed, subject to
 # REF-CONDS (which are passed to sg-check-tested).  REF-CONDS really
@@ -59,7 +60,7 @@ for j in `./cs-adjust-flight $flight jobs-list '^build-'`; do
 
 	for glob in $keepjobs; do
 		case "$glob" in
-		!*) ifmatch=$tokeep; action=$todelete ; glob="${glob#!}" ;;
+		[!^]*) ifmatch=$tokeep; action=$todelete ; glob="${glob#?}" ;;
 		*)  ifmatch=$todelete; action=$tokeep ;;
 		esac
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [OSSTEST PATCH 4/4] Standalone HostFlags: Use ^ for negation, not !
  2018-05-03 14:58 [OSSTEST PATCH 0/4] Use ^ for negation, not ! Ian Jackson
                   ` (2 preceding siblings ...)
  2018-05-03 14:58 ` [OSSTEST PATCH 3/4] mg-adjust-flight-makexrefs: Use ^ for excluding jobs, " Ian Jackson
@ 2018-05-03 14:58 ` Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2018-05-03 14:58 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

The ! here doesn't cause any shell rune trouble in, but we want to
move to using ^ everywhere for consistency.

We still honour ! to support old configs.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/HostDB/Static.pm | 2 +-
 README                   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Osstest/HostDB/Static.pm b/Osstest/HostDB/Static.pm
index 3191c56..ab9542d 100644
--- a/Osstest/HostDB/Static.pm
+++ b/Osstest/HostDB/Static.pm
@@ -56,7 +56,7 @@ sub get_flags ($$) { #method
 	return unless defined $str;
 	foreach my $fl (split /[ \t,;]+/, $str) {
 	    next unless length $fl;
-	    if ($fl =~ s/^\!//) {
+	    if ($fl =~ s/^[!^]//) {
 		delete $flags->{$fl};
 	    } else {
 		$flags->{$fl} = 1;
diff --git a/README b/README
index 9d97c61..7b7bc52 100644
--- a/README
+++ b/README
@@ -447,7 +447,7 @@ HostProp_<testbox>_NtpServer
 HostFlags_<testbox>
    Defines a set of flags for the host. Flags is a list separated by
    whitespace, comma or semi-colon. A flag can be unset by prepending
-   a !. Only used in standalone mode.
+   a ^ (or !). Only used in standalone mode.
 
 HostGroup_<testbox> <group>
    Defines a group of similar hosts of which <testbox> is a
@@ -488,7 +488,7 @@ TestHost
 HostProp_<property>
 HostProp_<host>_<property>
 HostFlags                flag,flag,flag,...
-HostFlags_<host>         flag,!flag,!flag,flag...
+HostFlags_<host>         flag,^flag,^flag,flag...
 
 HostProp_DhcpWatchMethod
    leases <format> <source>
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-03 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 14:58 [OSSTEST PATCH 0/4] Use ^ for negation, not ! Ian Jackson
2018-05-03 14:58 ` [OSSTEST PATCH 1/4] mg-allocate: Use ^ for deallocation, " Ian Jackson
2018-05-03 14:58 ` [OSSTEST PATCH 2/4] mg-hosts: Use ^ for flag negation, " Ian Jackson
2018-05-03 14:58 ` [OSSTEST PATCH 3/4] mg-adjust-flight-makexrefs: Use ^ for excluding jobs, " Ian Jackson
2018-05-03 14:58 ` [OSSTEST PATCH 4/4] Standalone HostFlags: Use ^ for negation, " Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.