unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
@ 2022-01-13 13:41 Thierry Volpiatto
  2022-01-13 19:53 ` Thierry Volpiatto
  0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2022-01-13 13:41 UTC (permalink / raw)
  To: 53229


Hello, 

the title says all, emacs-29 is creating new thumbnails instead of
reusing existing ones:

;; Emacs-27
(image-dired-get-thumbnail-image "~/Images/Astroman-2009-05-13/astroman-nath-100.jpg")
=>(image :type jpeg :file "/home/thierry/.emacs.d/image-dired/astroman-nath-100_3543f3094906282113616dab5f911376.thumb.jpg" :scale 1.0021052631578946)

;; Emacs-29
(image-dired-get-thumbnail-image "~/Images/Astroman-2009-05-13/astroman-nath-100.jpg")
=>(image :type jpeg :file "/home/thierry/.emacs.d/image-dired/astroman-nath-100_086271a8c0fa94a028dcc0407c24d954480afdfb.thumb.jpg" :scale 1.0021052631578946 :transform-smoothing t)



In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2022-01-13 built on IPad-S340
Repository revision: 626c1dce02d4f2e8d0822decf8b421eee00674b1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Linux Mint 20.2

Configured using:
 'configure CFLAGS=-O8 --with-mailutils --with-cairo
 --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: Ilisp

Minor modes in effect:
  global-undo-tree-mode: t
  undo-tree-mode: t
  psession-mode: t
  psession-savehist-mode: t
  global-git-gutter-mode: t
  display-time-mode: t
  winner-mode: t
  helm-epa-mode: t
  helm-descbinds-mode: t
  helm-adaptive-mode: t
  helm-mode: t
  helm-minibuffer-history-mode: t
  shell-dirtrack-mode: t
  helm-popup-tip-mode: t
  async-bytecomp-package-mode: t
  dired-async-mode: t
  minibuffer-depth-indicate-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/thierry/.emacs.d/elpa/seq-2.23/seq hides /usr/local/share/emacs/29.0.50/lisp/emacs-lisp/seq

Features:
(shadow epa-mail face-remap emacsbug helm-command addressbook-bookmark
mu4e-config org-mu4e mu4e-contrib mu4e-patch mu4e mu4e-org mu4e-view
mu4e-main mu4e-headers mu4e-lists mu4e-compose mu4e-draft mu4e-actions
smtpmail sendmail mu4e-search mu4e-bookmarks mu4e-mark mu4e-message
flow-fill hl-line mu4e-contacts mu4e-update mu4e-folders mu4e-server
mu4e-context mu4e-vars mu4e-helpers ido mu4e-meta epa-file em-unix
em-term term disp-table ehelp em-script em-prompt em-ls em-hist em-pred
em-glob em-cmpl em-dirs esh-var em-basic em-banner em-alias esh-mode
esh-toggle char-fold image-file image-converter image-dired
tramp-archive tramp-gvfs tramp-cache zeroconf help-fns radix-tree
cl-print debug markdown-mode sh-script smie executable flymake-proc
flymake project org-element avl-tree generator ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search
eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum shr pixel-fill kinsoku svg dom gnus-group
gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win ol-docview
doc-view ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi vc-filewise vc-rcs
conf-mode ledger-config ledger-mode ledger-check ledger-texi ledger-test
ledger-sort ledger-report ledger-reconcile ledger-occur ledger-fonts
ledger-fontify ledger-state ledger-complete ledger-schedule ledger-init
ledger-xact ledger-post ledger-exec ledger-navigate eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
ledger-context ledger-commodities ledger-regex jka-compr bug-reference
naquadah-theme view solar cal-dst holidays hol-loaddefs tv-utils
yaml-mode undo-tree diff rainbow-mode color psession frameset log-view
pcvs-util pcmpl-git cl-indent ffap thingatpt autocrypt-message message
yank-media rmc puny rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mailabbrev gmm-utils mailheader
autocrypt-gnus gnus nnheader gnus-util mail-utils mm-util mail-prsvr
autocrypt-mu4e autocrypt ietf-drums config-w3m git-gutter bookmark
mule-util appt diary-lib diary-loaddefs gud pcomplete-extension
pcmpl-unix pcmpl-gnu iterator pcase wdired dired-extension org-config
ob-gnuplot org-crypt net-utils time all-the-icons all-the-icons-faces
data-material data-weathericons data-octicons data-fileicons
data-faicons data-alltheicons winner autotest-mode autoconf-mode woman
man ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util init-helm helm-ls-git vc-git diff-mode vc
vc-dispatcher helm-fd epa derived epg rfc6068 epg-config helm-epa
helm-imenu imenu helm-elisp-package helm-find helm-org org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex ol
org-keys oc org-compat advice org-macs org-loaddefs cal-menu calendar
cal-loaddefs helm-external helm-net xml isearch-light helm-descbinds
cus-edit pp wid-edit helm-ipython helm-elisp helm-eval edebug backtrace
find-func helm-info python tramp-sh helm-adaptive helm-mode helm-misc
helm-files image-mode exif filenotify tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete parse-time
iso8601 time-date ls-lisp helm-buffers helm-occur helm-tags helm-locate
helm-grep wgrep-helm wgrep grep compile text-property-search comint
ansi-color ring helm-regexp format-spec helm-utils helm-help helm-types
helm-extensions-autoloads helm-config helm-autoloads helm async-bytecomp
helm-global-bindings helm-easymenu edmacro kmacro helm-source
helm-multi-match helm-lib dired-async dired-aux dired dired-loaddefs
async popup diminish mb-depth server comp comp-cstr warnings rx cl-extra
help-mode avoid cus-load use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq
seq-25 gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib
info w3m-load iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd 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 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice 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 inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1200277 245333)
 (symbols 48 45481 5)
 (strings 32 258149 63600)
 (string-bytes 1 7493915)
 (vectors 16 88331)
 (vector-slots 8 2292913 224889)
 (floats 8 1601 626)
 (intervals 56 41303 662)
 (buffers 992 110))
<#secure method=pgpmime mode=sign>

-- 
Thierry





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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-13 13:41 bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27 Thierry Volpiatto
@ 2022-01-13 19:53 ` Thierry Volpiatto
  2022-01-14  7:56   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Thierry Volpiatto @ 2022-01-13 19:53 UTC (permalink / raw)
  To: 53229

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


After further searching, I discover image-dired is using sha1 to build
thumbnail filenames whereas in emacs-27 it uses md5, so the names are
differents and a new file is created.
I must use a different function to avoid duplicating all thumbnails,
using something like this:

    (cl-letf (((symbol-function 'sha1) #'md5))
      (image-dired-thumb-name file))

And while I was at it I used a cache to avoid calling md5 each time I
toggle or revisit an image directory with thumbnails, probably dired
should do the same as well, but it is a different issue.

-- 
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-13 19:53 ` Thierry Volpiatto
@ 2022-01-14  7:56   ` Lars Ingebrigtsen
  2022-01-14  8:39     ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-14  7:56 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: Stefan Kangas, 53229

Thierry Volpiatto <thievol@posteo.net> writes:

> After further searching, I discover image-dired is using sha1 to build
> thumbnail filenames whereas in emacs-27 it uses md5, so the names are
> differents and a new file is created.

Stefan, was there any particular reason to switch from sha1 to md5 in
image-dired?  (Yes, I know that md5 is "broken", but if you have people
doing adversarial attacks on your image directories, you have bigger
problems.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-14  7:56   ` Lars Ingebrigtsen
@ 2022-01-14  8:39     ` Stefan Kangas
  2022-01-14  8:56       ` Lars Ingebrigtsen
  2022-01-14 13:37       ` Thierry Volpiatto
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Kangas @ 2022-01-14  8:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Thierry Volpiatto; +Cc: 53229

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan, was there any particular reason to switch from sha1 to md5 in
> image-dired?

Mostly that it was marginally faster and I didn't expect any breakage.
I think we could either switch back, or make sure that we use the MD5
version of the file name if it exists and otherwise use SHA1.

>  (Yes, I know that md5 is "broken", but if you have people
> doing adversarial attacks on your image directories, you have bigger
> problems.)

But what about my tin foil?





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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-14  8:39     ` Stefan Kangas
@ 2022-01-14  8:56       ` Lars Ingebrigtsen
  2022-01-14 15:28         ` Stefan Kangas
  2022-01-14 13:37       ` Thierry Volpiatto
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-14  8:56 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Thierry Volpiatto, 53229

Stefan Kangas <stefan@marxist.se> writes:

> Mostly that it was marginally faster and I didn't expect any breakage.
> I think we could either switch back, or make sure that we use the MD5
> version of the file name if it exists and otherwise use SHA1.

If it wasn't significantly faster, I think I'd rather just switch back.
Computing the hash twice just seems like a too big complication...
but...  I don't really have an opinion -- either way is fine by me.

>>  (Yes, I know that md5 is "broken", but if you have people
>> doing adversarial attacks on your image directories, you have bigger
>> problems.)
>
> But what about my tin foil?

🎩

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-14  8:39     ` Stefan Kangas
  2022-01-14  8:56       ` Lars Ingebrigtsen
@ 2022-01-14 13:37       ` Thierry Volpiatto
  1 sibling, 0 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2022-01-14 13:37 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Lars Ingebrigtsen, 53229

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


Stefan Kangas <stefan@marxist.se> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Stefan, was there any particular reason to switch from sha1 to md5 in
>> image-dired?
>
> Mostly that it was marginally faster and I didn't expect any breakage.
> I think we could either switch back, or make sure that we use the MD5
> version of the file name if it exists and otherwise use SHA1.

If you do that you will have one call of MD5 and one of SHA1 on the same
file, which defeat the purpose of using SHA1 which is presumably faster.

-- 
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-14  8:56       ` Lars Ingebrigtsen
@ 2022-01-14 15:28         ` Stefan Kangas
  2022-01-14 16:30           ` Thierry Volpiatto
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2022-01-14 15:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Thierry Volpiatto, 53229-done

Lars Ingebrigtsen <larsi@gnus.org> writes:

> If it wasn't significantly faster, I think I'd rather just switch back.

Agreed, now done on master (commit bef9fcc999).





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

* bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27
  2022-01-14 15:28         ` Stefan Kangas
@ 2022-01-14 16:30           ` Thierry Volpiatto
  0 siblings, 0 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2022-01-14 16:30 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Lars Ingebrigtsen, 53229-done

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


Stefan Kangas <stefan@marxist.se> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> If it wasn't significantly faster, I think I'd rather just switch back.
>
> Agreed, now done on master (commit bef9fcc999).

Thanks!

-- 
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

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

end of thread, other threads:[~2022-01-14 16:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 13:41 bug#53229: 29.0.50; Image-dired is not reusing thumbnails created in emacs-27 Thierry Volpiatto
2022-01-13 19:53 ` Thierry Volpiatto
2022-01-14  7:56   ` Lars Ingebrigtsen
2022-01-14  8:39     ` Stefan Kangas
2022-01-14  8:56       ` Lars Ingebrigtsen
2022-01-14 15:28         ` Stefan Kangas
2022-01-14 16:30           ` Thierry Volpiatto
2022-01-14 13:37       ` Thierry Volpiatto

Code repositories for project(s) associated with this 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).