| title | Git Rev News Edition 98 (April 30th, 2023) | |
|---|---|---|
| layout | default | |
| date | 2023-04-30 12:06:51 +0100 | |
| author | chriscool | |
| categories |
|
|
| navbar | false |
Welcome to the 98th edition of Git Rev News, a digest of all things Git. For our goals, the archives, the way we work, and how to contribute or to subscribe, see the Git Rev News page on git.github.io.
This edition covers what happened during the months of March 2023 and April 2023.
-
Suspected git grep regression in git 2.40.0
Stephane Odul reported that running the command
git grep -cP '^\w+ = json.load'on some files of a private repo started failing consistently with an exit code of -11 in Git v2.40.0 while it worked with previous Git versions.
Bagas Sanjaya replied to Stephane asking him if he could use
git bisectbetween v2.39.0 and v2.40.0 to see which commit in Git's history broke the feature.Junio Hamano, the Git maintainer, thought the issue might have been created by a recent change in how Git uses the PCRE2 library. This change made Git try to run PCRE2's JIT (Just In Time) compiler on a sample pattern and fall back to not using the JIT compiler if the attempt failed.
Junio said it could alternatively be that the version of the PCRE2 library linked to v2.40 had been updated compared to the one in previous Git versions, but asked if it made a difference to disable the JIT compiler by prefixing the pattern with
(*NO_JIT).Mathias Krause, who had worked on PCRE2 related issues recently, replied that another commit with the subject "grep: correctly identify utf-8 characters with {b,w} in -P" seemed more suspect to him as it was about both the
-Poption and the\wpattern.Looking at the diff of that commit, Mathias found that it added the
PCRE2_UCPflag to the PCRE2 library call when an UTF-8 locale was used, and that PCRE2 had aPCRE2_ERROR_UTF8_ERR9(-11) error code described as "5th-byte's two top bits are not 0x80" that matched the exit code of -11 which Stephane got.Mathias then asked Stephane if a file in his repo might contain invalid UTF-8 output, and suggested testing this using the following command:
$ iconv -f UTF-8 your_file > /dev/null && echo OK || echo "Not valid"Stephane replied that he created a custom pipeline to try to reproduce the issue and found that restricting the
git grepcommand to Python files (using'*.py') was a good workaround, and that the issue was likely related to other files in "various formats, including potentially some binaries that would definitely not be proper UTF-8". He also noted that using(*NO_JIT)as suggested by Junio prevented the issue but slowed down the command a lot for some patterns.Mathias, in the meantime, was able to reproduce the error on the Git repo. He got a segfault and also a backtrace under gdb, but the backtrace was very short and without any debug symbols, so he supposed that it happened in the call stack of PCRE2's JIT compiler. Looking at the memory mapping and the instructions also seemed to point to a JIT compiler bug.
Mathias then reverted the commit that added the
PCRE2_UCPflag to the PCRE2 library call, and found that it fixed the bug, which confirmed his earlier suspicion about that commit.Stephane thanked Mathias for his great work and left saying he was happy with the workaround he had found and did not believe there was much more he could contribute to the issue.
Mathias replied to his previous email saying he had found "an interesting entry in the PCRE2's changelog for version 10.35":
https://github.com/PCRE2Project/pcre2/blob/pcre2-10.35/ChangeLog#L66:
"17. Fix a crash which occurs when the character type of an invalid UTF character is decoded in JIT."He concluded that it was needed to implement "yet another quirk to handle these broken versions", and came up with an in-email patch that was not using the
PCRE2_UCPflag when Git was compiled to link to a PCRE2 version lower than 10.35. He wondered though if it was better to just revert the commit that had introduced thePCRE2_UCPflag.Junio replied to Mathias by first thanking him for "all the investigation and a prompt fix" and then saying that the approach in his patch was more sensible than reverting the commit. He suggested a small code change though.
Mathias agreed with Junio's suggestion and sent a version 2 of his patch that was then merged into the
masterbranch.
- Git 2.40.1 and friends
- Git for Windows 2.40.1(1)
- libgit2 1.6.4
- GitLab 15.11 15.10.4, 15.7.9, 15.8.6, 15.10.3, 15.10.2, 15.10.1, 15.9.4, and 15.8.5
- Bitbucket Server 8.9
- Gitea 1.19.1
- GitHub Enterprise 3.8.2, 3.5.16, 3.7.9, 3.6.12
- GitKraken 9.3.0
- GitHub Desktop 3.2.2, 3.2.1
- git-credential-oauth 0.6.0
Various
- Git security vulnerabilities announced: CVE-2023-25652 and CVE-2023-29007, and MS Windows specific CVE-2023-25815, CVE-2023-29011, and CVE-2023-29012. By Taylor Blau on GitHub Blog.
Light reading
- Git and GitHub for Designers by Bruno Brito on Tower’s blog.
- Git-Sim 3 Month Dev Update: Community Response, New Features, & The Future by Jacob Stopak on Initial Commit. Git-Sim was mentioned in Git Rev News Edition #95.
- Smoother rebases with auto-squashing Git commits and Super-charging 'git rebase' with 'git absorb' by Andrew Lock on .NET Escapades. git-absorb (a port of Facebook's hg absorb extension for Mercurial) was mentioned in passing in Git Rev News Edition #72.
- Modeling Git Internals in Alloy, Part 1: Blobs and Trees and Modeling Git Internals in Alloy, Part 2: Commits and Tags by Brian Hicks on bytes.zone. Alloy is a tool (with its own domain-specific programming language) used for making and checking models of other software.
- Avoiding the merge trap by Jonathan Corbet on LWN.net describes how one should explain merges in pull requests sent to Linus Torvalds.
- Notes on graphics programming and version control Tyler Angert on tyler.cafe blog.
- Introducing the Space Git Flow
by Evgenia Verbina on JetBrains Blog. Space Git Flow is a branching strategy
similar to Git Flow
(first mentioned in Git Rev News Edition #5)
and specifically GitHub Flow,
used by JetBrains to develop their products including
Space development platform / software forge.
See also:- Please stop recommending Git Flow! by George Stocker, mentioned in Git Rev News #61.
- Patterns for Managing Source Code Branches by Martin Fowler, mentioned first in Git Rev News #63.
- Convert git log output to JSON using jq with proper escaping, on Simon Willison’s TILs (Today I've Learned).
- Quickly formatting a stack of commits
by Waleed Khan on Steno & PL personal blog.
It uses the
git testcommand from the git-branchless suite of tools, which was first mentioned in Git Rev News Edition #76. - How to Install GitQlient on Your Synology NAS by Marius Bogdan Lixandru on his personal blog: Marius Hosting.
- Some
secretgit tricks that come in handy by raghav yadav on DEV.to. - Git banned.h: Why Git's Maintainers Have A List Of Banned Standard C Library Functions by Jacob Stopak on Initial Commit.
- GitHub Copilot for CLI makes Terminal scripting and Git as easy as asking a question by Christian Heilmann on DEV.to.
- sqlite-history: tracking changes to SQLite tables using triggers by Simon Willison on his Weblog.
- SmartCommit: A Graph-Based Interactive Assistant for Activity-Oriented Commits [PDF] (DOI:10.1145/3468264.3468551) describes a graph-partitioning-based interactive tool to help split tangled changesets. The paper is accompanied by the code for the core algorithm of SmartCommit, a demo GUI client, and dataset and the visualization scripts used in the article. Since then, similar research studies have been conducted, like ComUnt and UTango, which cite the SmartCommit article.
Git tools and sites
- List of Free Learning Resources (In Many Languages) by the Free Ebook Foundation, includes the list organized by subject, where there are free books about Version Control Systems, including Git. Some of those were mentioned in Git Rev News. This list was originally a clone of StackOverflow - List of Freely Available Programming Books. Has a dynamic webpage for searching the list at https://ebookfoundation.github.io/free-programming-books-search/.
- GitQlient is a multi-platform Git client written with Qt, originally forked from QGit.
- Gut is a user-friendly Git CLI for Windows, Mac, and GNU/Linux. Written in Go, still in alpha stage of development.
- srcsnap (repository) is a screenshot-driven version tracking tool, written using Electron. It's described in Srcsnap — Screenshot-Driven Version Tracking post on Future Sketches MIT Media Lab group blog.
- diff2html is a JavaScript library
that generates pretty HTML diffs from
git diffor unifieddiffoutput.
This edition of Git Rev News was curated by Christian Couder <christian.couder@gmail.com>, Jakub Narębski <jnareb@gmail.com>, Markus Jansen <mja@jansen-preisler.de> and Kaartic Sivaraam <kaartic.sivaraam@gmail.com> with help from Bruno Brito.