[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [OSSTEST PATCH 04/11] mg-debug-fail: New utility script for debugging



On Mon, 2015-12-07 at 15:10 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [OSSTEST PATCH 04/11] mg-debug-fail: New
> utility script for debugging"):
> > On Fri, 2015-12-04 at 19:35 +0000, Ian Jackson wrote:
> > > diff --git a/mg-debug-fail b/mg-debug-fail
> > > new file mode 100755
> > > index 0000000..64fa235
> > > --- /dev/null
> > > +++ b/mg-debug-fail
> > > @@ -0,0 +1,13 @@
> > > +#!/bin/sh
> > > +#
> > > +# This script can be provided anywhere an executable or command name
> > > is
> > > +# wanted.ÂÂIt prints its arguments, and its stdin, to its stderr,
> > > and
> > > +# then exits nonzero.
> > > +#
> > > +# When using this it may be useful to provide </dev/null as a
> > > +# redirection for the whole program under test.ÂÂOtherwise things
> > > +# can mysteriously hang.
> > 
> > "egrep . - /dev/null" is too noisy, it adds a "(standard input):"
> > prefix
> > which I don't think you want. But "egrep -h . - /dev/null" seems to
> > remedy
> > this without the possibility of these mysterious hangs.
> 
> This is confusing to me.ÂÂThe problem is that mg-debug-fail does not
> know whether to try to read and print its stdin.ÂÂSometimes its stdin
> will be the stdin for some utility that it is standing in for, and
> should be dumped.ÂÂWhereas sometimes its stdin is the user's tty,
> which should be left alone.
> 
> This difficulty is fixed in the next patch.ÂÂNone of your suggestions
> seem to address it.ÂÂWhat problem do you think they are solving ?

I think I got off on a bit of a tangent, and hadn't seen the next patch
yet.

> > Also, what does egrep give us here over just cat?
> 
> I meant to writeÂÂÂegrep ''
> and its advantage is that it sanitises missing trailing newline.
> 
> But maybe we want to preserve missing trailing newline.

I don't think so, I just didn't know about that behaviour of egrep, it
sounds useful.

> 
> An alternative to replace the egrep would be
> ÂÂÂsed 's/^/mg-debug-fail-stdin: /' >&2
> which preserves missing trailing newline but annotates the output.
> 
> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.