www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Vierling ...@pobox.com>
Subject mod_so/5421: apxs fails due to unparsed -Wl arguments
Date Sun, 05 Dec 1999 17:31:06 GMT

>Number:         5421
>Category:       mod_so
>Synopsis:       apxs fails due to unparsed -Wl arguments
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sun Dec  5 09:40:00 PST 1999
>Originator:     tv@pobox.com
>Release:        1.3.9
NetBSD, all versions, all gcc-derived compilers
As stated (probably not completely enough) in PR #4294, apxs is failing on some
OS's because it is not parsing arguments correctly.

apxs uses an extension of perl's "Getopts" routine to parse command line
arguments.  Around line 380, apxs tries to reformat -Wl options for the linker,
if it is not "gcc" (which IMHO may not be appropriate either; shouldn't it
check to see if it equals $CFG_CC _and_ $CFG_CC is a gcc-derived compiler?).

The "foreach" here:

    foreach $opt_Wl (@opt_W) {
                if($CFG_LD_SHLIB ne "gcc") {
                $opt .= " $1" if ($opt_Wl =~ m|^\s*l,(.*)$|);    
                } else {
                $opt .= " -W$opt_Wl";

is never executed, because "Getopts" stops parsing on the first command line
argument not beginning with a dash (-).  However, -L, -l, and -Wl options are
typically placed at the _end_ of the command line, after the object file names.

Insert a "print STDERR $cmd" debug line just before the "foreach" and this
problem should be quite obvious.
Run on an OS such as NetBSD, or temporarily change CFG_LD_SHLIB to something
different from "gcc" ("echo" will suffice).  Then add a random -Wl,-foo option
after non-dash arguments and note that it isn't transformed into -foo.
Fix the included "Getopts" to parse options specified after non-option
arguments.  Remember, too, that many compilers accept options specified
at random places on the command line.
[In order for any reply to be added to the PR database, you need]
[to include <apbugs@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message