Skip to contentSkip to conversation

make test (t3600-rm.sh) fails

BUG Panagiotis Issaris 4 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

Just a small report that "make test" fails on my system on the current git git tree:

...
* passed all 3 test(s)
*** t3600-rm.sh ***
Committing initial tree e5c556e46aae6124ff4a2a466c95004e92d9a2e4

*   ok 1: Pre-check that foo exists and is in index before git-rm foo
*   ok 2: Test that git-rm foo succeeds
*   ok 3: Post-check that foo exists but is not in index after git-rm foo
*   ok 4: Pre-check that bar exists and is in index before "git-rm -f bar"
*   ok 5: Test that "git-rm -f bar" succeeds
*   ok 6: Post-check that bar does not exist and is not in index after "git-rm -f bar"
*   ok 7: Test that "git-rm -- -q" succeeds (remove a file that looks like an option)
*   ok 8: Test that "git-rm -f" succeeds with embedded space, tab, or newline characters.

* FAIL 9: Test that "git-rm -f" fails if its rm fails git-rm -f baz
* ok 10: When the rm in "git-rm -f" fails, it should not remove the file from the index
* failed 1 among 10 test(s)
make[2]: *** [t3600-rm.sh] Error 1
make[2]: Leaving directory `/usr/local/src/git/t' make[1]: *** [test] Error 2
make[1]: Leaving directory `/usr/local/src/git'
make: *** [build-arch-stamp] Error 2

My system:
Ubuntu 5.10 aka Breezy
Linux issaris 2.6.15.060103 #1 Tue Jan 3 14:27:55 CET 2006 i686 GNU/Linux
model name : Intel(R) Pentium(R) 4 CPU 3.20GHz

With friendly regards,
Takis

#1 lore raw
Quoted 6 lines · Panagiotis Issaris

* FAIL 9: Test that "git-rm -f" fails if its rm fails
git-rm -f baz
...
My system:
Ubuntu 5.10 aka Breezy
Linux issaris 2.6.15.060103 #1 Tue Jan 3 14:27:55 CET 2006 i686 GNU/Linux

I wonder what your system shows if you run:

	$ cd t && sh -x t3600-rm.sh -i -v

The test #9 makes the test directory unwritable before trying to unlink a file there, and git-rm runs rm without -f which should make it fail. So either your "chmod u-w ." is broken, you are running it as root and defeating "chmod u-w .", or you have a broken rm that does not report failure with its exit status.

The relevant part on my machine looks like this:

$ cd t
$ sh -x t3600-rm.sh -i -v
...
*   ok 8: Test that "git-rm -f" succeeds with embedded space, tab, or newline characters.
+ test y = y
+ chmod u-w .
+ test_expect_failure 'Test that "git-rm -f" fails if its rm fails' 'git-rm -f baz'
+ test 2 = 2
+ say 'expecting failure: git-rm -f baz'
+ echo '* expecting failure: git-rm -f baz'
* expecting failure: git-rm -f baz
+ test_run_ 'git-rm -f baz'
+ eval 'git-rm -f baz'
++ git-rm -f baz
rm: cannot remove `baz': Permission denied
+ eval_ret=123
+ return 0
+ '[' 0 = 0 -a 123 '!=' 0 ']'
+ test_ok_ 'Test that "git-rm -f" fails if its rm fails'
++ expr 8 + 1
+ test_count=9
+ say '  ok 9: Test that "git-rm -f" fails if its rm fails'
+ echo '*   ok 9: Test that "git-rm -f" fails if its rm fails'
*   ok 9: Test that "git-rm -f" fails if its rm fails
...
#2 lore raw

Hi,

2006/3/24, Junio C Hamano <[email protected]>:

Quoted 9 lines
Quoted 6 lines · Panagiotis Issaris

* FAIL 9: Test that "git-rm -f" fails if its rm fails
git-rm -f baz
...
My system:
Ubuntu 5.10 aka Breezy
Linux issaris 2.6.15.060103 #1 Tue Jan 3 14:27:55 CET 2006 i686 GNU/Linux

Quoted 3 lines

I wonder what your system shows if you run:

        $ cd t && sh -x t3600-rm.sh -i -v

Here's the output:

takis@issaris:/usr/local/src/git$ cd t && sh -x t3600-rm.sh -i -v
...
*   ok 8: Test that "git-rm -f" succeeds with embedded space, tab, or
newline characters.
+ test y = y
+ chmod u-w .
+ test_expect_failure 'Test that "git-rm -f" fails if its rm fails'
'git-rm -f baz'
+ test 2 = 2
+ say 'expecting failure: git-rm -f baz'
+ echo '* expecting failure: git-rm -f baz'
* expecting failure: git-rm -f baz
+ test_run_ 'git-rm -f baz'
+ eval 'git-rm -f baz'
++ git-rm -f baz
rm: cannot remove `baz': Permission denied
+ eval_ret=0
+ return 0
+ '[' 0 = 0 -a 0 '!=' 0 ']'
+ test_failure_ 'Test that "git-rm -f" fails if its rm fails' 'git-rm -f baz'
++ expr 8 + 1
+ test_count=9
++ expr 0 + 1
+ test_failure=1
+ say 'FAIL 9: Test that "git-rm -f" fails if its rm fails'
+ echo '* FAIL 9: Test that "git-rm -f" fails if its rm fails'
* FAIL 9: Test that "git-rm -f" fails if its rm fails
+ shift
+ echo 'git-rm -f baz'
+ sed -e 's/^/  /'
        git-rm -f baz
+ test t = ''
+ trap - exit
+ exit 1
Quoted 5 lines

The test #9 makes the test directory unwritable before trying to unlink a file there, and git-rm runs rm without -f which should make it fail. So either your "chmod u-w ." is broken, you are running it as root and defeating "chmod u-w .", or you have a broken rm that does not report failure with its exit status.

I am running it as fakeroot, as part of the "dpkg-buildpackage -rfakeroot -uc -us -b"
command for building Debian packages. Would this be the problem (the fakeroot)?

With friendly regards,
Takis

#3 lore raw
Quoted 3 lines · Takis

I am running it as fakeroot, as part of the "dpkg-buildpackage -rfakeroot -uc -us -b"
command for building Debian packages. Would this be the problem (the fakeroot)?

That is what is causing this, yes.

	$ mkdir /var/tmp/junk && cd /var/tmp/junk
        $ chmod u+w .
	$ fakeroot sh -c 'date >foo; chmod u-w .; rm foo; ls -l foo'
        $ chmod u+w .
	$ sh -c 'date >foo; chmod u-w .; rm foo; ls -l foo'

The one under fakeroot happily ignores the directory being unwritable because it mimics to be root.

But that does not mean fakeroot is buggy. Fakeroot is doing what it is designed to do.

That does not mean running our tests under fakeroot is stupidity on your part. We do not advertise that the tests should not be run as root.

The test is buggy -- it tries to make sure the command fails when underlying rm fails, but is not aware that "chmod u-w ." is not a good way to make ./foo undeletable if you run it as root. At least it should skip those two tests if it is run by root.

#4 lore raw

Hi,

Quoted 8 lines · Junio C Hamano

...
But that does not mean fakeroot is buggy. Fakeroot is doing what it is designed to do.

That does not mean running our tests under fakeroot is stupidity on your part. We do not advertise that the tests should not be run as root.

Quoted 7 lines

The test is buggy -- it tries to make sure the command fails when underlying rm fails, but is not aware that "chmod u-w ." is not a good way to make ./foo undeletable if you run it as root. At least it should skip those two tests if it is run by root.

Something like this?

t/t3600-rm.sh +0 -0
index d1947e1..52a1e99 100755
@@ -56,6 +56,7 @@ test "$test_tabs" = y && test_expect_suc
    "git-rm -f 'space embedded' 'tab   embedded' 'newline

embedded'"

+if test whoami != "root"; then
if test "$test_tabs" = y; then
chmod u-w .
test_expect_failure \

@@ -63,6 +64,7 @@ test_expect_failure \
    'git-rm -f baz'

chmod u+w .
fi
+fi

test_expect_success \
    'When the rm in "git-rm -f" fails, it should not remove the file from the index' \
#5 lore raw

Dear diary, on Fri, Mar 24, 2006 at 01:05:02PM CET, I got a letter where Panagiotis Issaris <[email protected]> said that...

Quoted 9 lines
t/t3600-rm.sh +0 -0
index d1947e1..52a1e99 100755
@@ -56,6 +56,7 @@ test "$test_tabs" = y && test_expect_suc
    "git-rm -f 'space embedded' 'tab   embedded' 'newline

embedded'"

+if test whoami != "root"; then

Root is not the only condition when this will not fail, it can happen on broken filesystems as well, specifically AFS. (Avoid avoid avoid that horrid thing!)

So, perhaps rather

Quoted 2 lines

if test "$test_tabs" = y; then
chmod u-w .

+ touch xyzzy || \

Quoted 1 line

test_expect_failure \

Signature · 4 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.