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

Re: [PATCH] Add core.symlinks to mark filesystems that do not support symbolic links.

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Mar 3, 2007, 12:20 UTC
Message-ID
<200703031320.13535.johannes.sixt@telecom.at>
In-Reply-To
<7vr6s7chim.fsf@assigned-by-dhcp.cox.net>
On Saturday 03 March 2007 01:12, Junio C Hamano wrote:
Show 31 quoted lines
> Junio C Hamano <junkio@cox.net> writes:
> > This code (I am the guilty one before your change above) always
> > confused me.  How about doing something like this instead?
> >
> >     static inline unsigned int ce_mode_from_stat(struct cache_entry
> > *ce,... {
> >         /*
> >          * A regular file that appears on the filesystem can have
> >          * a "wrong" st_mode information.  A few repository config
> >          * variables can tell us to trust the mode recorded in the
> >          * index more than what we get from the filesystem.
> >          */
> >         if (ce && S_ISREG(mode)) {
> >             extern int trust_executable_bit, has_symlinks;
> >
> >             if (!has_symlinks && S_ISLNK(ntohl(ce->ce_mode)))
> >                 return ce->ce_mode;
>
> Oops, these three lines
>
> >             if (!trust_executable_bit && S_ISREG(ntohl(ce->ce_mode)))
> >                 return ce->ce_mode;
> >             return create_ce_mode(0666);
>
> should be:
>
> 		if (!trust...) {
>                 	if (S_ISREG(...))
>                         	return ce->ce_mode;
> 			return create_ce_mode(0666);
> 		}

I think that's still not correct. Because in the case of !trust_executable_bit we want create_ce_mode(0666) regardless of whether a ce exists or not. Maybe this way:

    static inline unsigned int ce_mode_from_stat(struct cache_entry *ce,...
    {
        /*
         * A regular file that appears on the filesystem can have
         * a "wrong" st_mode information.  A few repository config
         * variables can tell us to trust the mode recorded in the
         * index more than what we get from the filesystem.
         */
        if (S_ISREG(mode)) {
            extern int trust_executable_bit, has_symlinks;
            if (!has_symlinks && ce && S_ISLNK(ntohl(ce->ce_mode)))
                return ce->ce_mode;
            if (!trust_executable_bit) {
                if (ce && S_ISREG(ntohl(ce->ce_mode)))
                    return ce->ce_mode;
                return create_ce_mode(0666);
            }
        }
        return create_ce_mode(mode);
    }
-- Hannes
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 8 in “Add core.symlinks to mark filesystems that do not support symbolic links.”
  1. Add core.symlinks to mark filesystems that do not support symbolic links.Johannes Sixt, Mar 2, 2007
  2. Johannes SchindelinMar 2, 2007
  3. Johannes SixtMar 2, 2007
  4. Junio C HamanoMar 3, 2007
  5. Junio C HamanoMar 3, 2007
  6. Johannes SixtMar 3, 2007
  7. Junio C HamanoMar 3, 2007
  8. Narrow checkouts, was Re: [PATCH] Add core.symlinks to mark filesystems that do not support symbolic links.Johannes Schindelin, Mar 3, 2007

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.