Skip to content

docs/mod_sed: document that a/c/i cannot be used from httpd.conf - #1154

Open
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:docs/bz70389-mod-sed-multiline
Open

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:docs/bz70389-mod-sed-multiline

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

The a, c and i commands need their text after a backslash-newline, which httpd.conf's parser always collapses as a line continuation before mod_sed sees the command. Confirmed against a real build: both the standard multi-line form and a single-backslash one-line form fail with "command garbled". Documents the limitation and points to s as the workaround.

PR 70389.

[x] This PR does not report or address a security vulnerability.
[x] Code follows the httpd style guide.
[ ] New log messages (n/a, docs only)
[ ] changes-entries (n/a, docs only)
[ ] pyhttpd tests (n/a, docs only)

The multi-line form these commands require is a backslash immediately
followed by a newline, which the config file parser always collapses
as a line continuation before mod_sed ever parses the command.
Confirmed against a real build: both the standard multi-line form and
a single-backslash one-line form fail with "command garbled".

PR 70389. [Arturo Bernal]
@notroj

notroj commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

If it's impossible to use those commands could we delete the code implementing them as well (or at least ifdef it out)?

@arturobernalg

Copy link
Copy Markdown
Member Author

Turns out it's not quite impossible — a/c/i can't be written in the config file itself (httpd.conf/Include/mod_macro all collapse the backslash-newline before mod_sed sees it, and there's no escape for a literal LF in substring_conf), but they do work via ${ENVVAR} substitution (ap_resolve_env runs after the continuation collapse) or via -c/-C on the command line with a raw LF in the argv string. So removing the code would be a real, if obscure, behavior change for anyone using either route. libsed itself isn't used anywhere else in the tree, for what that's worth. I'll tighten the PR wording to "cannot be written in a configuration file" rather than "impossible".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants