From unknown Mon Jun 23 02:24:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13679: 24.2.93; doc-view-mode cannot handle PDFs whose filename contains a percentage sign Resent-From: Elias Pipping Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Feb 2013 18:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13679 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13679@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13605194191701 (code B ref -1); Sun, 10 Feb 2013 18:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Feb 2013 18:03:39 +0000 Received: from localhost ([127.0.0.1]:49293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4bFa-0000RO-Pg for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42086) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4bFY-0000RH-CD for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4bEE-0002Rs-R9 for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:40158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bEE-0002Ro-OV for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:02:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bCw-0005Cx-2u for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 13:02:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4bBR-0001nK-Dk for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 13:00:54 -0500 Received: from karen.lavabit.com ([72.249.41.33]:57082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bBR-0001mz-81 for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 12:59:21 -0500 Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id 1F6EF11BA86 for ; Sun, 10 Feb 2013 11:59:20 -0600 (CST) Received: from bogus (91-64-51-25-dynip.superkabel.de [91.64.51.25]) by lavabit.com with ESMTP id Y13TB2IFGHSP for ; Sun, 10 Feb 2013 11:59:20 -0600 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=R1YmxXuP5WoCGxItS1WYZh5wmbihhLm6KpwBjwO61mFcxD+Amr/kem/lqnW3fGjB5oEFYGI7EgGb1+2ZVNxnbUNxRQ4kgKvd5SWJ/ao21MhHRlOtK27Z3zYjm/zKxAy3BbPtaFlLy55EJsIS3J3dUtVFmwYC3tM9GYoVFc7WRAg=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; From: Elias Pipping Date: Sun, 10 Feb 2013 18:59:05 +0100 Message-ID: <87halk1252.fsf@lavabit.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --=-=-= Content-Type: text/plain Hi, doc-view-mode currently calls either ghostscript or mupdf's mudraw to render PDFs to PNG images. Both tools interpret a percentage sign in the name of the target file as a format instruction. Since doc-view's cache directory is named after the input PDF, whose name can contain percentage signs, it, too, can contain percentage signs. As a result, doc-view mode cannot currently handle PDF files whose name contains a percentage sign. I've attached the simplest fix I could think of. Best regards, Elias Pipping --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Escape-percentage-signs.patch >From 2c35f04fc1191878b01b4ab07821e20fdc461511 Mon Sep 17 00:00:00 2001 From: Elias Pipping Date: Sun, 10 Feb 2013 18:51:10 +0100 Subject: [PATCH] Escape percentage signs --- lisp/doc-view.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index e7d1ebc..18e17bd 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -675,6 +675,9 @@ at the top edge of the page moves to the previous page." (format "Unable to use temporary directory %s: %s" dir (mapconcat 'identity (cdr error) " ")))))))) +(defun doc-view-escape-percentage-sign (str) + (replace-regexp-in-string "%" "_" str)) + (defun doc-view-current-cache-dir () "Return the directory where the png files of the current doc should be saved. It's a subdirectory of `doc-view-cache-directory'." @@ -686,7 +689,8 @@ It's a subdirectory of `doc-view-cache-directory'." (setq doc-view-current-cache-dir (file-name-as-directory (expand-file-name - (concat (file-name-nondirectory doc-view-buffer-file-name) + (concat (doc-view-escape-percentage-sign + (file-name-nondirectory doc-view-buffer-file-name)) "-" (let ((file doc-view-buffer-file-name)) (with-temp-buffer -- 1.8.1.2 --=-=-=-- From unknown Mon Jun 23 02:24:16 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Elias Pipping Subject: bug#13679: closed (Re: bug#13679: 24.2.93; doc-view-mode cannot handle PDFs whose filename contains a percentage sign) Message-ID: References: <87halk1252.fsf@lavabit.com> X-Gnu-PR-Message: they-closed 13679 X-Gnu-PR-Package: emacs Reply-To: 13679@debbugs.gnu.org Date: Mon, 11 Feb 2013 19:32:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1360611121-8320-1" This is a multi-part message in MIME format... ------------=_1360611121-8320-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13679: 24.2.93; doc-view-mode cannot handle PDFs whose filename contains a= percentage sign which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13679@debbugs.gnu.org. --=20 13679: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13679 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1360611121-8320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13679-done) by debbugs.gnu.org; 11 Feb 2013 19:31:04 +0000 Received: from localhost ([127.0.0.1]:51143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4z5k-000293-CR for submit@debbugs.gnu.org; Mon, 11 Feb 2013 14:31:04 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:56349) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4z5j-00028u-5Y for 13679-done@debbugs.gnu.org; Mon, 11 Feb 2013 14:31:03 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpZnt/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpZnt/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="998441" Received: from 69-165-153-237.dsl.teksavvy.com (HELO pastel.home) ([69.165.153.237]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 11 Feb 2013 14:30:40 -0500 Received: by pastel.home (Postfix, from userid 20848) id A09B159255; Mon, 11 Feb 2013 14:30:40 -0500 (EST) From: Stefan Monnier To: Elias Pipping Subject: Re: bug#13679: 24.2.93; doc-view-mode cannot handle PDFs whose filename contains a percentage sign Message-ID: References: <87halk1252.fsf@lavabit.com> Date: Mon, 11 Feb 2013 14:30:40 -0500 In-Reply-To: <87halk1252.fsf@lavabit.com> (Elias Pipping's message of "Sun, 10 Feb 2013 18:59:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13679-done Cc: 13679-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I've attached the simplest fix I could think of. Looks good, thank you, installed in a slightly simpler form (using subst-char-in-string and without defining a separate function for it). Stefan ------------=_1360611121-8320-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Feb 2013 18:03:39 +0000 Received: from localhost ([127.0.0.1]:49293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4bFa-0000RO-Pg for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42086) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4bFY-0000RH-CD for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4bEE-0002Rs-R9 for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:03:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:40158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bEE-0002Ro-OV for submit@debbugs.gnu.org; Sun, 10 Feb 2013 13:02:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bCw-0005Cx-2u for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 13:02:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4bBR-0001nK-Dk for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 13:00:54 -0500 Received: from karen.lavabit.com ([72.249.41.33]:57082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4bBR-0001mz-81 for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 12:59:21 -0500 Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id 1F6EF11BA86 for ; Sun, 10 Feb 2013 11:59:20 -0600 (CST) Received: from bogus (91-64-51-25-dynip.superkabel.de [91.64.51.25]) by lavabit.com with ESMTP id Y13TB2IFGHSP for ; Sun, 10 Feb 2013 11:59:20 -0600 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=R1YmxXuP5WoCGxItS1WYZh5wmbihhLm6KpwBjwO61mFcxD+Amr/kem/lqnW3fGjB5oEFYGI7EgGb1+2ZVNxnbUNxRQ4kgKvd5SWJ/ao21MhHRlOtK27Z3zYjm/zKxAy3BbPtaFlLy55EJsIS3J3dUtVFmwYC3tM9GYoVFc7WRAg=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; From: Elias Pipping To: bug-gnu-emacs@gnu.org Subject: 24.2.93; doc-view-mode cannot handle PDFs whose filename contains a percentage sign Date: Sun, 10 Feb 2013 18:59:05 +0100 Message-ID: <87halk1252.fsf@lavabit.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --=-=-= Content-Type: text/plain Hi, doc-view-mode currently calls either ghostscript or mupdf's mudraw to render PDFs to PNG images. Both tools interpret a percentage sign in the name of the target file as a format instruction. Since doc-view's cache directory is named after the input PDF, whose name can contain percentage signs, it, too, can contain percentage signs. As a result, doc-view mode cannot currently handle PDF files whose name contains a percentage sign. I've attached the simplest fix I could think of. Best regards, Elias Pipping --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Escape-percentage-signs.patch >From 2c35f04fc1191878b01b4ab07821e20fdc461511 Mon Sep 17 00:00:00 2001 From: Elias Pipping Date: Sun, 10 Feb 2013 18:51:10 +0100 Subject: [PATCH] Escape percentage signs --- lisp/doc-view.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index e7d1ebc..18e17bd 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -675,6 +675,9 @@ at the top edge of the page moves to the previous page." (format "Unable to use temporary directory %s: %s" dir (mapconcat 'identity (cdr error) " ")))))))) +(defun doc-view-escape-percentage-sign (str) + (replace-regexp-in-string "%" "_" str)) + (defun doc-view-current-cache-dir () "Return the directory where the png files of the current doc should be saved. It's a subdirectory of `doc-view-cache-directory'." @@ -686,7 +689,8 @@ It's a subdirectory of `doc-view-cache-directory'." (setq doc-view-current-cache-dir (file-name-as-directory (expand-file-name - (concat (file-name-nondirectory doc-view-buffer-file-name) + (concat (doc-view-escape-percentage-sign + (file-name-nondirectory doc-view-buffer-file-name)) "-" (let ((file doc-view-buffer-file-name)) (with-temp-buffer -- 1.8.1.2 --=-=-=-- ------------=_1360611121-8320-1--