https://bz.apache.org/bugzilla/show_bug.cgi?id=63834

            Bug ID: 63834
           Summary: "a" , "i" command get error on mod_sed
           Product: Apache httpd-2
           Version: 2.4.41
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_sed
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Hello.

I want to add some new line to output HTML by using mod_sed.
I worte configuration file following,

---
OutputSed    '/^HOGEHOGE$/aFUGAFUGA'
---

but this configuration get error on syntax check.

---
$ sudo /usr/local/apache2/bin/apachectl -t
AH00526: Syntax error on line 81 of /usr/local/apache2/conf/httpd.conf:
Failed to compile sed expression. command garbled: /^HOGEHOGE$/aFUGAFUGA
---

I read the source cord causing this error. In modules/filters/sed0.c
,l365〜l376,
there is following check.

---
        case 'a':
            commands->rep->command = ACOM;
            if (commands->rep->ad2) {
                command_errf(commands, SEDERR_AD1MES, commands->linebuf);
                return -1;
            }
            if (*commands->cp == '\\') 
                commands->cp++;
            if (*commands->cp++ != '\n') {
                command_errf(commands, SEDERR_CGMES, commands->linebuf);
                return -1;
            }
---

It seems to require a backslash and a newline after "a" command.
In the "native" sed, this command works perfectly.

---
# sed -e '/^HOGEHOGE/aFUGAFUGA' textfile
---


Actually, sed man page says as following.
---
a \
text
---

I think this error check is unnecessary.
There is a similar check for the c and i commands.
Could you consider removing it?

Thanks.

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

Reply via email to