Skip to content

git: fix darwin crashes when dealing with unicode filenames - #540166

Merged
booxter merged 1 commit into
NixOS:stagingfrom
booxter:git-darwin-fix-hardening
Aug 14, 2026
Merged

booxter merged 1 commit into
NixOS:stagingfrom
booxter:git-darwin-fix-hardening

Conversation

@booxter

@booxter booxter commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

The backported patch is accepted in next.

Note: aarch64-darwin build was executed on master, not staging because currently git build is blocked by jemalloc test suite failures.


The gist is that we enabled additional FORTIFY rules recently, which triggered git crashes on Darwin because of array size enforcement on an array that is defined as [NAME_MAX+1]-sized in (darwin-specific) code but in reality is expanded further with realloc as needed by the implementation. The compiler still sees [NAME_MAX+1] as the threshold to enforce and makes git crash if an attempt to write beyond it is detected.

The specific scenario when git may crash is when it encounters a file name that is longer than NAME_MAX+1 bytes (in NFD UTF-8 encoding) - a real and common scenario on MacOS. (On Linux, it's still possible but git code correctly deals with it for this platform. Hence the issue is Darwin specific.) (In case you wonder why NAME_MAX is not the real limit for a file name length... here)

The patch does not introduce runtime changes, only helps the compiler to know that it's dealing with a flexible array.

Things done

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. labels Jul 10, 2026
@booxter
booxter marked this pull request as ready for review July 10, 2026 02:04
@booxter booxter added 6.topic: darwin Running or building packages on Darwin backport staging-26.05 Backport PR automatically labels Jul 10, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested review from a team, kashw2, leona-ya, me-and, philiptaron, wmertens and zivarah and removed request for a team July 10, 2026 02:48
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". label Jul 10, 2026
@philiptaron

Copy link
Copy Markdown
Contributor

Can you link me a little more detail here?

@booxter

booxter commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@philiptaron the patch leads to the discussion, here's the link: https://lore.kernel.org/git/[email protected] I updated the description with the gist.

@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team July 10, 2026 04:18

@me-and me-and left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'm running some aarch64-linux tests just for good measure, but given x86_64-linux has apparently built successfully, I don't think there's any need to wait for those.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Jul 10, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 20, 2026
@booxter
booxter force-pushed the git-darwin-fix-hardening branch from c25216e to 8faec7a Compare July 20, 2026 23:37
@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 20, 2026

@kashw2 kashw2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch lgtm

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Jul 21, 2026
@booxter

booxter commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@me-and ping?

@me-and

me-and commented Aug 14, 2026

Copy link
Copy Markdown
Member

@me-and ping?

Do you want me to re-review? I don't have the privs to actually do the merge...

@booxter

booxter commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@me-and Ah! This PR is sent by a committer which is why it's labeled as "merge bot eligible", meaning you as the package maintainer CAN merge it. You may want to refresh on the bot functionality, it's actually quite useful, I used it all the time before I had the bit!

Anyway, since you seem to support merging it, I will do it myself. Thanks for the review and quick reply!

@booxter
booxter added this pull request to the merge queue Aug 14, 2026
Merged via the queue into NixOS:staging with commit 46faaf6 Aug 14, 2026
25 checks passed
@booxter
booxter deleted the git-darwin-fix-hardening branch August 14, 2026 12:45
@nixpkgs-ci

nixpkgs-ci Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Backport failed for staging-26.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin staging-26.05
git worktree add -d .worktree/backport-540166-to-staging-26.05 origin/staging-26.05
cd .worktree/backport-540166-to-staging-26.05
git switch --create backport-540166-to-staging-26.05
git cherry-pick -x 8faec7a14645ab696e6631426e2cc4d915ae1202

@booxter

booxter commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Manually backporting: #553413

@leona-ya leona-ya moved this from Needs Review to Reviewed in Nixpkgs security review Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 6.topic: darwin Running or building packages on Darwin 8.has: failed backport 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. backport staging-26.05 Backport PR automatically

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants