git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Do not use GUID on dir in git init --shared=all on FreeBSD
Date: Wed, 5 Mar 2008 00:15:39 +0100	[thread overview]
Message-ID: <20080304231539.GA8085@limbo.localdomain> (raw)
In-Reply-To: <7vr6eq43te.fsf@gitster.siamese.dyndns.org>

It does not allow changing the bit to a non-root user.
This fixes t1301-shared-repo.sh on the platform.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Junio C Hamano, Tue, Mar 04, 2008 21:44:29 +0100:
> (2) In Makefile (and configure.in perhaps)

Just the configure.ac is a bit too much for today.

>     ifeq ($(uname_S),FreeBSD)
>     	MKDIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
>     endif
>     ...
>     ifdef MKDIR_HAS_BSD_GROUP_SEMANTICS
>         COMPAT_CFLAGS += -DMKDIR_HAS_BSD_GROUP_SEMANTICS
>     endif

I tweaked the names a bit.

 Makefile          |    4 ++++
 git-compat-util.h |    6 ++++++
 path.c            |    2 +-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index ca5aad9..6e857e6 100644
--- a/Makefile
+++ b/Makefile
@@ -478,6 +478,7 @@ ifeq ($(uname_S),FreeBSD)
 	NO_MEMMEM = YesPlease
 	BASIC_CFLAGS += -I/usr/local/include
 	BASIC_LDFLAGS += -L/usr/local/lib
+	DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 endif
 ifeq ($(uname_S),OpenBSD)
 	NO_STRCASESTR = YesPlease
@@ -747,6 +748,9 @@ ifdef THREADED_DELTA_SEARCH
 	EXTLIBS += -lpthread
 	LIB_OBJS += thread-utils.o
 endif
+ifdef DIR_HAS_BSD_GROUP_SEMANTICS
+	COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
+endif
 
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK=NoThanks
diff --git a/git-compat-util.h b/git-compat-util.h
index 2a40703..5912443 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -437,4 +437,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #define qsort git_qsort
 #endif
 
+#ifndef DIR_HAS_BSD_GROUP_SEMANTICS
+# define FORCE_DIR_SET_GID S_ISGID
+#else
+# define FORCE_DIR_SET_GID 0
+#endif
+
 #endif
diff --git a/path.c b/path.c
index af27161..f4ed979 100644
--- a/path.c
+++ b/path.c
@@ -283,7 +283,7 @@ int adjust_shared_perm(const char *path)
 			    ? (S_IXGRP|S_IXOTH)
 			    : 0));
 	if (S_ISDIR(mode))
-		mode |= S_ISGID;
+		mode |= FORCE_DIR_SET_GID;
 	if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
 		return -2;
 	return 0;
-- 
1.5.4.3.272.gf0c3


  parent reply	other threads:[~2008-03-04 23:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03 23:44 [PATCH] Fix git init --shared=all on FreeBSD 4.11 Alex Riesen
2008-03-04  0:31 ` Junio C Hamano
2008-03-04  7:25   ` Alex Riesen
2008-03-04  8:08     ` Junio C Hamano
2008-03-04 20:20       ` [PATCH] Do not use GUID on dir in git init --shared=all on FreeBSD 4.11p2 Alex Riesen
2008-03-04 20:44         ` Junio C Hamano
2008-03-04 21:46           ` Alex Riesen
2008-03-04 23:15           ` Alex Riesen [this message]
2008-03-04 20:50         ` Johannes Schindelin
2008-03-04 21:46           ` Alex Riesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080304231539.GA8085@limbo.localdomain \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).