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
Fix bugs related to real_path() #575
Fix bugs related to real_path() #575
Conversation
SyntevoAlex
commented
Mar 6, 2020
•
edited
edited
`real_path()` returns result from a shared buffer, inviting subtle reentrance bugs. One of these bugs occur when invoked this way: set_git_dir(real_path(git_dir)) In this case, `real_path()` has reentrance: real_path read_gitfile_gently repo_set_gitdir setup_git_env set_git_dir_1 set_git_dir Later, `set_git_dir()` uses its now-dead parameter: !is_absolute_path(path) Fix this by using a dedicated `strbuf` to hold `strbuf_realpath()`. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
3a6a0d0
to
2eeefda
Compare
/submit |
Submitted as pull.575.git.1583521396.gitgitgadget@gmail.com |
Judging from the log, I think that CirrusCI might stumble over your naming convention using hash symbols and parentheses:
|
Yes, that's what I wanted to say when I mentioned you. Sorry for being cryptic. |
This branch is now known as |
This patch series was integrated into pu via git@5eec745. |
This patch series was integrated into pu via git@09403e4. |
Returning a shared buffer invites very subtle bugs due to reentrancy or multi-threading, as demonstrated by the previous patch. There was an unfinished effort to abolish this [1]. Let's finally rid of `real_path()`, using `strbuf_realpath()` instead. This patch uses a local `strbuf` for most places where `real_path()` was previously called. However, two places return the value of `real_path()` to the caller. For them, a `static` local `strbuf` was added, effectively pushing the problem one level higher: read_gitfile_gently() get_superproject_working_tree() [1] https://lore.kernel.org/git/1480964316-99305-1-git-send-email-bmwill@google.com/ Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
This commit continues the work started with previous commit. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Together with the previous commits, this commit fully fixes the problem of using shared buffer for `real_path()` in `get_superproject_working_tree()`. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
2eeefda
to
4195006
Compare
/submit |
Submitted as pull.575.v2.git.1583845884.gitgitgadget@gmail.com |
This patch series was integrated into pu via git@bb604d3. |
This patch series was integrated into pu via git@3a98500. |
This patch series was integrated into pu via git@eeb9066. |
This patch series was integrated into next via git@1f84382. |
This patch series was integrated into pu via git@8904578. |
This patch series was integrated into pu via git@a41c373. |
This patch series was integrated into pu via git@f2eeed7. |
This patch series was integrated into pu via git@d11e8d6. |
This patch series was integrated into pu via git@7b7dc7c. |
This patch series was integrated into pu via git@782e80d. |
This patch series was integrated into pu via git@6880a95. |
This patch series was integrated into pu via git@454338c. |
This patch series was integrated into pu via git@d76d8d1. |
This patch series was integrated into pu via git@e404196. |
This patch series was integrated into pu via git@77b0881. |
This patch series was integrated into pu via git@71c0542. |
This patch series was integrated into pu via git@4d0e899. |
This patch series was integrated into next via git@4d0e899. |
This patch series was integrated into master via git@4d0e899. |
Closed via 4d0e899. |