From: Michael Albinus <michael.albinus@gmx.de>
To: Vladimir Nikishkin <lockywolf@gmail.com>
Cc: 47493@debbugs.gnu.org
Subject: bug#47493: 27.1; auto-save-file-name-transforms with uniquify should not create invalid filenames
Date: Tue, 06 Apr 2021 20:40:29 +0200 [thread overview]
Message-ID: <87h7kjxnmq.fsf@gmx.de> (raw)
In-Reply-To: <87ft0d3wk1.fsf@gmx.de> (Michael Albinus's message of "Tue, 30 Mar 2021 09:55:26 +0200")
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
Michael Albinus <michael.albinus@gmx.de> writes:
Hi,
>> Would it be possible, to, maybe, add a flag "ensure-filesystem-correctness"?
>
> Maybe we could have a flag which means "convert the directory part of a
> file name into sha1" (or whatever `secure-hash' provides).
Nobody has commented. Well, in a couple of days I will push the appended
patch, unless there are objections.
>> Your sincerely,
>> Vladimir
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2036 bytes --]
*** /tmp/ediffH8hUs7 2021-04-06 20:36:48.215610320 +0200
--- /home/albinus/src/emacs/lisp/files.el 2021-04-06 20:36:13.439660165 +0200
***************
*** 392,397 ****
--- 392,403 ----
changed to `!' to prevent clashes. This will not work
correctly if your filesystem truncates the resulting name.
+ If the optional element UNIQUIFY is a symbol returned by function
+ `secure-hash-algorithms', the auto-save file name is constructed
+ by taking the directory part of the replaced file-name,
+ concatenated with the buffer file name run through `secure-hash'
+ instead. This returns a valid name for your filesystem any way.
+
All the transforms in the list are tried, in the order they are listed.
When one transform applies, its result is final;
no further transforms are tried.
***************
*** 6593,6606 ****
uniq (car (cddr (car list)))))
(setq list (cdr list)))
(if result
! (if uniq
! (setq filename (concat
! (file-name-directory result)
! (subst-char-in-string
! ?/ ?!
! (replace-regexp-in-string "!" "!!"
! filename))))
! (setq filename result)))
(setq result
(if (and (eq system-type 'ms-dos)
(not (msdos-long-file-names)))
--- 6599,6618 ----
uniq (car (cddr (car list)))))
(setq list (cdr list)))
(if result
! (setq filename
! (cond
! ((member uniq (secure-hash-algorithms))
! (concat
! (file-name-directory result)
! (secure-hash uniq filename)))
! (uniq
! (concat
! (file-name-directory result)
! (subst-char-in-string
! ?/ ?!
! (replace-regexp-in-string
! "!" "!!" filename))))
! (t result))))
(setq result
(if (and (eq system-type 'ms-dos)
(not (msdos-long-file-names)))
next prev parent reply other threads:[~2021-04-06 18:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 5:06 bug#47493: 27.1; auto-save-file-name-transforms with uniquify should not create invalid filenames Vladimir Nikishkin
2021-03-30 7:55 ` Michael Albinus
2021-04-06 18:40 ` Michael Albinus [this message]
2021-04-06 20:57 ` Glenn Morris
2021-04-07 8:24 ` Michael Albinus
2021-05-08 12:34 ` Lars Ingebrigtsen
2021-05-08 12:42 ` Michael Albinus
2021-05-09 9:58 ` Lars Ingebrigtsen
2021-05-10 11:46 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7kjxnmq.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=47493@debbugs.gnu.org \
--cc=lockywolf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).