Re: automated warning notifications

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

 



On Fri, Jun 15, 2012 at 10:34 PM, Fengguang Wu <wfg@xxxxxxxxxxxxxxx> wrote:
> On Fri, Jun 15, 2012 at 02:19:14PM +0300, Dan Carpenter wrote:
>>
>> Probably we could use something like the attached script to print
>> out the line of code which causes the bug and some other script to
>> querry git blame and attach the offending commit?
>
> cat -n $code_file | tail -n +$(($lineno - (($context + 1) / 2))) | head -n $(($context + 1))
>
> That's handy, I'll use it to show the source file context for the
> first error/warning :-)

Well, you can use sed/awk, it will be much shorter:

cat -n drivers/leds/led-triggers.c | sed -ne '224,230p'
   224			struct led_classdev *led_cdev;
   225	
   226			led_cdev = list_entry(entry, struct led_classdev, trig_list);
   227			led_set_brightness(led_cdev, brightness);
   228		}
   229		read_unlock(&trigger->leddev_list_lock);
   230	}

(replace the hard-coded "224,230" with a shell variable)

And if you want to find the offending commit:

git show `git blame drivers/leds/led-triggers.c | awk 'NR==227{print $1}'`
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux