Re: [PATCH] Makefile: Check for perl script errors with perl -c

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

 



On Sat, Apr 17, 2010 at 11:05:00AM -0600, Matthew Ogilvie wrote:

> Yes, "perl -cw"'s exit code is always good, but the standard error is
> needlessly noisy in the success case:
> 
>   $ perl -cw -e 'print "hi\n"'
>   -e syntax OK
>   $ echo $?
>   0

Ah, OK. I misunderstood what you were trying to do before.

> 1. Accept the noise output from make and perl.  If we are willing to
>    accept this, then a simpler and/or uncoditional patch would be fine.

Though I would prefer it silenced, I don't personally have a big problem
with this. I guess others might.

> 2. Filter out the "{scriptName} syntax OK" noise with grep (or sed),
>    but then $? is grep's status (not perl's), and you have to go
>    through contortions to properly test perl's status:
> 
>     2a. Use PIPESTATUS, but this is a non-portable bashism.
>         My current version of the patch elects to do this, but
>         leaves the check disabled to (hopefully) avoid portability
>         issues.  (A second advantage of leaving it disabled [or at
>         least disablable] is if someone is in a cross-compile
>         environment and the target perl path is different 
>         from the build perl path.)

Hmm. The cross-compilation thing is interesting, but I'm not sure it
even works now. We already are relying on generating perl.mak and using
it as part of our build, I think. I haven't looked closely at the perl
build stuff in git, though, so maybe there is a way to make it work.

>     2b. Use a portable technique that involves echoing the status
>         redirected to file descriptor 3, then pulling the status out
>         of file descriptor 3 outside the pipeline.  This is frankly
>         kind of complicated and hard to read.

Yeah, I have used that technique before, and it is unreadable. Maybe
simpler is to cheat with a tempfile:

  if ! perl -wc $@+ 2>$@.stderr; \
    then cat >&2 $@.stderr; rm -f $@.stderr; exit 1; \
    else rm -f $@.stderr; fi && \

but that is getting a bit unreadable, too. I dunno.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]