[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] tar: fix handling of first argument without '-'
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2017-08-23 10:20:00
Message-ID: CAK1hOcNonpLN=ztSHaGRsPExuc6kizWn174uBB3dWzA0eV1H6A () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks

On Tue, Aug 22, 2017 at 5:33 PM, Ron Yorston <rmy@pobox.com> wrote:
> The following no longer works as expected:
>
>    $ ./busybox tar xfz test.tgz
>    tar: can't open 'z': No such file or directory
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
>  archival/tar.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/archival/tar.c b/archival/tar.c
> index 9a5bcc7fe..6cf3508ec 100644
> --- a/archival/tar.c
> +++ b/archival/tar.c
> @@ -953,9 +953,6 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
>         if (getuid() != 0)
>                 tar_handle->ah_flags |= ARCHIVE_DONT_RESTORE_PERM;
>
> -       /* Prepend '-' to the first argument if required */
> -       if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0')
> -               argv[1] = xasprintf("-%s", argv[1]);
>  #if ENABLE_DESKTOP
>         /* Lie to buildroot when it starts asking stupid questions. */
>         if (argv[1] && strcmp(argv[1], "--version") == 0) {
> @@ -992,6 +989,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
>                 }
>         }
>  #endif
> +       /* Prepend '-' to the first argument if required */
> +       if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0')
> +               argv[1] = xasprintf("-%s", argv[1]);
>         opt = GETOPT32(argv, "^"
>                 "txC:f:Oopvk"
>                 IF_FEATURE_TAR_CREATE(   "ch"    )
> --
> 2.13.5
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic