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

Re: quiltimport mode detection oddity

From
AMAndrew Morton <akpm@linux-foundation.org>
Date
Aug 2, 2024, 05:33 UTC
Message-ID
<20240801223347.f3ecc32d6afebcd2e42cc3f7@linux-foundation.org>
In-Reply-To
<20240802035121.GB1246312@coredump.intra.peff.net>
On Thu, 1 Aug 2024 23:51:21 -0400 Jeff King <peff@peff.net> wrote:
Show 38 quoted lines
> On Thu, Aug 01, 2024 at 06:07:06PM -0700, Andrew Morton wrote:
> 
> > > So, the patch removes autoconf.h file from that directory.  The
> > > "extended header" part between "diff --git" and "--- a/..." has
> > > "deleted file mode 100664" and that is where the warning comes.
> > 
> > yup yup.  The patch says "remove this file which has mode 100664".
> > 
> > The file has mode 100664.
> > 
> > quiltimport says it had mode 100644.  Incorrectly, I suggest.
> 
> It's definitely a weird case. Git does not record full modes, but just
> cares about the execute bit. So it normalizes modes for regular files to
> 100644 or 100755. You can see that with a simple example:
> 
>   git init
>   echo foo >file
>   chmod 664 file
>   git add file
>   git commit -m 'add file'
> 
>   git ls-files -s
> 
>   cat >patch <<\EOF
>   diff --git a/file b/file
>   deleted file mode 100664
>   --- a/file
>   +++ /dev/null
>   @@ -1 +0,0 @@
>   -foo
>   EOF
>   ls -l file
>   git apply patch
> 
> Even though the filesystem has 100664, the index records 100644 (which
> you can see from the "ls-files" output). And then when we apply the
> patch, we get the "file has type 100644, expected 100664" message.
OK.
> AFAICT, it has been that way forever (I tried as far back as git 1.6.6).
> So this is nothing new, and I don't think Git would ever produce a patch
> that said "file mode 100664" itself (I'm assuming in your case the patch
> is coming from quilt).
yup.
> Alternatively (or maybe in addition), I wonder if quilt should similarly
> canonicalize the mode.
I'll hard code 100644 ;)
> generated elsewhere, but normal patches don't have modes in them at all.
> The "deleted file mode" line is git-ism, so here we have something which
> is implementing the git line in a (slightly) incompatible way.
yup, thanks.
Previous: Jeff KingNext: Junio C Hamano
Message 5 of 10 in “quiltimport mode detection oddity”
  1. Andrew MortonAug 1, 2024
  2. Junio C HamanoAug 2, 2024
  3. Andrew MortonAug 2, 2024
  4. Jeff KingAug 2, 2024
  5. Andrew MortonAug 2, 2024
  6. Junio C HamanoAug 2, 2024
  7. apply: canonicalize modes read from patchesJeff King, Aug 5, 2024
  8. Junio C HamanoAug 15, 2024
  9. t4129: fix racy index when calling chmod after git-addJeff King, Aug 15, 2024
  10. Junio C HamanoAug 15, 2024

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.