unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows
@ 2018-10-08 14:44 Jordan Wilson
  2018-10-08 20:02 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jordan Wilson @ 2018-10-08 14:44 UTC (permalink / raw)
  To: 32989


Hi,

I'm running Emacs 26.1 on Windows 10. I've replicated this with "emacs -Q"

In a gnus article buffer, opening a PDF attachment in doc-view causes
doc-view to fail with the error:
  File error: "Opening output file", "Invalid argument", "c:/Users/Jordan/Emacs/.cache/docview-cache/ *mm*-012345" 

this leaves a buffer showing the file literally. If I rename that buffer
to something not containing an asterisk, it displays fine when running
"doc-view-mode". Windows apparently can't handle asterisks in
directory/file names.

Thanks



In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-29 built on TPW550S
Windowing system distributor 'Microsoft Corp.', version 10.0.17134

Configured using:
 'configure --without-compress-install --without-dbus --with-modules
 'CFLAGS= -O2 -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND NOTIFY ACL GNUTLS LIBXML2
ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS LCMS2

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

-- 
Jordan Wilson
    Sent from Gnus v5.13, GNU Emacs 26.1





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

* bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows
  2018-10-08 14:44 bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows Jordan Wilson
@ 2018-10-08 20:02 ` Eli Zaretskii
  2018-10-10 10:45   ` Jordan Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-10-08 20:02 UTC (permalink / raw)
  To: Jordan Wilson; +Cc: 32989

> From: Jordan Wilson <jordan.t.wilson@gmx.com>
> Date: Mon, 08 Oct 2018 15:44:55 +0100
> 
>   File error: "Opening output file", "Invalid argument", "c:/Users/Jordan/Emacs/.cache/docview-cache/ *mm*-012345" 
> 
> this leaves a buffer showing the file literally. If I rename that buffer
> to something not containing an asterisk, it displays fine when running
> "doc-view-mode". Windows apparently can't handle asterisks in
> directory/file names.

Windows doesn't allow '*' (and a few other characters) in any file
name, not just in directory name.  Gnus should run the file name
through convert-standard-filename to get something that is guaranteed
to work on any filesystem.





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

* bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows
  2018-10-08 20:02 ` Eli Zaretskii
@ 2018-10-10 10:45   ` Jordan Wilson
  2018-10-28 22:57     ` Jordan Wilson
  2018-11-03  8:32     ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Jordan Wilson @ 2018-10-10 10:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 32989

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

On 2018-10-08 (Mon) at 23:02 (ZZZ), Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Jordan Wilson <jordan.t.wilson@gmx.com>
>> Date: Mon, 08 Oct 2018 15:44:55 +0100
>> 
>>   File error: "Opening output file", "Invalid argument", "c:/Users/Jordan/Emacs/.cache/docview-cache/ *mm*-012345" 
>> 
>> this leaves a buffer showing the file literally. If I rename that buffer
>> to something not containing an asterisk, it displays fine when running
>> "doc-view-mode". Windows apparently can't handle asterisks in
>> directory/file names.
>
> Windows doesn't allow '*' (and a few other characters) in any file
> name, not just in directory name.  Gnus should run the file name
> through convert-standard-filename to get something that is guaranteed
> to work on any filesystem.
Looking, it seems to be on doc-view's side -- if a buffer isn't
associated with a file, it uses the buffer name for the file's cache
directory. Here's a patch to the 26 and trunk branches of doc-view.el to
run the file names through `convert-standard-filename'. It fixes the
problem for me, at least.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: doc-view-26.diff --]
[-- Type: text/x-patch, Size: 2692 bytes --]

--- doc-view-26.el	2018-10-09 16:27:18.890549900 +0100
+++ doc-view-26-2.el	2018-10-09 16:29:04.122599100 +0100
@@ -1772,27 +1772,28 @@
     (doc-view-make-safe-dir doc-view-cache-directory)
     ;; Handle compressed files, remote files, files inside archives
     (setq-local doc-view--buffer-file-name
-                (cond
-                 (jka-compr-really-do-compress
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (file-name-nondirectory
-                    (file-name-sans-extension buffer-file-name))
-                   doc-view-cache-directory))
-                 ;; Is the file readable by local processes?
-                 ;; We used to use `file-remote-p' but it's unclear what it's
-                 ;; supposed to return nil for things like local files accessed
-                 ;; via `su' or via file://...
-                 ((let ((file-name-handler-alist nil))
-                    (not (and buffer-file-name
-                              (file-readable-p buffer-file-name))))
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (if buffer-file-name
-                       (file-name-nondirectory buffer-file-name)
-                     (buffer-name))
-                   doc-view-cache-directory))
-                 (t buffer-file-name)))
+		(convert-standard-filename
+                 (cond
+                  (jka-compr-really-do-compress
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (file-name-nondirectory
+                     (file-name-sans-extension buffer-file-name))
+                    doc-view-cache-directory))
+                  ;; Is the file readable by local processes?
+                  ;; We used to use `file-remote-p' but it's unclear what it's
+                  ;; supposed to return nil for things like local files accessed
+                  ;; via `su' or via file://...
+                  ((let ((file-name-handler-alist nil))
+                     (not (and buffer-file-name
+                               (file-readable-p buffer-file-name))))
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (if buffer-file-name
+			(file-name-nondirectory buffer-file-name)
+                      (buffer-name))
+                    doc-view-cache-directory))
+                  (t buffer-file-name))))
     (when (not (string= doc-view--buffer-file-name buffer-file-name))
       (write-region nil nil doc-view--buffer-file-name))
 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: doc-view-trunk.diff --]
[-- Type: text/x-patch, Size: 2733 bytes --]

--- doc-view-trunk.el	2018-10-09 16:31:48.000000000 +0100
+++ doc-view-trunk-2.el	2018-10-09 16:31:31.502299800 +0100
@@ -1764,27 +1764,28 @@
     (doc-view-make-safe-dir doc-view-cache-directory)
     ;; Handle compressed files, remote files, files inside archives
     (setq-local doc-view--buffer-file-name
-                (cond
-                 (jka-compr-really-do-compress
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (file-name-nondirectory
-                    (file-name-sans-extension buffer-file-name))
-                   doc-view-cache-directory))
-                 ;; Is the file readable by local processes?
-                 ;; We used to use `file-remote-p' but it's unclear what it's
-                 ;; supposed to return nil for things like local files accessed
-                 ;; via `su' or via file://...
-                 ((let ((file-name-handler-alist nil))
-                    (not (and buffer-file-name
-                              (file-readable-p buffer-file-name))))
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (if buffer-file-name
-                       (file-name-nondirectory buffer-file-name)
-                     (buffer-name))
-                   doc-view-cache-directory))
-                 (t buffer-file-name)))
+                (convert-standard-filename
+                 (cond
+                  (jka-compr-really-do-compress
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (file-name-nondirectory
+                     (file-name-sans-extension buffer-file-name))
+                    doc-view-cache-directory))
+                  ;; Is the file readable by local processes?
+                  ;; We used to use `file-remote-p' but it's unclear what it's
+                  ;; supposed to return nil for things like local files accessed
+                  ;; via `su' or via file://...
+                  ((let ((file-name-handler-alist nil))
+                     (not (and buffer-file-name
+                               (file-readable-p buffer-file-name))))
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (if buffer-file-name
+                        (file-name-nondirectory buffer-file-name)
+                      (buffer-name))
+                    doc-view-cache-directory))
+                  (t buffer-file-name))))
     (when (not (string= doc-view--buffer-file-name buffer-file-name))
       (write-region nil nil doc-view--buffer-file-name))
 

[-- Attachment #4: Type: text/plain, Size: 59 bytes --]

-- 
Jordan Wilson
    Sent from Gnus v5.13, GNU Emacs 26.1

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

* bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows
  2018-10-10 10:45   ` Jordan Wilson
@ 2018-10-28 22:57     ` Jordan Wilson
  2018-11-03  8:32     ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Jordan Wilson @ 2018-10-28 22:57 UTC (permalink / raw)
  To: Jordan Wilson; +Cc: 32989

I was just wondering if these are going to be applied? It's a pretty
easy fix.

On 2018-10-10 (Wed) at 11:45 (+01), Jordan Wilson <jordan.t.wilson@gmx.com> wrote:
>Here's a patch to the 26 and trunk branches of doc-view.el to
> run the file names through `convert-standard-filename'. It fixes the
> problem for me, at least.
-- 
Jordan Wilson
    Sent from Gnus v5.13, GNU Emacs 26.1





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

* bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows
  2018-10-10 10:45   ` Jordan Wilson
  2018-10-28 22:57     ` Jordan Wilson
@ 2018-11-03  8:32     ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-11-03  8:32 UTC (permalink / raw)
  To: Jordan Wilson; +Cc: 32989-done

> From: Jordan Wilson <jordan.t.wilson@gmx.com>
> Cc: 32989@debbugs.gnu.org
> Date: Wed, 10 Oct 2018 11:45:57 +0100
> 
> 
> [1:text/plain Hide]
> 
> On 2018-10-08 (Mon) at 23:02 (ZZZ), Eli Zaretskii <eliz@gnu.org> wrote:
> >> From: Jordan Wilson <jordan.t.wilson@gmx.com>
> >> Date: Mon, 08 Oct 2018 15:44:55 +0100
> >> 
> >>   File error: "Opening output file", "Invalid argument", "c:/Users/Jordan/Emacs/.cache/docview-cache/ *mm*-012345" 
> >> 
> >> this leaves a buffer showing the file literally. If I rename that buffer
> >> to something not containing an asterisk, it displays fine when running
> >> "doc-view-mode". Windows apparently can't handle asterisks in
> >> directory/file names.
> >
> > Windows doesn't allow '*' (and a few other characters) in any file
> > name, not just in directory name.  Gnus should run the file name
> > through convert-standard-filename to get something that is guaranteed
> > to work on any filesystem.
> Looking, it seems to be on doc-view's side -- if a buffer isn't
> associated with a file, it uses the buffer name for the file's cache
> directory. Here's a patch to the 26 and trunk branches of doc-view.el to
> run the file names through `convert-standard-filename'. It fixes the
> problem for me, at least.

Thanks, pushed to the emacs-26 branch (will be merged to master from
there shortly).





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

end of thread, other threads:[~2018-11-03  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 14:44 bug#32989: 26.1; Opening PDF attachments in Gnus with doc-view-mode causes error on Windows Jordan Wilson
2018-10-08 20:02 ` Eli Zaretskii
2018-10-10 10:45   ` Jordan Wilson
2018-10-28 22:57     ` Jordan Wilson
2018-11-03  8:32     ` Eli Zaretskii

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