On Fri, Sep 03, 2010 at 05:23:47PM +0200, Denys Vlasenko wrote:
> Applied, and then fixed tar test. Thanks!

The failing test actually showed a problem in Busybox's tar. It can't extract
a file into a read-only directory. Attached is a simplified test that checks
for just this situation. The test passes with GNU tar.

>>> Dan
From 4fca00a6dde1a999f1f0f1c0a79a41b300f00abc Mon Sep 17 00:00:00 2001
From: Dan Fandrich <[email protected]>
Date: Fri, 3 Sep 2010 12:01:54 -0700
Subject: [PATCH] Created a tar test that extracts a file into a read-only directory

Signed-off-by: Dan Fandrich <[email protected]>
---
 testsuite/tar.tests |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/testsuite/tar.tests b/testsuite/tar.tests
index c2d3b3d..ce495ae 100755
--- a/testsuite/tar.tests
+++ b/testsuite/tar.tests
@@ -129,6 +129,30 @@ Ok
 "Ok\n" ""
 SKIP=
 
+optional FEATURE_TAR_CREATE
+testing "tar writing into read-only dir" '\
+rm -rf input_* test.tar 2>/dev/null
+mkdir input_dir
+>input_dir/input_file
+chmod 550 input_dir
+tar cf test.tar input_dir
+tar tvf test.tar | sed "s/.*[0-9] input/input/"
+chmod 770 input_dir
+rm -rf input_*
+tar xf test.tar 2>&1
+echo Ok: $?
+ls -l input_dir/* . | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
+chmod 770 input_dir
+' "\
+input_dir/
+input_dir/input_file
+Ok: 0
+-rw-r--r-- input_dir/input_file
+dr-xr-x--- input_dir
+" \
+"" ""
+SKIP=
+
 cd .. && rm -rf tar.tempdir || exit 1
 
 exit $FAILCOUNT
-- 
1.5.3.2

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to