Git development
 help / color / mirror / Atom feed
* [BUG] make test (t3600-rm.sh) fails
@ 2006-03-24 10:14 Panagiotis Issaris
  2006-03-24 10:29 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Panagiotis Issaris @ 2006-03-24 10:14 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] make test (t3600-rm.sh) fails
  2006-03-24 10:14 [BUG] make test (t3600-rm.sh) fails Panagiotis Issaris
@ 2006-03-24 10:29 ` Junio C Hamano
  2006-03-24 10:45   ` Takis
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-03-24 10:29 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: git

Panagiotis Issaris <takis@issaris.org> writes:

> * 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
...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] make test (t3600-rm.sh) fails
  2006-03-24 10:29 ` Junio C Hamano
@ 2006-03-24 10:45   ` Takis
  2006-03-24 11:08     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Takis @ 2006-03-24 10:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

2006/3/24, Junio C Hamano <junkio@cox.net>:
> Panagiotis Issaris <takis@issaris.org> writes:
>
> > * 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

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

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] make test (t3600-rm.sh) fails
  2006-03-24 10:45   ` Takis
@ 2006-03-24 11:08     ` Junio C Hamano
  2006-03-24 12:05       ` Panagiotis Issaris
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-03-24 11:08 UTC (permalink / raw)
  To: takis; +Cc: git

Takis <panagiotis.issaris@gmail.com> writes:

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] make test (t3600-rm.sh) fails
  2006-03-24 11:08     ` Junio C Hamano
@ 2006-03-24 12:05       ` Panagiotis Issaris
  2006-03-24 13:51         ` Petr Baudis
  0 siblings, 1 reply; 6+ messages in thread
From: Panagiotis Issaris @ 2006-03-24 12:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

Junio C Hamano wrote:

>...
>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.
>  
>
Something like this?


diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index d1947e1..52a1e99 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -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' \

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [BUG] make test (t3600-rm.sh) fails
  2006-03-24 12:05       ` Panagiotis Issaris
@ 2006-03-24 13:51         ` Petr Baudis
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Baudis @ 2006-03-24 13:51 UTC (permalink / raw)
  To: Panagiotis Issaris; +Cc: Junio C Hamano, git

Dear diary, on Fri, Mar 24, 2006 at 01:05:02PM CET, I got a letter
where Panagiotis Issaris <takis@issaris.org> said that...
> diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
> index d1947e1..52a1e99 100755
> --- a/t/t3600-rm.sh
> +++ b/t/t3600-rm.sh
> @@ -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

> if test "$test_tabs" = y; then
> chmod u-w .
+ touch xyzzy || \
> test_expect_failure \

-- 
				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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-24 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-24 10:14 [BUG] make test (t3600-rm.sh) fails Panagiotis Issaris
2006-03-24 10:29 ` Junio C Hamano
2006-03-24 10:45   ` Takis
2006-03-24 11:08     ` Junio C Hamano
2006-03-24 12:05       ` Panagiotis Issaris
2006-03-24 13:51         ` Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox