From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH OSSTEST v1 5/5] mg-show-flight-runvars: recurse on buildjobs upon request
Date: Mon, 1 Feb 2016 16:16:50 +0000 [thread overview]
Message-ID: <1454343410.28781.112.camel@citrix.com> (raw)
In-Reply-To: <22191.30595.799006.97101@mariner.uk.xensource.com>
On Mon, 2016-02-01 at 15:19 +0000, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v1 5/5] mg-show-flight-runvars:
> recurse on buildjobs upon request"):
> > By looping over @rows looking for buildjobs runvars and adding those
> > jobs to the output until nothing changes.
> ...
> > Note that synth runvars (if requests) are now sorted in with the
> > regular ones, whereas previously they were listed last. Retaining the
> > old behaviour would be too complex I feel.
>
> ...
> > -sub collect ($) {
> > - my ($flight) = @_;
> > + $jobcond //= "TRUE";
> ...
> > my $q = $dbh_tests->prepare
> > ("SELECT synth, ".(join ',', @cols)." $qfrom ORDER BY synth,
> > name, job");
>
> You probably want to drop the `synth' from the ORDER here, even if you
> take my suggestion below. The sort is still a good idea here because
> it ensures that the output is deterministic.
OK
> > + my ($oflight, $ojob) = flight_otherjob($tflight, $row->[2]);
> > + collect($oflight, "job = '$ojob'");
>
> SQL injection vulnerability, I think. (There are lots of places
> where jobs are treated this way, but they come from the command line
> or similar, or have been checked against some regexp.)
>
> I think you should use the $jobcond @jobcondparams pattern.
Indeed. Fixed.
> -foreach my $row (@rows) {
> > +# Sort by runvar name, then (flight+)job.
> > +foreach my $row (sort { $a->[1] cmp $b->[1]//$a->[0] cmp $b->[1] }
> > @rows) {
>
> If you retain it this way, put spaces round your //.
>
> But maybe you should use a Schwartzian transform instead.
>
> my $xform = sub { [ ($->[1] =~ m/\~$/)." $_->[1] $_->[0]", $_ ]; };
> foreach my $row (map { $_->[1] } sort { $xform->($a) cmp
> $xform->($b) etc.
ITIYM:
foreach my $row (map { $_->[1] }
sort { $a->[0] cmp $b->[0] }
map { $xform->($_) }
@rows) {
...
}
Since doing the xform-> in the sort defeats the purpose (or I don't
properly understand the Schwartzian transform)
> This makes the synth sorting easy too.
Right.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-02-01 16:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 14:28 [PATCH OSSTEST v1 0/5] mg-show-flight-runvars: recursively follow buildjob runvars Ian Campbell
2016-02-01 14:28 ` [PATCH OSSTEST v1 1/5] mg-show-flight-runvars: collect rows into @rows, output in second step Ian Campbell
2016-02-01 14:42 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 2/5] mg-show-flight-runvars: move collection into a sub Ian Campbell
2016-02-01 14:55 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 3/5] mg-show-flight-runvars: calculate @colsw from @rows not via SQL Ian Campbell
2016-02-01 14:56 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 4/5] mg-show-flight-runvars: include $flight. prefix on job name if -r (recurse) Ian Campbell
2016-02-01 15:19 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 5/5] mg-show-flight-runvars: recurse on buildjobs upon request Ian Campbell
2016-02-01 15:19 ` Ian Jackson
2016-02-01 16:16 ` Ian Campbell [this message]
2016-02-01 16:53 ` Ian Jackson
2016-02-03 9:48 ` [PATCH OSSTEST 5/5 v2] " Ian Campbell
2016-02-03 12:01 ` Ian Jackson
2016-02-03 12:37 ` [PATCH OSSTEST 5/5 v3] " Ian Campbell
2016-02-08 16:12 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454343410.28781.112.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).