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

List:       busybox
Subject:    [PATCH] tar: fix tar -T to add entries in the exact order as the input list
From:       SASAKI Suguru <sss.sonik () gmail ! com>
Date:       2013-05-25 15:46:10
Message-ID: CAE3X6mweW2atdjVTeKy2Lii7f=nGfMCbQpcrrpdq1LJEZ9crYg () mail ! gmail ! com
[Download RAW message or body]

Hi,

`tar -T` in busybox v1.21.0 adds files in reverse order of the actual
inclusion list:

    $ touch 1 2 3
    $ busybox-v1.21.0 echo -e '1\n2\n3' \
        | busybox-v1.21.0 tar -T- -c \
        | busybox-v1.21.0 tar t
    3
    2
    1

This is different from GNU tar:

    $ tar --version
    tar (GNU tar) 1.26
    Copyright (C) 2011 Free Software Foundation, Inc.
    $ echo -e '1\n2\n3' \
        | tar -T- -c \
        | tar t
    1
    2
    3

I'm not sure whether this is intended or not, but attached patch will fix this:

--
SASAKI Suguru
  mailto:sss.sonik@gmail.com
  mailto:suguru@sonik.org

["0001-tar-fix-tar-T-to-add-entries-in-the-exact-order-as-t.patch" (application/octet-stream)]

From: SASAKI Suguru <suguru@sonik.org>
Date: Sun, 26 May 2013 00:15:01 +0900
Subject: [PATCH] tar: fix tar -T to add entries in the exact order as the
 input list

When -T is specified (and ENABLE_FEATURE_TAR_FROM),
tar should add entries to the archive in the exact order as the input list,
not in reverse order.

Signed-off-by: SASAKI Suguru <suguru@sonik.org>
---
 archival/tar.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/archival/tar.c b/archival/tar.c
index f46f7bb..a58e290 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -679,7 +679,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
 			char *cp = last_char_is(line, '/');
 			if (cp > line)
 				*cp = '\0';
-			llist_add_to(&newlist, line);
+			llist_add_to_end(&newlist, line);
 		}
 		fclose(src_stream);
 	}
-- 
1.7.10.4



_______________________________________________
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