Activity log for bug #2026319

Date Who What changed Old value New value Message
2023-07-07 02:23:08 Matthew Ruffell bug added bug
2023-07-07 02:23:15 Matthew Ruffell nominated for series Ubuntu Jammy
2023-07-07 02:23:15 Matthew Ruffell bug task added git (Ubuntu Jammy)
2023-07-07 02:23:20 Matthew Ruffell git (Ubuntu): status New Fix Released
2023-07-07 02:23:23 Matthew Ruffell git (Ubuntu Jammy): status New In Progress
2023-07-07 02:23:25 Matthew Ruffell git (Ubuntu Jammy): importance Undecided Medium
2023-07-07 02:23:27 Matthew Ruffell git (Ubuntu Jammy): assignee Matthew Ruffell (mruffell)
2023-07-07 02:23:36 Matthew Ruffell tags jammy sts
2023-07-07 04:51:18 Matthew Ruffell description [Impact] On jammy, untracked files in a working directory are not recovered if you have previously stashed them, if there happens to be a merge conflict when it comes to pop/apply the stash during rebasing operations. This is a problem because files users intentionally place in their working directories are lost, which could lead to user's losing their data or recent development effort. The only workaround is to ensure that doing a pop/apply will not cause any merge conflicts, or to ensure that all of your files are added and committed. [Testcase] On a Jammy system: $ git init $ echo contents > original-file.txt $ git add original-file.txt $ git commit -m "Creating the file" # Create a new file, modify an old one, stash $ echo foo > new-file.txt $ echo contents2 > original-file.txt $ git stash push -u # Modify the old file in a different way, commit $ echo contents3 > original-file.txt $ git commit -am "Altering the file" # Apply the stash, see conflict, but what about the new file? $ git stash pop $ cat new-file.txt # "new-file.txt" is expected to exist, but is gone There is a test package available in the following ppa: https://launchpad.net/~mruffell/+archive/ubuntu/sf363767-test When installed, "new-file.txt" exists and is able to be read. [Where problems could occur] We are changing how git restores untracked files during a pop/apply operation during a stash. Currently, these untracked files are "lost" i.e. they vanish from the user's working directory. It currently is possible to get them back, but you need to dig around in orphaned commits, and since they no longer have any references anymore, even finding their commit hashes is difficult. With the patch applied, user's untracked files will no longer vanish on stash pop/apply, and while I don't think user's would be surprised to find files they intentionally placed in the working directory safely restored, there is a change in behaviour that these files are now restored, instead of being "deleted" or lost forever. It is unlikely any users have built workflows that depend on untracked files being removed on a stash pop/apply, versus users who intentionally put untracked files in their working directory only to find they have lost them forever upon stashing. If a regression were to occur, it could break worldwide development workflows, due to git being the most popular revision control system, and as such, any changes are high risk. [Other info] This was fixed upstream by the following commit in 2.35.0: commit 71cade5a0b172ece7edf0ccb4420dd5b9a07e71a Author: Elijah Newren <newren@gmail.com> Date: Tue, 4 Jan 2022 23:04:58 +0000 Subject: stash: do not return before restoring untracked files Link: https://github.com/git/git/commit/71cade5a0b172ece7edf0ccb4420dd5b9a07e71a The issue was introduced in commit bee8691 ("stash: restore untracked files AFTER restoring tracked files" in version 2.33.1, so Focal is not affected. Since the fix is in 2.35.0, kinetic is already fixed. [Impact] On jammy, untracked files in a working directory are not recovered if you have previously stashed them, if there happens to be a merge conflict when it comes to pop/apply the stash during rebasing operations. This is a problem because files users intentionally place in their working directories are lost, which could lead to user's losing their data or recent development effort. The only workaround is to ensure that doing a pop/apply will not cause any merge conflicts, or to ensure that all of your files are added and committed. [Testcase] On a Jammy system: $ git init $ echo contents > original-file.txt $ git add original-file.txt $ git commit -m "Creating the file" # Create a new file, modify an old one, stash $ echo foo > new-file.txt $ echo contents2 > original-file.txt $ git stash push -u # Modify the old file in a different way, commit $ echo contents3 > original-file.txt $ git commit -am "Altering the file" # Apply the stash, see conflict, but what about the new file? $ git stash pop $ cat new-file.txt cat: new-file.txt: No such file or directory # "new-file.txt" is expected to exist, but is gone There is a test package available in the following ppa: https://launchpad.net/~mruffell/+archive/ubuntu/sf363767-test When installed, "new-file.txt" exists and is able to be read. $ git stash pop Auto-merging original-file.txt CONFLICT (content): Merge conflict in original-file.txt On branch master Unmerged paths: (use "git restore --staged <file>..." to unstage) (use "git add <file>..." to mark resolution) both modified: original-file.txt Untracked files: (use "git add <file>..." to include in what will be committed) new-file.txt no changes added to commit (use "git add" and/or "git commit -a") The stash entry is kept in case you need it again. $ cat new-file.txt foo [Where problems could occur] We are changing how git restores untracked files during a pop/apply operation during a stash. Currently, these untracked files are "lost" i.e. they vanish from the user's working directory. It currently is possible to get them back, but you need to dig around in orphaned commits, and since they no longer have any references anymore, even finding their commit hashes is difficult. With the patch applied, user's untracked files will no longer vanish on stash pop/apply, and while I don't think user's would be surprised to find files they intentionally placed in the working directory safely restored, there is a change in behaviour that these files are now restored, instead of being "deleted" or lost forever. It is unlikely any users have built workflows that depend on untracked files being removed on a stash pop/apply, versus users who intentionally put untracked files in their working directory only to find they have lost them forever upon stashing. If a regression were to occur, it could break worldwide development workflows, due to git being the most popular revision control system, and as such, any changes are high risk. [Other info] This was fixed upstream by the following commit in 2.35.0: commit 71cade5a0b172ece7edf0ccb4420dd5b9a07e71a Author: Elijah Newren <newren@gmail.com> Date: Tue, 4 Jan 2022 23:04:58 +0000 Subject: stash: do not return before restoring untracked files Link: https://github.com/git/git/commit/71cade5a0b172ece7edf0ccb4420dd5b9a07e71a The issue was introduced in commit bee8691 ("stash: restore untracked files AFTER restoring tracked files" in version 2.33.1, so Focal is not affected. Since the fix is in 2.35.0, kinetic is already fixed.
2023-07-07 04:54:38 Matthew Ruffell attachment added Debdiff for git on jammy https://bugs.launchpad.net/ubuntu/+source/git/+bug/2026319/+attachment/5684424/+files/lp2026319_jammy.debdiff
2023-07-07 05:02:42 Matthew Ruffell bug added subscriber Support Engineering Sponsors
2023-07-31 15:08:15 Heitor Alves de Siqueira tags jammy sts jammy se-sponsor-halves
2023-07-31 15:08:18 Heitor Alves de Siqueira bug added subscriber Heitor Alves de Siqueira
2023-08-09 00:05:20 Robie Basak git (Ubuntu Jammy): status In Progress Fix Committed
2023-08-09 00:05:21 Robie Basak bug added subscriber Ubuntu Stable Release Updates Team
2023-08-09 00:05:24 Robie Basak bug added subscriber SRU Verification
2023-08-09 00:05:26 Robie Basak tags jammy se-sponsor-halves jammy se-sponsor-halves verification-needed verification-needed-jammy
2023-08-09 04:32:51 Matthew Ruffell tags jammy se-sponsor-halves verification-needed verification-needed-jammy jammy se-sponsor-halves verification-done-jammy
2023-08-11 11:18:32 Matthew Ruffell cve linked 2022-39253
2023-08-16 16:19:48 Robie Basak removed subscriber Ubuntu Stable Release Updates Team
2023-08-16 16:19:47 Launchpad Janitor git (Ubuntu Jammy): status Fix Committed Fix Released