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

fresh ls-files looks inside submodules even when not asked to or asked not to

From
Yaroslav Halchenko <yoh@onerussian.com>
Date
Nov 19, 2024, 15:44 UTC
Message-ID
<ZzyyQpJw-kxJA7IS@bilena>
Dear Git Gurus,

Here is a report prepared with a new glorious "git bugreport" which I hoped would also automagically send it out.

What did you do before the bug happened? (Steps to reproduce your issue)
	Prior version (e.g. 2.45.2) had this issue "hidden": ls-files was
	just reporting error to stderr but exiting with exit code 0.  So our test in
	DataLad which creates an artificial situation with permissions to .git/config
	within submodule did not trigger error.
What did you expect to happen? (Expected behavior)
	Ideally -- 'git ls-files -m -d --no-recurse-submodules'
	should not even consult submodules' .git/config . I am not yet 100% certain that it should without explicit '--recurse-submodules'.
What happened instead? (Actual behavior)
    regardless which options (-x sub3  or --no-recurse-submodules) I add,
    git ls-files does try to access submodules .git/config:
    ❯ pwd
    /home/yoh/.tmp/datalad_temp_test_subsuperdataset_savechl3cwws/sub1/sub2
	❯ ls -ld .git/config
	-rw-rw-r-- 1 yoh yoh 333 Nov 19 10:11 .git/config
	❯ ls -ld sub3/.git/config
	---------- 1 yoh yoh 285 Nov 19 10:11 sub3/.git/config
    ❯ git --version
    git version 2.47.0.288.g090d24e9af
    ❯ git ls-files  -m -d
    warning: unable to access '/home/yoh/.tmp/datalad_temp_test_subsuperdataset_savechl3cwws/sub1/sub2/sub3/.git/config': Permission denied
    fatal: unable to access '/home/yoh/.tmp/datalad_temp_test_subsuperdataset_savechl3cwws/sub1/sub2/sub3/.git/config': Permission denied
    ❯ echo $?
    128
   
    ❯ git ls-files -m -d --no-recurse-submodules -x sub3
    warning: unable to access '/home/yoh/.tmp/datalad_temp_test_subsuperdataset_savechl3cwws/sub1/sub2/sub3/.git/config': Permission denied
    fatal: unable to access '/home/yoh/.tmp/datalad_temp_test_subsuperdataset_savechl3cwws/sub1/sub2/sub3/.git/config': Permission denied
    ❯ echo $?
    128
	NB then also tried with "next" 2.47.0.376.g95f8e04e20 to the same effect.
What's different between what you expected and what actually happened?
    git ls-files did descend into submodule to check its .git/config for no
    reason IMHO.
Anything else you want to add:
    Thank you for creating this helper to file issues!  Note that a
    slight mental dichotomy was caused by the fact that you named it "git
    bugreport" whenever debian has "reportbug" so now it would take extra
    mental effort to remember who has what
[System Info]
git version:
git version 2.47.0.288.g090d24e9af
cpu: x86_64
built from commit: 090d24e9af6e9f59c3f7bee97c42bb1ae3c7f559
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 8.11.0
OpenSSL: OpenSSL 3.3.2 3 Sep 2024
zlib: 1.3.1
uname: Linux 6.11.5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.5-1 (2024-10-27) x86_64
compiler info: gnuc: 14.2
libc info: glibc: 2.40
$SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks] post-checkout post-merge post-receive pre-commit

Thank you in advance!
-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
WWW:   http://www.linkedin.com/in/yarik        
Message 1 of 1 in “fresh ls-files looks inside submodules even when not asked to or asked not to”
  1. Yaroslav HalchenkoNov 19, 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.