unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48280: 28.0.50; Fix moving directories with the same name to trash
@ 2021-05-07 19:31 mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-08 11:40 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-07 19:31 UTC (permalink / raw)
  To: 48280

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

Hello,

I've attached a patch for this bug I was dealing with while trying out
28.0.50 commit a2842a11728336fc8110eedb5176ecfbe71bbc79.

Refs: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47135
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47135>

To reproduce, save this to a `bug.el` file:

```elisp

(setq delete-by-moving-to-trash t)

(let ((test-dir "~/test123"))
   (progn
     (message "Creating directory: 1")
     (make-directory test-dir)
     (message "Deleting directory: 1")
     (delete-directory test-dir t t)

     (message "Creating directory: 2")
     (make-directory test-dir)
     (message "Deleting directory: 2")
     (delete-directory test-dir t t)

     (message "Success!")))
```

And execute with: `emacs -nw -Q -l ./bug.el`.

Expected: "Success!"
Actual: "Renaming: Not a directory, /home/me/test123,
/home/me/.local/share/Trash/files/test123Wiibmk"

Please let me know what you think, looking forward to getting this fixed.

Cheers,
Codruț

www.codrut.pro

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-moving-directories-with-the-same-name-to-trash.patch --]
[-- Type: text/x-patch; name=0001-Fix-moving-directories-with-the-same-name-to-trash.patch, Size: 1942 bytes --]

From 8aa1e9c9e55d4d3c857048b2bc5f52066d953ac7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Codru=C8=9B=20Constantin=20Gu=C8=99oi?=
 <mail+emacs@codrut.pro>
Date: Fri, 7 May 2021 19:20:45 +0100
Subject: Fix moving directories with the same name to trash

Refs: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47135

To reproduce, save this to a `bug.el` file:

```elisp
(setq delete-by-moving-to-trash t)

(let ((test-dir "~/test123"))
  (progn
    (message "Creating directory: 1")
    (make-directory test-dir)
    (message "Deleting directory: 1")
    (delete-directory test-dir t t)

    (message "Creating directory: 2")
    (make-directory test-dir)
    (message "Deleting directory: 2")
    (delete-directory test-dir t t)

    (message "Success!")))
```

And execute with: `emacs -nw -Q -l ./bug.el`.

Expected: "Success!"
Actual: "Renaming: Not a directory, /home/me/test123,
/home/me/.local/share/Trash/files/test123Wiibmk"

Looks like the code was creating a temp file in the trash bin and then
trying to move the directory overwriting it. I assume the intent was to
only get a unique file name, and not actually create a file, reason why
I canged the function call to be `make-temp-name`.
---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 93a0e07aba..da33ee815f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7932,7 +7932,7 @@ move-file-to-trash
                         (expand-file-name files-base trash-files-dir))
                    (setq overwrite t
                          files-base (file-name-nondirectory
-                                     (make-temp-file
+                                     (make-temp-name
                                       (expand-file-name
                                        files-base trash-files-dir)))))
 		 (setq info-fn (expand-file-name
-- 
2.31.1


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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-07 19:31 bug#48280: 28.0.50; Fix moving directories with the same name to trash mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-08 11:40 ` Lars Ingebrigtsen
  2021-05-08 11:44   ` Lars Ingebrigtsen
  2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-08 11:40 UTC (permalink / raw)
  To: Codruț Constantin Gușoi; +Cc: 48280

Codruț Constantin Gușoi <mail@codrut.pro> writes:

> I've attached a patch for this bug I was dealing with while trying out
> 28.0.50 commit a2842a11728336fc8110eedb5176ecfbe71bbc79.

Thanks; applied to Emacs 28.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

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





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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-08 11:40 ` Lars Ingebrigtsen
@ 2021-05-08 11:44   ` Lars Ingebrigtsen
  2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-08 11:44 UTC (permalink / raw)
  To: Codruț Constantin Gușoi; +Cc: 48280

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Thanks; applied to Emacs 28.

This problem is also talked about in bug#47960, and I think the patch
there is more correct, so I've reverted your patch for now.

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





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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-08 11:40 ` Lars Ingebrigtsen
  2021-05-08 11:44   ` Lars Ingebrigtsen
@ 2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-08 12:03     ` Lars Ingebrigtsen
  2021-05-19 10:29     ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 8+ messages in thread
From: mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-08 11:53 UTC (permalink / raw)
  To: larsi; +Cc: 48280

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Hello Lars,

Yes, I'm willing to sing the documents but I'll required alot of hand holding throughout the process. Please be patient with me, let's discuss this outside of the bug report mailing list.

Cheers,
Codruț

www.codrut.pro
-------- Original Message --------
On 8 May 2021, 12:40, Lars Ingebrigtsen wrote:

> Codruț Constantin Gușoi <mail@codrut.pro> writes:
>
>> I've attached a patch for this bug I was dealing with while trying out
>> 28.0.50 commit a2842a11728336fc8110eedb5176ecfbe71bbc79.
>
> Thanks; applied to Emacs 28.
>
> This change was small enough to apply without assigning copyright to the
> FSF, but for future patches you want to submit, it might make sense to
> get the paperwork started now, so that subsequent patches can be applied
> speedily. Would you be willing to sign such paperwork?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #2: Type: text/html, Size: 1215 bytes --]

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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-08 12:03     ` Lars Ingebrigtsen
  2021-05-19 10:29     ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-08 12:03 UTC (permalink / raw)
  To: 48280

Codruț Constantin Gușoi <mail@codrut.pro> writes:

> Yes, I'm willing to sing the documents but I'll required alot of hand holding
> throughout the process. Please be patient with me, let's discuss this outside of the
> bug report mailing list.

(Form sent off-list.)

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





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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-08 12:03     ` Lars Ingebrigtsen
@ 2021-05-19 10:29     ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-24 22:23       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-19 10:29 UTC (permalink / raw)
  To: larsi; +Cc: 48280

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

Hello again,

Looks like this issue is still present, my patch has been reverted and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47960#19 was not applied.

Honestly I don't really care which ones gets done as long as we have a fix merged in. Is there anything I can do to get this moving?

Cheers,
Codruț

www.codrut.pro

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 8th, 2021 at 12:53 PM, Codruț Constantin Gușoi <mail@codrut.pro> wrote:

> Hello Lars,
>
> Yes, I'm willing to sing the documents but I'll required alot of hand holding throughout the process. Please be patient with me, let's discuss this outside of the bug report mailing list.
>
> Cheers,
> Codruț
>
> www.codrut.pro
> -------- Original Message --------
> On 8 May 2021, 12:40, Lars Ingebrigtsen < larsi@gnus.org> wrote:
>
>> Codruț Constantin Gușoi <mail@codrut.pro> writes:
>>
>>> I've attached a patch for this bug I was dealing with while trying out
>>> 28.0.50 commit a2842a11728336fc8110eedb5176ecfbe71bbc79.
>>
>> Thanks; applied to Emacs 28.
>>
>> This change was small enough to apply without assigning copyright to the
>> FSF, but for future patches you want to submit, it might make sense to
>> get the paperwork started now, so that subsequent patches can be applied
>> speedily. Would you be willing to sign such paperwork?
>>
>> --
>> (domestic pets only, the antidote for overdose, milk.)
>> bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #2: Type: text/html, Size: 2416 bytes --]

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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-19 10:29     ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-24 22:23       ` Lars Ingebrigtsen
  2021-05-24 23:11         ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-24 22:23 UTC (permalink / raw)
  To: Codruț Constantin Gușoi; +Cc: 48280

Codruț Constantin Gușoi <mail@codrut.pro> writes:

> Looks like this issue is still present, my patch has been reverted and
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47960#19 was not applied.
>
> Honestly I don't really care which ones gets done as long as we have a fix merged
> in. Is there anything I can do to get this moving?

We were just waiting for Gregory's paperwork to be completed before
applying his patch.  That's now complete, and I've now applied the fix.

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





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

* bug#48280: 28.0.50; Fix moving directories with the same name to trash
  2021-05-24 22:23       ` Lars Ingebrigtsen
@ 2021-05-24 23:11         ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 8+ messages in thread
From: mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-24 23:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 48280

Awesome, just compiled it and it works perfectly! Thank you for the help.

Cheers,
Codruț

www.codrut.pro

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Monday, May 24th, 2021 at 11:23 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Codruț Constantin Gușoi mail@codrut.pro writes:
>
> > Looks like this issue is still present, my patch has been reverted and
> >
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47960#19 was not applied.
> >
> > Honestly I don't really care which ones gets done as long as we have a fix merged
> >
> > in. Is there anything I can do to get this moving?
>
> We were just waiting for Gregory's paperwork to be completed before
>
> applying his patch. That's now complete, and I've now applied the fix.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> (domestic pets only, the antidote for overdose, milk.)
>
> bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-05-24 23:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 19:31 bug#48280: 28.0.50; Fix moving directories with the same name to trash mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-08 11:40 ` Lars Ingebrigtsen
2021-05-08 11:44   ` Lars Ingebrigtsen
2021-05-08 11:53   ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-08 12:03     ` Lars Ingebrigtsen
2021-05-19 10:29     ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-24 22:23       ` Lars Ingebrigtsen
2021-05-24 23:11         ` mail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).