[PATCH] shell: Also do word splitting when -d DELIM is used

Denys Vlasenko vda.linux at googlemail.com
Sat Jun 5 16:10:11 UTC 2021


Applied, thank you

On Sat, Jun 5, 2021 at 1:44 PM Eicke Herbertz <wolletd at posteo.de> wrote:
>
> The original commit 3bef5d89b0 introduced an additional check
> for an unset `opt_d` before doing word splitting. I'm unsure
> why it's there in the first place, but the commit message also
> describes a different behaviour than what -d actually does in
> bash, while the code mostly does the right thing.
>
> `opt_d` sets the line delimiter for read to stop reading and
> should not affect word splitting.
> ---
>  shell/shell_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/shell/shell_common.c b/shell/shell_common.c
> index f95a35e8b..e3d6783b5 100644
> --- a/shell/shell_common.c
> +++ b/shell/shell_common.c
> @@ -230,7 +230,7 @@ shell_builtin_read(struct builtin_read_params *params)
>                  * without variable names (bash compat).
>                  * Thus, "read" and "read REPLY" are not the same.
>                  */
> -               if (!params->opt_d && argv[0]) {
> +               if (argv[0]) {
>  /* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 */
>                         const char *is_ifs = strchr(ifs, c);
>                         if (startword && is_ifs) {
> --
> 2.31.1
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list