Skip to content
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

Getting "old path already occupied" #37

Open
jgosmann opened this issue Nov 23, 2020 · 10 comments
Open

Getting "old path already occupied" #37

jgosmann opened this issue Nov 23, 2020 · 10 comments

Comments

@jgosmann
Copy link

Great tool! Unfortunately, I was trying to absorb some changes today and got this error:

Nov 23 09:17:36.878 CRIT absorb failed, err: old path already occupied

It is not clear to me why am I getting this error, what it means, or how to solve it. :(

@tummychow
Copy link
Owner

i can't diagnose this issue without more information. that error comes from my patch parsing code, so i need to see the diffs of your git index (git diff --cached) and the commits in your git absorb stack

@jgosmann
Copy link
Author

I cannot share the exact diff (it's proprietary source code), but I could locate the issue: I had a symbolic link to a file that I replaced with an actual file. This gives a diff similar to this one:

diff --git a/some-file.ext b/some-file.ext
new file mode 100644
index 0000000000..7cb58a6452
--- /dev/null
+++ b/some-file.ext
@@ -0,0 +1,135 @@
+# File contents following here

@tummychow
Copy link
Owner

tummychow commented Nov 23, 2020

ah... i can see how that would cause this problem

diff --git a/bar b/bar
deleted file mode 120000
index 1910281..0000000
--- a/bar
+++ /dev/null
@@ -1 +0,0 @@
-foo
\ No newline at end of file
diff --git a/bar b/bar
new file mode 100644
index 0000000..e69de29

looks like link and non-link changes get different hunks. that'll require a special case in the parser

@jgosmann
Copy link
Author

I've found another case not involving symbolic links where I'm getting this error:

diff --git a/some_path/pvm.spec b/some_path/pvm.spec
index aa58341137..943bacfa2c 100644
--- a/some_path/pvm.spec
+++ b/some_path/pvm.spec
@@ -58,7 +58,7 @@ tar -xzf %{SOURCE0}
 cd pvm3
 tar -xzf %{SOURCE1}
 %patch0 -p0
-#patch1 -p1
+%patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1

@tummychow
Copy link
Owner

is that the entire index? this bug requires a diff with two patches that both have the same filename. your example only has one patch in it

@jgosmann
Copy link
Author

jgosmann commented Nov 26, 2020

Yes, that is the entire index.

Maybe the previous commits in the history are the problem? There are still some commits doing things with symlinks.

@tummychow
Copy link
Owner

tummychow commented Nov 26, 2020

Maybe the previous commits in the history are the problem?

yeah that sounds likely, every commit has to get parsed the same way as the index. probably one of them has the same issue where a symlink is being turned into a regular file or vice versa

@junkblocker
Copy link

Any plans to fix this? It's a couple of years old now.

@Konfekt
Copy link

Konfekt commented Feb 17, 2024

Maybe this could be documented more prominently, as symlinking happens quite frequently and thus is a common source of failure

@81ninja
Copy link

81ninja commented Mar 9, 2024

I've had this problem a few times already, and the solution I found was to find the offending commit by trying

git-absorb -b HEAD~100 --dry-run
git-absorb -b HEAD~50 --dry-run
git-absorb -b HEAD~75 --dry-run
...
git-absorb -b HEAD~nn --dry-run

etc until I nailed down the offending commit (nn patches ago), then git rebase the repo from since the offending commit with
git rebase --onto HEAD~nn HEAD~nn (yes twice the rev number)
to change the offending file's mode (previously a symlink, that's be un-linked) by using
git ls-files */*/my.file --stage
(to show file modes), and finally
git update-index --chmod=-x my.file
to set permissions to anything other than file mode 12000 (symlink). Then
git rebase --continue

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

No branches or pull requests

5 participants