Re: [PATCH v2 3/4] bisect--helper: reimplement `bisect_run` shell function in C

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

 



Miriam Rubio <mirucam@xxxxxxxxx> writes:

> +static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
> +{
> ...
> +	while (1) {
> +		strvec_clear(&args);
> +
> +		printf(_("running %s"), command.buf);
> +		res = run_command_v_opt(run_args.v, RUN_USING_SHELL);
> +
> +		if (res < 0 && res >= 128) {

Sorry for not noticing this total nonsense during my earlier review,
but this condition will never trigger.

I would have noticed it if the style consistently used "order
quantities from left to right, as if on a number line" convention,
i.e.

		if (res < 0 && 128 <= res) {

Because there are only two valid range notation around a single
variable, which are:

    (res < 0 || 128 <= res) - meaning 'res' is outside a span, or
    (0 <= res && res < 128) - meaning 'res' is inside a span.

and the above rewriten form is neither, it would have stood out
as an error immediately.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux