Re: t5539 broken under Mac OS X

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: t5539 broken under Mac OS X

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:36

Jeff King [off-list ref] writes:
The current scheme does not require POSIXPERM. Would this mean that
some platforms no longer runs SANITY tests (e.g., Windows)?

Many of the SANITY-marked tests already require both, but not all.
Before writing that patchlet, I briefly looked at grep output and
thought that many that are protected only by SANITY lacked POSIXPERM
by mistake:

 t/t1004-read-tree-m-u-wf.sh:test_expect_success SANITY 'funny symlink in...
 t/t3600-rm.sh 'Test that "git rm -f" fails if its rm fails'
 t/t7300-clean.sh:test_expect_success SANITY 'removal failure' '
 t/t7300-clean.sh:test_expect_success SANITY 'git clean -d with an...

All of the above relies on a working chmod as far as I can tell, so
they should require POSIXPERM,SANITY, not just SANITY.
And
certainly lib-httpd actually cares whether you are _truly_ root, not
about weird filesystem permissions. Should lib-httpd literally be
checking the output of `id` (though I can imagine that is anything but
portable)?
Even though t/README describes SANITY to require:

  Test is not run by root user, and an attempt to write to an
  unwritable file is expected to fail correctly.

and it has been that way from day one, c91cfd19 (tests: A SANITY
test prereq for testing if we're root, 2010-08-06) is clear that
this is about "'chmod -w' is a good way to test unwritable files"

lib-httpd should, if it cares about the root-ness, be checking that
in a more direct way, "test_have_prereq RUNNING_AS_ROOT".  Making
the implementation of that portable is another matter, though.

Re: t5539 broken under Mac OS X

From: Jeff King <hidden>
Date: 2016-06-15 23:03:36

On Thu, Jan 15, 2015 at 02:39:56PM -0800, Junio C Hamano wrote:
Before writing that patchlet, I briefly looked at grep output and
thought that many that are protected only by SANITY lacked POSIXPERM
by mistake:

 t/t1004-read-tree-m-u-wf.sh:test_expect_success SANITY 'funny symlink in...
 t/t3600-rm.sh 'Test that "git rm -f" fails if its rm fails'
 t/t7300-clean.sh:test_expect_success SANITY 'removal failure' '
 t/t7300-clean.sh:test_expect_success SANITY 'git clean -d with an...

All of the above relies on a working chmod as far as I can tell, so
they should require POSIXPERM,SANITY, not just SANITY.
Yeah, skimming the grep output, I had the same feeling. But I did not
investigate closely.
lib-httpd should, if it cares about the root-ness, be checking that
in a more direct way, "test_have_prereq RUNNING_AS_ROOT".  Making
the implementation of that portable is another matter, though.
Exactly. I am happy to submit a patch, but I cannot think of any
mechanisms besides:

  1. Calling `id`, which I suspect is very not portable.

  2. Writing a C program to check getuid(). That's portable for most
     Unixes. It looks like we already have a hacky wrapper on mingw that
     will always return "1".

Is (2) too gross?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help