[Bug 59299] New: mod_macro syntax clash

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 59299] New: mod_macro syntax clash

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

            Bug ID: 59299
           Summary: mod_macro syntax clash
           Product: Apache httpd-2
           Version: 2.4.18
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other Modules
          Assignee: [hidden email]
          Reporter: [hidden email]

${...} clashes with mod_define
%{...} clashes with mod_rewrite
We should have a different character that is not used by any module (like ~)
for unescaped characters (and recommendations about $ and % should be removed)

Remark: enclosing the parameter name in braces is needed to concatenate a
string with another one but it may be replaced, for instance, by $(param) or
$[param]

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

Eric Covener <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Eric Covener <[hidden email]> ---
Does the % syntax actually clash in any meaningful way?

AIUI the only reason $ clashes is because the core of the server looks to
expand $ variables from the native environment / mod_define before directives
even get to process the arguments.

But the % usage in a macro is expanded before mod_rewrite ever takes a look at
the variables.

(99% of directives are like RewriteCond/RewriteRule. 1% are of a special type
called "EXEC_ON_READ" which basically means some evaluation is done immediately
-- those are the problematic ones because they run earlier then everything
else).

For example this works:

<Macro rewriteme %rule %subst %condvar %condval>
RewriteEngine ON
RewriteCond %{%condvar} %condval
RewriteRule %rule %subst
</Macro>


<virtualhost *:80>
Use rewriteme .* /XXX HTTP_HOST .*
</virtualhost>

Should we just prefer % and then @ if you don't like looking at %{%... in
expressions/mod_Rewrite and relegate to $ as a last resort?

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

Eric Covener <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

--- Comment #2 from Marc Stern <[hidden email]> ---
Example of clash:
  <Macro rewriteme ... %{condvar} ...>
  RewriteCond %{condvar} %condval

You expect %{condvar} to be a macro parameter but it will maybe be replaced
because we defined somewhere else "Define codvar ...".
Quite tricky to troubleshoot.

3 solutions:
 - modify mod_rewrite & mod_core (Define)
 - use other characters than %$ in mod_macro
 - use another character than {} as delimiter in macro parameters

The third solution works without any change (for people aware about it).
The second solution will avoid problems. If this is not done, documentation
should at least speak about the problem and recommend solution 3.

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

--- Comment #3 from Eric Covener <[hidden email]> ---
lost track of this one...

(In reply to Marc Stern from comment #2)
> Example of clash:
>   <Macro rewriteme ... %{condvar} ...>
>   RewriteCond %{condvar} %condval
>
> You expect %{condvar} to be a macro parameter but it will maybe be replaced
> because we defined somewhere else "Define codvar ...".
> Quite tricky to troubleshoot.

I'm confused, did you have a typo above?  The core only expands mod_define
variable with ${...} which is not used.  How does %{condvar} get expanded
incorrectly there?  It is not expanded like e.g. #define in the C preprocessor.

Do you have a more comprehensive example that fails?

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

--- Comment #4 from Marc Stern <[hidden email]> ---
(In reply to Eric Covener from comment #3)

Sorry, I wasn't clear at all.
If a user uses a RewriteCond keyword (like HTTPS), it will clash:
  <Macro rewriteme ... %{https} ...>
  RewriteCond %{https} %condval

In THIS case, we have a clash because %{https} is used by both mod_macro &
mod_rewrite. Some keywords may come later and we can't expect all users to know
all of them.

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

Marc Stern <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.4.18                      |2.4.20

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

Christophe JAILLET <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Other Modules               |mod_macro

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 59299] mod_macro syntax clash

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=59299

Ryan Ollos <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]