← Commit list

39925026f

Christian Eggers
Christian Eggers
2020-07-31
SUCCESS Duration: 150s

Subject

shell: Fix "read -d ''" behavior

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 →

shell/ash_test/ash-read/read_d0.right+1 -0
@@ -0,0 +1 @@
+test
shell/ash_test/ash-read/read_d0.tests+1 -0
@@ -0,0 +1 @@
+printf 'test\0zest\n' | (read -d '' reply; echo "$reply")
shell/hush_test/hush-read/read_d0.right+1 -0
@@ -0,0 +1 @@
+test
shell/hush_test/hush-read/read_d0.tests+1 -0
@@ -0,0 +1 @@
+printf 'test\0zest\n' | (read -d '' reply; echo "$reply")
shell/shell_common.c+2 -2
@@ -209,8 +209,6 @@ shell_builtin_read(struct builtin_read_params *params)
}
c = buffer[bufpos];
- if (c == '\0')
- continue;
if (!(read_flags & BUILTIN_READ_RAW)) {
if (backslash) {
backslash = 0;
@@ -225,6 +223,8 @@ shell_builtin_read(struct builtin_read_params *params)
}
if (c == delim) /* '\n' or -d CHAR */
break;
+ if (c == '\0')
+ continue;
/* $IFS splitting. NOT done if we run "read"
* without variable names (bash compat).