Reputation: 21319
I'm currently running perl -c filename
to figure out whether the syntax of a file is alright. If it is, we can commit it to the VCS.
Now, some of the scripts to be checked have setuid
bits set and this is perfectly alright. According to perldiag
this is why I get the warning:
Args must match #! line at /home/user/filename line 1.
How can I suppress the warning for a single run of perl -c
? The script has to be invoked with variable parameters, so I want to do a syntax check ignoring this issue - which is no real issue in the context.
Here's the reason I want to get rid of my filter script: it needs to literally count the output lines and then adjust the exit code depending on the count of relevant lines. This is fairly tedious.
Some more details. Turns out the "warning" is actually an error to perl -c
as can be seen in perldoc perldiag
:
(F) A fatal error (trappable).
[...]
Args must match #! line
(F) The setuid emulator requires that the arguments Perl was invoked with
match the arguments specified on the #! line. Since some systems impose a
one-argument limit on the #! line, try combining switches; for example,
turn -w -U into -wU.
Please note this is a fairly old system (Red Hat Linux release 7.3 (Valhalla)
) and a fairly old Perl (Summary of my perl5 (revision 5.0 version 6 subversion 1)
...)
Seems this error was deprecated in newer Perl versions. I'll attempt to update the Perl version to see whether this is a feasible workaround.
Upvotes: 2
Views: 595
Reputation: 9500
How about directing the output of perl -c
through a filter that throws away the warnings you are not interested in (it finds these by regex). Then, if you have any warning or error output left, you cannot commit to VCS. If no such output left, commit to VCS.
Upvotes: 4