You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
notably, the trap checks that the thing it's removing is a symlink before removing it. soooooo... that suggests there's something other than a symlink there. next time you see this, can you ls -l $whatever and check? that trap should probably exit gracefully with a better error message if it finds something other than a symlink.
notably, this will fail with a hard link (i.e. "a file"). so we might be hitting that if it's hardlinking to deal with a boundary issue. as it can do on line 371:
I figured this out. existsSync(dst) is returning false when Deno.lstatSync(dst).isSymlink returns true, and it looks like it's because dst is a link to a file that doesn't exist. So existsSync(dst) must be following the link and checking that file if it exists.
Fascinating and brutal. So, perhaps either the existsSync() is purely redundant, or perhaps we should just switch the ||. || means it'll remove hard links (which is good), but also means it will remove files we didn't install (which is bad).
If deno lstat issymlink then remove
After that, if exists then we need to do something. Probably error unless we have a --force flag, is my guess. Since it'll remove any file. Not the biggest problem in /usr/local, but potentially lossy. Could delete something someone wanted.
Activity
jhheider commentedon Jan 20, 2026
here's the relevant lines:
pkgm/pkgm.ts
Lines 497 to 502 in e3934de
notably, the trap checks that the thing it's removing is a symlink before removing it. soooooo... that suggests there's something other than a symlink there. next time you see this, can you
ls -l $whateverand check? that trap should probably exit gracefully with a better error message if it finds something other than a symlink.notably, this will fail with a hard link (i.e. "a file"). so we might be hitting that if it's hardlinking to deal with a boundary issue. as it can do on line 371:
pkgm/pkgm.ts
Lines 352 to 380 in e3934de
magnusviri commentedon Feb 14, 2026
I figured this out.
existsSync(dst)is returning false whenDeno.lstatSync(dst).isSymlinkreturns true, and it looks like it's because dst is a link to a file that doesn't exist. So existsSync(dst) must be following the link and checking that file if it exists.jhheider commentedon Feb 14, 2026
Fascinating and brutal. So, perhaps either the
existsSync()is purely redundant, or perhaps we should just switch the||.||means it'll remove hard links (which is good), but also means it will remove files we didn't install (which is bad).magnusviri commentedon Feb 14, 2026
I didn't see your comment until just now. The pull request is what ChatGPT said to do.
magnusviri commentedon Feb 14, 2026
Sigh, I'm still getting this error. I'll debug it some more next time I work on this.
jhheider commentedon Feb 14, 2026
The answer is probably:
If deno lstat issymlink then remove
After that, if exists then we need to do something. Probably error unless we have a --force flag, is my guess. Since it'll remove any file. Not the biggest problem in /usr/local, but potentially lossy. Could delete something someone wanted.
fix dangling symlinks
jhheider commentedon Feb 17, 2026
@magnusviri see if #79 fixes it for you. this tries to take a more considered approach:
magnusviri commentedon Feb 20, 2026
It fixed one instance of the problem. I'll keep testing it and let you know if it causes me problems.
jhheider commentedon Feb 20, 2026
result! i'm hopeful. i didn't want it to smash stuff you wanted, but you should have some recourse to move forward.