GNU bug report logs - #28792
26.0.60; Deleting to a custom trash directory in Dired gives error

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Thu, 12 Oct 2017 03:27:01 UTC

Severity: normal

Tags: fixed

Merged with 28519, 28828

Found in versions 26.0.50, 26.0.60, 27.0.50

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


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

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: 28792 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: 26.0.60; Deleting to a custom trash directory in Dired gives error
Date: Thu, 12 Oct 2017 03:51:54 +0000
[Message part 1 (text/plain, inline)]
On Wed, Oct 11, 2017 at 11:35 PM Kaushal Modi <kaushal.modi <at> gmail.com>
wrote:

> I'd like to add that if I leave the value of trash-directory to nil, then
> I believe the default system trash directory is created somewhere in my
> /home.
>
> Because then, based on my earlier email, CASE A (deleting directory in my
> emacs user dir works fine, but CASE B (deleting directory in my /tmp) gives
> that error.
>
> So far, at least on my machine, it looks like if
>
> - delete-by-moving-to-trash is t, AND
> - trash-directory is in /tmp and to-be-deleted-dir in is HOME (or
> vice-versa)
>
> this error occurs.
>

The situation unfolds further!

Turns out this has nothing to do with dired. So taking off Tino from the
To: list (sorry for doing that earlier).

Now I think that this probably has to do with the rename-file series of
commits (
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-26&id=446e92548f932f18d57924573b49b5e6f4ae70c4
).
So copying Paul.

Here are even simpler recipes verified in emacs -Q:

1. First eval this one form to catch the error back trace
(setq debug-on-message "Non-regular")

2. Now eval the 3 forms below one by one.. the last one should fail as the
trash-directory and to-be-del directory do not share the same root?/mount?

;; WORKS
;; Both trash-directory and to-be-del dirs in temporary-file-directory
(let ((trash-directory (concat temporary-file-directory
                               (getenv "USER") "/.trash_emacs/"))
      (to-be-del (concat temporary-file-directory "foo/")))
  (mkdir trash-directory :parents)
  (mkdir to-be-del :parents)
  (move-file-to-trash to-be-del))

;; WORKS
;; Both trash-directory and to-be-del dirs in user-emacs-directory
(let ((trash-directory (concat user-emacs-directory "/.trash_emacs/"))
      (to-be-del (concat user-emacs-directory "foo/")))
  (mkdir trash-directory :parents)
  (mkdir to-be-del :parents)
  (move-file-to-trash to-be-del))

;; FAILS!!
;; trash-directory in temporary-file-directory but to-be-del dir in
;; user-emacs-directory
(let ((trash-directory (concat user-emacs-directory "/.trash_emacs/"))
      (to-be-del (concat temporary-file-directory "foo/")))
  (mkdir trash-directory :parents)
  (mkdir to-be-del :parents)
  (move-file-to-trash to-be-del))

When I eval this 3rd form, I get this error back trace:

Debugger entered--Lisp error: (file-error "Non-regular file" "Is a
directory" "/tmp/foo")
  rename-file("/tmp/foo" "/home/kmodi/.emacs.d/.trash_emacs/foo.~1~")
  move-file-to-trash("/tmp/foo/")
  (let ((trash-directory (concat user-emacs-directory "/.trash_emacs/"))
(to-be-del (concat temporary-file-directory "foo/"))) (mkdir
trash-directory :parents) (mkdir to-be-del :parents) (move-file-to-trash
to-be-del))
  eval((let ((trash-directory (concat user-emacs-directory
"/.trash_emacs/")) (to-be-del (concat temporary-file-directory "foo/")))
(mkdir trash-directory :parents) (mkdir to-be-del :parents)
(move-file-to-trash to-be-del)) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

-- 

Kaushal Modi
[Message part 2 (text/html, inline)]

This bug report was last modified 7 years and 215 days ago.

Previous Next


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