GNU bug report logs - #57961
29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on macOS

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Daniel Martín <mardani29@HIDDEN>; Keywords: patch; dated Tue, 20 Sep 2022 20:54:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 57961 <at> debbugs.gnu.org:


Received: (at 57961) by debbugs.gnu.org; 21 Sep 2022 11:42:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 21 07:42:25 2022
Received: from localhost ([127.0.0.1]:60939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oay7V-0000Sv-50
	for submit <at> debbugs.gnu.org; Wed, 21 Sep 2022 07:42:25 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36610)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oay7T-0000Si-45
 for 57961 <at> debbugs.gnu.org; Wed, 21 Sep 2022 07:42:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=MN8gbkI6OaKoSDTmlSnpBhCssD+Schj82klN9g7m3Qw=; b=ohujxoHmsE5+Mj092HkKG4nvVd
 R8OzSfV1XVVreuMGSTT51v6+p9KBg4IQme2BVQHk26FbF8yqnPi9qgDyN5Md0a8JQJAh6WeHF0OsG
 tPySa1KkXKQvfdF6qA6IBNjpIWHPgR3YaY1V1p7sOVPOf0b3BGx5QDd625z9bhU2I1CM=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oay7K-0004Zk-LR; Wed, 21 Sep 2022 13:42:17 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= <mardani29@HIDDEN>
Subject: Re: bug#57961: 29.0.50; [PATCH] image-dired thumbnail generation
 fails for PDFs on macOS
In-Reply-To: <m14jx1n4xs.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?=
 message of "Tue, 20 Sep 2022 22:53:19 +0200")
References: <m14jx1n4xs.fsf.ref@HIDDEN> <m14jx1n4xs.fsf@HIDDEN>
X-Now-Playing: Niki Mono's _Contradictions are a Luxury_: "I Am Your Feeling"
Date: Wed, 21 Sep 2022 13:42:14 +0200
Message-ID: <87sfkl6jjd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  Daniel Martín <mardani29@HIDDEN> writes: > I've created
    this patch so that PDF thumbnails get the correct JPG or > PNG extension.
    That fixes the problem on macOS, at least. > > Any ideas if the logic is
   correct and makes sense? Thanks. 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57961
Cc: 57961 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Daniel Mart=C3=ADn <mardani29@HIDDEN> writes:

> I've created this patch so that PDF thumbnails get the correct JPG or
> PNG extension.  That fixes the problem on macOS, at least.
>
> Any ideas if the logic is correct and makes sense?  Thanks.

I think the patch makes sense.  Perhaps Stefan has some comments; added
to the CCs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57961; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Sep 2022 20:53:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 20 16:53:37 2022
Received: from localhost ([127.0.0.1]:59854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oakFM-0002BP-Qv
	for submit <at> debbugs.gnu.org; Tue, 20 Sep 2022 16:53:37 -0400
Received: from lists.gnu.org ([209.51.188.17]:45434)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1oakFJ-0002BC-BK
 for submit <at> debbugs.gnu.org; Tue, 20 Sep 2022 16:53:36 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54796)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oakFI-0005O7-GA
 for bug-gnu-emacs@HIDDEN; Tue, 20 Sep 2022 16:53:33 -0400
Received: from sonic311-31.consmr.mail.ir2.yahoo.com ([77.238.176.163]:45716)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oakFE-0006gJ-LT
 for bug-gnu-emacs@HIDDEN; Tue, 20 Sep 2022 16:53:31 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1663707202; bh=VNDQkMfeSg39FKZfoog+SqsSJ66tAeH5jMDsU8CSHKM=;
 h=From:To:Subject:Date:References:From:Subject:Reply-To;
 b=ABjuQZWQkpf90OVQbqJdL2KstDWYHEO4UZmXJ5fxtyd67Tp3w7RBtZ6KyKyFXK98I2Q3AOrY45B/lE9VSfMBy2LkzKTmtVm8gl6bZt/6psRowA55aH0IHt6otnhrBuxuadgB665wsFsYufG5bV9amg94H4pqcHILVbxr6ht4J9qpYmujMAyv1fgkjCF2dPyOm0g+PDOzhdOFUwY6gAFBqQIRqYWvCRRRgFbL/aC/7RVERRDYEzNBLrBj2oMpfmWKXGK7xpSTzRs8sm+DJowDUdqzvfaMGzOJDuedSlXNkxcYr7FVY7aGKNSTXReTBNG/v9Q2bh+hLCO851oZk4dupA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1663707202; bh=PjiPXd2RGA9WA1iC+9xzUL5rcP80O5G0AVGvsKeRlR6=;
 h=X-Sonic-MF:From:To:Subject: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hBWxZ62SL6oChdTY2_i6U1hMvLZneKJbpC1XJ5FNByk_dpUnm2NbXGtwdHx4huYCyJ90QO4I
 ny.7zMWcFxwl6JUerOWjNUynWPP_eM2xdBiha2McLOhGT231EJJWGoa1aDrYrdu5B.FmmNi09Zj7
 kEGFY19h6eqCR1bHdLrk8rM1BUW2q.mjE7rji6oPzoKlQqIRg1Mp4M20e_eXZkUDv6ZnjysD.Mk4
 TWhHoLQWXT4nNp92rNFa_Nt9yGM8WNTvvE1V1Bz9VG8jMP_fE4iQ9GPZb9iBVe_0_z5uAFMmBOi8
 sbDs0kdcGowrq02v68YTRFl5praICAZDCF_GHd7OnORlQ5F1P6G3RKGcesn1L7gCsn5VlG.m48tH
 HX459pYLp.Nzax10.FHzIaqszRa_9a28sdIRZ9aV6GM81sM9XCAirzdqEcqs6b4vjfaFDtg7uq7K
 HhGK8_gilGEGpMj.F0ZhBQgMapxkXoxodGMOnIb4zuvCTdBFFMPz05UJbk6Lk3dwzgTExuf6wXp4
 7JDq9VRHSS2VRIL7vgA--
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic311.consmr.mail.ir2.yahoo.com with HTTP; Tue, 20 Sep 2022 20:53:22 +0000
Received: by hermes--production-ir2-6787885cb-wkhbw (Yahoo Inc. Hermes SMTP
 Server) with ESMTPA ID 6b74899f1404799fabd942eefa309415; 
 Tue, 20 Sep 2022 20:53:20 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; [PATCH] image-dired thumbnail generation fails for PDFs on
 macOS
Date: Tue, 20 Sep 2022 22:53:19 +0200
Message-ID: <m14jx1n4xs.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
References: <m14jx1n4xs.fsf.ref@HIDDEN>
X-Mailer: WebService/1.1.20663
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 6301
Received-SPF: pass client-ip=77.238.176.163; envelope-from=mardani29@HIDDEN;
 helo=sonic311-31.consmr.mail.ir2.yahoo.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain


I tried the new PDF thumbnail generation feature in image-dired and I
got the following error in the macOS console, and the thumbnails are
blank:

CoreGraphics PDF has logged an error. Set environment variable
"CG_PDF_VERBOSE" to learn more

The reason seems to be that the thumbnails are actually JPG files, but
they are created with PDF extension, so the image loading code in the NS
port sees the extension and tries to search for a %PDF marker in the
file, which always fails.

I've created this patch so that PDF thumbnails get the correct JPG or
PNG extension.  That fixes the problem on macOS, at least.

Any ideas if the logic is correct and makes sense?  Thanks.

In GNU Emacs 29.0.50 (build 3, aarch64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6 (Build 21G115)) of 2022-09-20 built on
 Daniels-MacBook-Pro.local
Repository revision: 1231a601ebe1fd9fe454c504dbeb9267440242e7
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.6

Configured using:
 'configure CPPFLAGS=-I/opt/homebrew/opt/openjdk@11/include'

Configured features:
ACL DBUS GLIB GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS WEBP XIM ZLIB

Important settings:
  value of $LANG: en_ES.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-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
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822
mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date subr-x misearch multi-isearch
format-spec vc-git diff-mode easy-mmode vc-dispatcher image-file
image-converter dired-aux image-dired image-dired-tags
image-dired-external image-dired-util image-mode wallpaper xdg exif
cl-loaddefs cl-lib dired dired-loaddefs rmc iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 82066 6542)
 (symbols 48 6208 0)
 (strings 32 19408 2168)
 (string-bytes 1 585126)
 (vectors 16 11857)
 (vector-slots 8 170638 10214)
 (floats 8 39 25)
 (intervals 56 5237 164)
 (buffers 1000 12))


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-a-bug-where-PDF-thumbnails-were-stored-with-PDF-.patch

From 37583170eff4858b6bd288cc78e2ec967ee0073f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@HIDDEN>
Date: Tue, 20 Sep 2022 22:27:56 +0200
Subject: [PATCH] Fix a bug where PDF thumbnails were stored with PDF extension

* lisp/image/image-dired-util.el (image-dired-file-name-extension):
New function to compute the filename extension for a thumbnail.  This
new function ensures that the extension of a PDF thumbnail is either
JPG or PNG.
* lisp/image/image-dired-util.el (image-dired-thumb-name): Use the new
function.
---
 lisp/image/image-dired-util.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el
index dcf0b22cfe..89513f9441 100644
--- a/lisp/image/image-dired-util.el
+++ b/lisp/image/image-dired-util.el
@@ -57,6 +57,19 @@ image-dired-dir
       (message "Thumbnail directory created: %s" image-dired-dir))
     image-dired-dir))
 
+(defun image-dired-file-name-extension (file)
+  "Return the filename extension for thumbnail FILE.
+Return the value of `file-name-extension', but for PDF files
+return PNG or JPG, depending on the thumbnail storage
+configuration."
+  (let ((extension (file-name-extension file)))
+    (cond ((string-equal extension "pdf")
+           (cond ((memq image-dired-thumbnail-storage
+                        image-dired--thumbnail-standard-sizes)
+                  "png")
+                 (t "jpg")))
+          (t extension))))
+
 (defun image-dired-thumb-name (file)
   "Return absolute file name for thumbnail FILE.
 Depending on the value of `image-dired-thumbnail-storage', the
@@ -91,13 +104,13 @@ image-dired-thumb-name
                    (file-name-as-directory (expand-file-name (image-dired-dir)))
                    (file-name-base f)
                    (if hash (concat "_" hash) "")
-                   (file-name-extension f))))
+                   (image-dired-file-name-extension f))))
         ((eq 'per-directory image-dired-thumbnail-storage)
          (let ((f (expand-file-name file)))
            (format "%s.image-dired/%s.thumb.%s"
                    (file-name-directory f)
                    (file-name-base f)
-                   (file-name-extension f))))))
+                   (image-dired-file-name-extension f))))))
 
 (defvar image-dired-thumbnail-buffer "*image-dired*"
   "Image-Dired's thumbnail buffer.")
-- 
2.34.1


--=-=-=--




Acknowledgement sent to Daniel Martín <mardani29@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#57961; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 21 Sep 2022 11:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.