unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47135: 28.0.50; move to trash does not work if symlink is in Trash
@ 2021-03-14  9:06 Jean Louis
  2021-03-18  6:16 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2021-03-14  9:06 UTC (permalink / raw)
  To: 47135


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
⎔ λ 🄯 𝍄 𝌡 𝌚





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#47135: 28.0.50; move to trash does not work if symlink is in Trash
  2021-03-14  9:06 bug#47135: 28.0.50; move to trash does not work if symlink is in Trash Jean Louis
@ 2021-03-18  6:16 ` Lars Ingebrigtsen
  2021-03-18  6:36   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-18  6:16 UTC (permalink / raw)
  To: Jean Louis; +Cc: 47135

Jean Louis <bugs@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#47135: 28.0.50; move to trash does not work if symlink is in Trash
  2021-03-18  6:16 ` Lars Ingebrigtsen
@ 2021-03-18  6:36   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-18  6:36 UTC (permalink / raw)
  To: Jean Louis; +Cc: 47135

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-18  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-14  9:06 bug#47135: 28.0.50; move to trash does not work if symlink is in Trash Jean Louis
2021-03-18  6:16 ` Lars Ingebrigtsen
2021-03-18  6:36   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).