bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

View: New views
6 Messages — Rating Filter:   Alert me  

bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here we have one of the extremely rare CGI::Application bug reports.

Someone has modified a CGI.pm global, which is why the tests are
failing.

I have some inclination to consider this "not our bug". For someone who
has modified these globals, it may in fact be useful feedback to know to
that CGI::Application behaves different than usual in that case, and
thus it's appropriate for the tests to fail.


Alternatively, we could force lots of CGI.pm globals back to their
default state in state in the test suite.

Thoughts?

   Mark



From: "Todd Sherman via RT" <bug-CGI-Application@...>
To: undisclosed-recipients:;
Subject: [rt.cpan.org #37435] 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified
Date: Sat, 05 Jul 2008 07:36:27 -0400
Reply-To: bug-CGI-Application@...

Sat Jul 05 07:36:25 2008: Request 37435 was acted upon.
Transaction: Ticket created by Spathiphyllum
       Queue: CGI-Application
     Subject: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified
   Broken in: 4.07_03, 4.10
    Severity: Important
       Owner: Nobody
  Requestors: ts@...
      Status: new
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=37435 >


Hi.

A generic failure occurs when 'make test' is performed. Three tests fail:

t/basic.....................1/110
#   Failed test 'base class response (header match)'
#   at t/basic.t line 26.
.
.<HTML output snippage>
.
#     doesn't match '(?-xism:^Content-Type: text/html)'
Use of uninitialized value in pattern match (m//) at t/basic.t line 27.
#   Failed test 'base class response (body match)'
#   at t/basic.t line 27.
#                   undef
#     doesn't match '(?-xism:Query Environment:)'
# Looks like you failed 2 tests of 110.
t/basic..................... Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/110 subtests
.
.
.
t/header_props..............1/6
#   Failed test 'headed added via hashref arg to header_add'
#   at t/header_props.t line 59.
.
.<HTML output snippage>
.
#     doesn't match '(?mi-xs:^Expires: )'
# Looks like you failed 1 test of 6.
t/header_props.............. Dubious, test returned 1 (wstat 256, 0x100)
 Failed 1/6 subtests
.
.

The server information follows though the issue, as noted, is generic:

Distribution: CGI-Application-4.10 and lower until -4.06
Perl: 5.8.x
OS: Linux 2.6.9-67.0.15.ELsmp

It would appear that if one changes a particular global setting in
CGI.pm that the headers generated by the CGI-Application test suite,
specifically 't/basic.t' and 't/header_props.t', either are not produced
or do not match what the test expects during a regex check.

If HTTP headers are configured as '$HEADERS_ONCE = 1;' under the
subroutine 'initialize_globals', then the 'make test' for
CGI-Application fails. If HTTP headers are configured as '$HEADERS_ONCE
= 0;', which is the default CGI.pm setting upon CGI install, then the
CGI-Application install succeeds. Default installs of CGI.pm will not
introduce this bug, so most users will not experience this 'make' error
when CGI-Application is subsequently installed. However, for those who
have modified CGI.pm's globals, this workaround will help one to add
CGI-Application to their module repository.

I hope this helps and thanks for maintaining CGI-Application.

TS



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Lesley Binks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/7/7 Mark Stosberg <mark@...>:

> Here we have one of the extremely rare CGI::Application bug reports.
>
> Someone has modified a CGI.pm global, which is why the tests are
> failing.
>
> I have some inclination to consider this "not our bug". For someone who
> has modified these globals, it may in fact be useful feedback to know to
> that CGI::Application behaves different than usual in that case, and
> thus it's appropriate for the tests to fail.
>
>
> Alternatively, we could force lots of CGI.pm globals back to their
> default state in state in the test suite.

How much work would there be in making the test suite robust against
such local changes?

<snip>

Regards

L.

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Rhesa Rozendaal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Stosberg wrote:
> Here we have one of the extremely rare CGI::Application bug reports.
>
> Someone has modified a CGI.pm global, which is why the tests are
> failing.

I find it almost bizarre that that's actually suggested in the CGI.pm docs. It
sounds like a very bad practice to me, especially since CGI provides an import
pragma for almost all of those globals.

Note that the only two explicitly documented package variables are $POST_MAX
and $DISABLE_UPLOADS, which are probably irrelevant to the test suite.

> I have some inclination to consider this "not our bug". For someone who
> has modified these globals, it may in fact be useful feedback to know to
> that CGI::Application behaves different than usual in that case, and
> thus it's appropriate for the tests to fail.

I'd be inclined to say that as well. You really can't account for all the
possible things that could happen when people hack CPAN modules. It's hard
enough to keep track of all the different official versions as it is.

> Alternatively, we could force lots of CGI.pm globals back to their
> default state in state in the test suite.

That would be a maintenance hazard.

I'd probably opt for recommending against hacking up CPAN modules, and to use
the documented ways of customizing behavior. Altering package globals is a
great way to produce unwanted action at a distance, and we all know how evil
that is.

In this case, the reporter could have opted for

   use CGI qw/ -unique_headers /;

Rhesa

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Ron Savage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rhesa

> > Alternatively, we could force lots of CGI.pm globals back to their
> > default state in state in the test suite.
>
> That would be a maintenance hazard.
>
> I'd probably opt for recommending against hacking up CPAN modules, and to use
> the documented ways of customizing behavior. Altering package globals is a
> great way to produce unwanted action at a distance, and we all know how evil
> that is.

It gets worse. What about people who have deliberately changed globals,
and whose code would start to fail if you unilaterally forced those
globals back to some (alleged) default value under certain conditions.

So, nope, not our problem.

--
Ron Savage
ron@...
http://savage.net.au/index.html



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Mark Stosberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> So, nope, not our problem.

Thanks for the feedback. I went ahead and rejected the bug.

Just the other day I spent hours tracking down a bug that was due to
$CGI::DISABLE_UPLOADS being set in some other module that I had loaded.

"Huh, suddenly it's like file uploads have silently been disabled..."

    Mark

--
http://mark.stosberg.com/




#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: Re: bug report: 'make test' fails when $HEADERS_ONCE of CGI.pm globals modified

by Cees Hek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 8, 2008 at 11:05 AM, Mark Stosberg <mark@...> wrote:
>
>> So, nope, not our problem.
>
> Thanks for the feedback. I went ahead and rejected the bug.

I agree that it isn't really the responsibility of CGI::Application to
account for these problems.  But since this has caused a user some
problems, I think it makes sense to put something in the test suite
that at least notifies the user that their setup will not work
properly with CGI::Application or at least it will not work properly
with the test suite.

I would leave the existing test as is so they do fail in this
situation, but add an extra test that checks for the value of
$CGI::HEADERS_ONCE, and if it is set, fail the test and display a
warning message about why this could be an issue.

We could check for $CGI::HEADERS_ONCE and skip the problem tests, but
I think that would hide the underlying problem and potentially cause
more issues for the user.

Cheers,

Cees

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################