GNU bug report logs - #34092
Dired move file breaks relative symlinks

Previous Next

Package: emacs;

Reported by: Q <qiang.fang <at> zoho.com.cn>

Date: Wed, 16 Jan 2019 02:44:03 UTC

Severity: wishlist

Tags: moreinfo

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Q <qiang.fang <at> zoho.com.cn>
Cc: 34092 <at> debbugs.gnu.org
Subject: bug#34092: Dired move file breaks relative symlinks
Date: Wed, 18 May 2022 15:19:24 +0200
Q <qiang.fang <at> zoho.com.cn> writes:

> Dired move file breaks relative symlinks. Maybe we can call this a
> bug. I find a workaround with this advice.  I use this to move files
> (rel symlinks) around in a git-annex repo without brokening it.  I am
> quite new to emacs, I am not sure if that has any side effect.
>
>     (defun my-rename-file (file newname &optional ok-if-already-exists)
>     "fix path for relative symlink"
>     (if (file-symlink-p newname)
>     (let ((target (expand-file-name (file-symlink-p newname) (file-name-directory
> file))))
>           (if (and target (string-equal system-type "gnu/linux") (not (file-exists-p
> newname)))
>               (dired-make-relative-symlink target newname t)))))
>     (advice-add #'rename-file :after #'my-rename-file)

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I'm unable to reproduce this in Emacs 29.  I did:

touch file
ln -s file symfile

And then moved the file and the relative symlink with `R' in Dired, and
they were moved as expected (i.e., still relative).

Do you have a recipe for the problem you were seeing, or has this been
fixed in the years since it was reported?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 2 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.