* bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars
@ 2019-04-27 9:36 Tino Calancha
2019-04-27 10:05 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2019-04-27 9:36 UTC (permalink / raw)
To: 35448
emacs -Q
;; Do the following recipe in an empty directory
C-x b schrodinger:cat RET
Miauuuu!!!
C-x C-s RET
;; A message in the minibuffer confirms the name of the file writen to disk.
;; Apparentely, the base name of such a file matches the buffer name.
M-: (file-exists-p buffer-file-name)
=> t
M-: (string= (file-name-nondirectory buffer-file-name) (buffer-name))
=> t
;; In fact, no file matches the buffer name in the directory
M-: (directory-files default-directory nil (buffer-name))
=> nil
;; There is an _empty_ file with name, the buffer name upto the colon
M-: (directory-files default-directory nil "schrod")
=> ("schrodinger")
M-: (with-temp-buffer
(insert-file-contents "schrodinger")
(buffer-size))
=> 0
--8<-----------------------------cut here---------------start------------->8---
diff --git a/lisp/files.el b/lisp/files.el
index c05d70a00e..93600d2edb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5106,6 +5106,9 @@ basic-save-buffer
(expand-file-name
(read-file-name "File to save in: "
nil (expand-file-name (buffer-name))))))
+ (when (and (eq 'windows-nt system-type)
+ (string-match-p "[:*?\"<>]" (file-name-nondirectory filename)))
+ (error "A file name cannot contain any of the following characters: :*?\"<>"))
(if (file-exists-p filename)
(if (file-directory-p filename)
;; Signal an error if the user specified the name of an
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
of 2019-04-13 built on CIRROCUMULUS
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor 'Microsoft Corp.', version 10.0.17763
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS THREADS LCMS2
Important settings:
value of $LANG: ENU
locale-coding-system: cp1252
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 mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame 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 minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads w32notify w32 lcms2 multi-tty make-network-process
emacs)
Memory information:
((conses 16 97250 8162)
(symbols 48 20206 1)
(miscs 40 40 94)
(strings 32 29729 1209)
(string-bytes 1 773709)
(vectors 16 14066)
(vector-slots 8 496277 12810)
(floats 8 51 284)
(intervals 56 250 17)
(buffers 992 11))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars
2019-04-27 9:36 bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars Tino Calancha
@ 2019-04-27 10:05 ` Eli Zaretskii
2019-04-27 11:14 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-04-27 10:05 UTC (permalink / raw)
To: Tino Calancha; +Cc: 35448
> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Sat, 27 Apr 2019 18:36:14 +0900
>
>
> emacs -Q
> ;; Do the following recipe in an empty directory
>
> C-x b schrodinger:cat RET
> Miauuuu!!!
> C-x C-s RET
> ;; A message in the minibuffer confirms the name of the file writen to disk.
> ;; Apparentely, the base name of such a file matches the buffer name.
> M-: (file-exists-p buffer-file-name)
> => t
> M-: (string= (file-name-nondirectory buffer-file-name) (buffer-name))
> => t
>
>
> ;; In fact, no file matches the buffer name in the directory
> M-: (directory-files default-directory nil (buffer-name))
> => nil
>
> ;; There is an _empty_ file with name, the buffer name upto the colon
> M-: (directory-files default-directory nil "schrod")
> => ("schrodinger")
It's a feature. See
https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_(ADS)
http://www.flexhex.com/docs/articles/alternate-streams.phtml
Whether we should allow this in Emacs is a different matter, but this
was supported since day one, FWIW.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars
2019-04-27 10:05 ` Eli Zaretskii
@ 2019-04-27 11:14 ` Eli Zaretskii
2019-04-27 11:22 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-04-27 11:14 UTC (permalink / raw)
To: tino.calancha; +Cc: 35448
> Date: Sat, 27 Apr 2019 13:05:05 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 35448@debbugs.gnu.org
>
> > M-: (directory-files default-directory nil "schrod")
> > => ("schrodinger")
>
> It's a feature. See
>
> https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_(ADS)
> http://www.flexhex.com/docs/articles/alternate-streams.phtml
And to see that your cat's meow is not lost, try this:
C-u M-! streams schrodinger RET
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars
2019-04-27 11:14 ` Eli Zaretskii
@ 2019-04-27 11:22 ` Eli Zaretskii
2019-05-04 8:44 ` Tino Calancha
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-04-27 11:22 UTC (permalink / raw)
To: tino.calancha; +Cc: 35448
> Date: Sat, 27 Apr 2019 14:14:35 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 35448@debbugs.gnu.org
>
> > https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_(ADS)
> > http://www.flexhex.com/docs/articles/alternate-streams.phtml
>
> And to see that your cat's meow is not lost, try this:
>
> C-u M-! streams schrodinger RET
Even better, kill the buffer and then "C-x C-f schrodinger:cat RET".
(A program such as 'cat' will also show the text.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars
2019-04-27 11:22 ` Eli Zaretskii
@ 2019-05-04 8:44 ` Tino Calancha
0 siblings, 0 replies; 5+ messages in thread
From: Tino Calancha @ 2019-05-04 8:44 UTC (permalink / raw)
To: 35448-done
Eli Zaretskii <eliz@gnu.org> writes:
I saw the cat meow.
Since this is a feature I wasn't aware of, not a bug, then I am closing this bug.
>> > https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_(ADS)
>> > http://www.flexhex.com/docs/articles/alternate-streams.phtml
>>
>> And to see that your cat's meow is not lost, try this:
>>
>> C-u M-! streams schrodinger RET
>
> Even better, kill the buffer and then "C-x C-f schrodinger:cat RET".
> (A program such as 'cat' will also show the text.)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-04 8:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-27 9:36 bug#35448: 26.2; save-buffer silently fails in winNT if buffer name has forbidden chars Tino Calancha
2019-04-27 10:05 ` Eli Zaretskii
2019-04-27 11:14 ` Eli Zaretskii
2019-04-27 11:22 ` Eli Zaretskii
2019-05-04 8:44 ` Tino Calancha
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).