git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Introduce core.sharedrepository

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 22, 2005, 22:59 UTC
Message-ID
<Pine.LNX.4.63.0512222356540.12681@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vaceshi18.fsf@assigned-by-dhcp.cox.net>
Hi,
On Thu, 22 Dec 2005, Junio C Hamano wrote:
Show 18 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > +static int make_group_writable(const char *path)
> > +{
> > +	struct stat st;
> > +
> > +	if (lstat(path, &st) < 0)
> > +		return -1;
> > +	if (st.st_mode & S_IWUSR)
> > +		st.st_mode |= S_IWGRP;
> > +	if (S_ISDIR(st.st_mode))
> > +		st.st_mode |= S_ISGID;
> > +	if (chmod(path, st.st_mode) < 0)
> > +		return -2;
> > +	return 0;
> > +}
> 
> Perhaps g+sx not just g+s on directories.
Okay:
        if (S_ISDIR(st.st_mode))
                st.st_mode |= S_ISGID | S_IXGRP;
Show 15 quoted lines
> > +
> >  int safe_create_leading_directories(char *path)
> >  {
> >  	char *pos = path;
> > @@ -64,6 +79,10 @@ int safe_create_leading_directories(char
> >  				*pos = '/';
> >  				return -1;
> >  			}
> > +		if (shared_repository && make_group_writable(path)) {
> > +			*pos = '/';
> > +			return -2;
> > +		}
> 
> Wouldn't this safe_create_leading_directories("/pub/git.git/objects")
> try chmod "/pub" and fail?
Yes.
How about an "else" in front of the "if"? Like so:
                if (mkdir(path, 0777) < 0)
                        if (errno != EEXIST) {
                                *pos = '/';
                                return -1;
                        }
                else if (shared_repository && make_group_writable(path)) {
                        *pos = '/';
                        return -2;
                }
You want me to resend the patch?

Ciao, Dscho

Previous: Junio C HamanoNext: Johannes Schindelin
Message 3 of 7 in “Introduce core.sharedrepository”
  1. Introduce core.sharedrepositoryJohannes Schindelin, Dec 22, 2005
  2. Junio C HamanoDec 22, 2005
  3. Johannes SchindelinDec 22, 2005
  4. Johannes SchindelinDec 22, 2005
  5. Junio C HamanoDec 23, 2005
  6. Johannes SchindelinDec 23, 2005
  7. Johannes SchindelinDec 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.