[PATCH] tar: fix tar -T to add entries in the exact order as the input list
SASAKI Suguru
sss.sonik at gmail.com
Mon Jul 8 16:43:35 UTC 2013
Hi,
`tar -T` in busybox v1.21.1 adds files in reverse order of the actual
inclusion list:
$ touch 1 2 3
$ busybox-v1.21.1 echo -e '1\n2\n3' \
| busybox-v1.21.1 tar -T- -c \
| busybox-v1.21.1 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
Following patch will make busybox act like GNU tar.
--
SASAKI Suguru
mailto:sss.sonik at gmail.com
mailto:suguru at sonik.org
-- >8 --
From: SASAKI Suguru <suguru at sonik.org>
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 at sonik.org>
---
archival/tar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/archival/tar.c b/archival/tar.c
index c0ceff5..d352a2e 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.8.3.1
More information about the busybox
mailing list