Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: t5539 broken under Mac OS X

From: Erik Faye-Lund <hidden>
Date: 2016-06-15 23:03:41

On Tue, Jan 27, 2015 at 3:51 AM, Junio C Hamano [off-list ref] wrote:
Erik Faye-Lund [off-list ref] writes:
quoted
On Fri, Jan 16, 2015 at 1:04 AM, Junio C Hamano [off-list ref] wrote:
quoted
Jeff King [off-list ref] writes:
quoted
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?
Not overly gross compared to some existing test-*.c files, I would
say.

I wondered what 'perl -e 'print $>' would say in mingw, and if that
is portable enough, though.
$ perl -e 'print $>'
500
Thanks for a follow-up.

Is "id -u" not useful over there?  I ask because that is what is
used in the version tentatively queued on 'pu' for NOT_ROOT
prerequisite (the jk/sanity topic).
It's pretty much the same thing:

$ id -u
500
The SANITY prerequisite in that topic needs to be replaced with the
one from Torsten that attempts to check what we want to know in a
more direct way; i.e. "after making a directory or a file read-only,
does the filesystem really honours that, or lets us clobber?" is
what we need to know to skip some tests, and we should check that,
instead of "is / writable by us?" or "are we root?".
$ test -w / && echo yes
yes

$ mkdir foo && chmod a= foo
$ test -w w && echo yes
$ rm -r foo
rm: directory `foo' is write protected; descend into it anyway? n
$ rm -r foo < /dev/null
$ ls -la foo
ls: foo: No such file or directory
$

So, Windows does only kind-of respect read-only flags. Dunno if this
tells you something useful, though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help