← Commit list

70624846f

Matt Kraai
Matt Kraai
2001-12-21
FAILED Duration: 332s

Subject

Ignore blanks before the first address and before the command.

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/sed.c+8 -0
@@ -414,6 +414,10 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd
* part1 part2 part3
*/
+ /* skip initial whitespace */
+ while (isspace(cmdstr[idx]))
+ idx++;
+
/* first part (if present) is an address: either a number or a /regex/ */
if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/')
idx = get_address(sed_cmd, cmdstr, &sed_cmd->beg_line, &sed_cmd->beg_match);
@@ -422,6 +426,10 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd
if (cmdstr[idx] == ',')
idx += get_address(sed_cmd, &cmdstr[++idx], &sed_cmd->end_line, &sed_cmd->end_match);
+ /* skip whitespace before the command */
+ while (isspace(cmdstr[idx]))
+ idx++;
+
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
error_msg_and_die("missing command");
testsuite/sed/sed-accepts-blanks-before-command+1 -0
@@ -0,0 +1 @@
+busybox sed -e '1 d' </dev/null