On Thu, Dec 1, 2016 at 3:05 PM, Trevor Woerner <twoer...@gmail.com> wrote:
> I believe a recent change in the yocto-kernel-tools is causing some funny > issue I saw this morning on my overnight jenkins builds. > > commit 08463d684c1952e74c25344cddace4c3f24c739d > Date: Mon Oct 31 14:30:12 2016 -0400 > > scc: exit on error > > If there is an error in the processing of the input files, scc > should exit and inform the user. > > scc is executed on a combined/preprocessed file and as a result > it doesn't have the granularity to see each input file > individually. > > Rather than moving preprocessing into scc (from spp), we can > trap > the line number of the error and dump context around the line. > This > gives the user a pointer to the input file and the specific > line > that caused the problem. > > Signed-off-by: Bruce Ashfield <bruce.ashfi...@windriver.com> > > diff --git a/tools/scc b/tools/scc > index b6ab747..0294103 100755 > --- a/tools/scc > +++ b/tools/scc > @@ -238,18 +238,37 @@ process_file() > done > > unset PATH > - if [ -n "${verbose}" ]; then > - eval . $in $outfile_append > - else > - # hide stderr if we aren't verbose > - eval . $in $outfile_append 2> /dev/null > - fi > + ( > + set -e > + eval . $in $outfile_append > /tmp/scc-output 2>&1 > + ) > + ) > > - if [ $? -ne 0 ]; then > - echo "[ERROR]: processing of file $in failed" > - exit 1 > + if [ $? -ne 0 ]; then > + echo "[ERROR]: processing of file $in failed" > + cat /tmp/scc-output > + > + # look for common errors so we can point to the right > input file > + > + # 1) /tmp/tmp.gfN6WsbDHN: line 403: cat: No such file or > directory > + # "grep -oh" will only output what matches, which > gets us "line 404: .." > + # cut gets us the second field, which is the line > number > + line=$(cat /tmp/scc-output | grep -oh "line.*:" | cut -f2 > -d' ' | sed 's/://g') > + if [ -n "$line" ]; then > + let start_line=$line-20 > + let end_line=$line+10 > + if [ $start_line -lt 0 ]; then > + start_line=0 > + fi > + echo "" > + echo "Context around the error is:" > + echo "" > + sed -n -e "$start_line,$end_line p" -e "$end_line q" > $in | sed 's/^/ /' > + echo "" > + echo "See pre-processed file $in for more details" > fi > - ) > + exit 1 > + fi > > return 0 > } > > In order to catch errors, scc's output is being hardcoded to > /tmp/scc-output. > But on my box there are two users who perform builds: jenkins and myself. > When > the second person comes along to do a build it finds inadequate > permissions on > /tmp/scc-output. > > Is anyone else seeing this? > Gah, that's my bad. I'm currently in transit for a trip to Europe, but I'll fix this to use mktmp and friends tomorrow and send out a patch. Bruce > -- > _______________________________________________ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto > -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
-- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto