Skip to content

Fix lstat()'s st_size computation for symbolic links when FSCache is in effect #2673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dscho
Copy link
Member

@dscho dscho commented Jun 7, 2020

This fixes #2653

In git-for-windows#2637, we fixed a bug
where symbolic links' target path sizes were recorded incorrectly in the
index.

However, we did so only in `mingw_lstat()` but not in `fscache_lstat()`.
Meaning: in code paths where the FSCache feature is enabled, Git _still_
got the wrong idea if the symbolic link target's length.

Let's fix this.

Note: as the FSCache feature reads in whole swaths of directory entries
in batch mode, even if metadata for only one of them might be required,
we save the expensive `CreateFile()` call that is required to compute
the symbolic link target's length to the `fscache_lstat()` call.

This fixes git-for-windows#2653.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@billziss-gh
Copy link

Looks good to me.

See test run below:

billziss@xps:~/Projects/ext/dscho-git$ uname -a
MINGW64_NT-10.0-19041 xps 3.1.4-340.x86_64 2020-05-19 12:55 UTC x86_64 Msys
billziss@xps:~/Projects/ext/dscho-git$ ./git.exe config core.fscache
true
billziss@xps:~/Projects/ext/dscho-git$ ./git.exe status
On branch also-handle-fscache-addon-for-#2637
Your branch is up to date with 'origin/also-handle-fscache-addon-for-#2637'.

nothing to commit, working tree clean

I have also confirmed that if I copy the git.exe produced from your patch into \Program Files\Git, it fixes the problem on all repositories.

Thank you for the quick fix!

@orgads
Copy link

orgads commented Jun 8, 2020

Works for me too. Thank you!

@dscho dscho merged commit 4df0b59 into git-for-windows:master Jun 8, 2020
@dscho dscho added this to the Next release milestone Jun 8, 2020
git-for-windows-ci pushed a commit that referenced this pull request Jun 8, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
@dscho dscho deleted the also-handle-fscache-addon-for-#2637 branch June 8, 2020 05:38
git-for-windows-ci pushed a commit that referenced this pull request Jun 8, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 8, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 8, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 9, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 9, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 9, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 9, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 9, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Jun 10, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 11, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Jun 11, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 12, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 12, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 16, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 16, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 16, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 16, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Jun 18, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 25, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 25, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 27, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 27, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 28, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 28, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 28, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Sep 29, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Sep 30, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 1, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 2, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 4, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 4, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 4, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 5, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 5, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 5, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
git-for-windows-ci pushed a commit that referenced this pull request Oct 5, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
dscho added a commit that referenced this pull request Oct 6, 2020
Fix `lstat()`'s `st_size` computation for symbolic links when FSCache is in effect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As of 2.27.0, all symlinks have modifications after stash pop
3 participants