GNU bug report logs - #47135
28.0.50; move to trash does not work if symlink is in Trash

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Sun, 14 Mar 2021 09:10:02 UTC

Severity: minor

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47135 in the body.
You can then email your comments to 47135 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47135; Package emacs. (Sun, 14 Mar 2021 09:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Louis <bugs <at> gnu.support>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 14 Mar 2021 09:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; move to trash does not work if symlink is in Trash
Date: Sun, 14 Mar 2021 12:06:37 +0300
IMHO, deleting file with the variable `delete-by-moving-to-trash' as T
should always work.

Here I have discovered condition when it does not work.

In my trash there is this file:

  lrwxrwxrwx 1  175 Jun 18  2019 Rock-and-Mineral-Identification.pdf -> /home/admin/Books/Geology/Rock-and-Mineral-Identification.pdf

And then I have the directory, /home/admin/other/ where one can see this
file:

D -rw------- 1 5.6M Aug 13  2018 Rock-and-Mineral-Identification.pdf

if I try to delete with x, I get this message:

file-already-exists: File already exists:
/home/data1/protected/tmp/Trash/Rock-and-Mineral-Identification.pdf

But it is irrelevant, it should move the deleted file to trash.


In GNU Emacs 28.0.50 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo version 1.14.8, Xaw3d scroll bars)
 of 2021-03-07 built on protected.rcdrun.com
Repository revision: 468bb5ab7f949441f68c4133fcd5292dfbbfd83d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11907000
System Description: Hyperbola GNU/Linux-libre

Configured using:
 'configure --with-x-toolkit=lucid
 PKG_CONFIG_PATH=/home/data1/protected/GNUstep/Library/Libraries/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XPM LUCID
ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=exwm-xim
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort hashcash mail-extr emacsbug message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame minibuffer
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese composite
charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev
obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit x multi-tty make-network-process
emacs)

Memory information:
((conses 16 54147 7034)
 (symbols 48 7205 0)
 (strings 32 20233 1994)
 (string-bytes 1 646570)
 (vectors 16 13617)
 (vector-slots 8 230403 16423)
 (floats 8 26 42)
 (intervals 56 240 0)
 (buffers 992 11))

-- 
Thanks,
Jean Louis
⎔ λ 🄯 𝍄 𝌡 𝌚




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47135; Package emacs. (Thu, 18 Mar 2021 06:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 47135 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 47135 <at> debbugs.gnu.org
Subject: Re: bug#47135: 28.0.50; move to trash does not work if symlink is
 in Trash
Date: Thu, 18 Mar 2021 07:16:07 +0100
Jean Louis <bugs <at> gnu.support> writes:

> Here I have discovered condition when it does not work.
>
> In my trash there is this file:
>
>   lrwxrwxrwx 1  175 Jun 18  2019 Rock-and-Mineral-Identification.pdf -> /home/admin/Books/Geology/Rock-and-Mineral-Identification.pdf
>
> And then I have the directory, /home/admin/other/ where one can see this
> file:
>
> D -rw------- 1 5.6M Aug 13  2018 Rock-and-Mineral-Identification.pdf
>
> if I try to delete with x, I get this message:
>
> file-already-exists: File already exists:
> /home/data1/protected/tmp/Trash/Rock-and-Mineral-Identification.pdf

The problem is more general -- any file that exists already in the trash
directory leads to this problem.

To test:

touch /home/larsi/.local/share/Trash/files/foo
touch /tmp/foo

Then "d" the file in dired, and x, and then you'll get the error.
That's because the code in move-file-to-trash only checks whether the
.trashinfo file exists:

	       ;; Make a .trashinfo file.  Use O_EXCL, as per trash-spec 1.0.
	       (let* ((files-base (file-name-nondirectory fn))
		      (info-fn (expand-file-name
				(concat files-base ".trashinfo")
				trash-info-dir)))
		 (condition-case nil
		     (write-region nil nil info-fn nil 'quiet info-fn 'excl)
		   (file-already-exists
		    ;; Uniquify new-fn.  Some file managers do not
		    ;; like Emacs-style backup file names.  E.g.:
		    ;; https://bugs.kde.org/170956
		    (setq info-fn (make-temp-file
				   (expand-file-name files-base trash-info-dir)
				   nil ".trashinfo"))
		    (setq files-base (substring (file-name-nondirectory info-fn)
                                                0 (- (length ".trashinfo"))))

And then creates a new, unique name.  A .trashinfo file should exist, of
course, but here the Trash directory is out of sync, and Emacs should
handle that better, I guess.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47135; Package emacs. (Thu, 18 Mar 2021 06:37:02 GMT) Full text and rfc822 format available.

Message #11 received at 47135 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 47135 <at> debbugs.gnu.org
Subject: Re: bug#47135: 28.0.50; move to trash does not work if symlink is
 in Trash
Date: Thu, 18 Mar 2021 07:36:30 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> And then creates a new, unique name.  A .trashinfo file should exist, of
> course, but here the Trash directory is out of sync, and Emacs should
> handle that better, I guess.

This should now be fixed in Emacs 28.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 18 Mar 2021 06:37:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 47135 <at> debbugs.gnu.org and Jean Louis <bugs <at> gnu.support> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 18 Mar 2021 06:37:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 15 Apr 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 117 days ago.

Previous Next


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