On Wed, Nov 02, 2022 at 02:15:45PM +0100, Laszlo Ersek wrote:
On 11/01/22 20:56, Eric Blake wrote:
> Make it possible for the sh and eval plugins to disconnect a client or
> shut down the entire nbdkit server by use of special return values.
> Prior to this patch we had reserved 4-7 for future use; this defines
> 4-6, and extends the set of reserved return values to 7-15. We figure
> it is unlikely that anyone is using status 8-15 with the intent that
> it behaves identically to status 1.
>
> For the testsuite, I only covered the eval plugin; but since it shares
> common code with the sh plugin, both styles should work.
> ---
>
> Finally got the testsuite additions for this in a state that I like.
>
> plugins/sh/nbdkit-sh-plugin.pod | 37 ++++++-
> tests/Makefile.am | 2 +
> plugins/sh/call.h | 9 +-
> plugins/sh/call.c | 85 +++++++--------
> tests/test-eval-disconnect.sh | 185 ++++++++++++++++++++++++++++++++
> 5 files changed, 268 insertions(+), 50 deletions(-)
> create mode 100755 tests/test-eval-disconnect.sh
>
> diff --git a/plugins/sh/nbdkit-sh-plugin.pod b/plugins/sh/nbdkit-sh-plugin.pod
> index 2a55fdc9..37139e1b 100644
> --- a/plugins/sh/nbdkit-sh-plugin.pod
> +++ b/plugins/sh/nbdkit-sh-plugin.pod
> @@ -96,4 +96,4 @@ The script should exit with specific exit codes:
>
> The method was executed successfully.
>
> -=item 1 and 8-127
> +=item 1 and 16-255
>
> There was an error. The script may print on stderr an errno name,
> optionally followed by whitespace and a message, for example:
> @@ -123,9 +123,38 @@ The requested method is not supported by the script.
>
> For methods which return booleans, this code indicates false.
>
> -=item 4, 5, 6, 7
> +=item S<4>
The S<> notation seems new here (so it's going to be inconsistent with
the rest of this file, I think).
I was going to mention this too. The S<> notation is used to insert
non-breaking spaces (for output formats that support it) in a span of
text so that it won't be folded over multiple lines. AFAIK it
shouldn't have any effect here.
For some reason this existing list uses:
=item S<0>
but I think that must be a mistake.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top