GNU bug report logs - #57793
29.0.50; image-crop/image-elide + save-buffer creates invalid image file

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: Stefan Kangas <stefankangas@HIDDEN>; dated Wed, 14 Sep 2022 06:14:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 57793) by debbugs.gnu.org; 14 Sep 2022 14:09:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 14 10:09:23 2022
Received: from localhost ([127.0.0.1]:55652 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYT4t-00011w-Gz
	for submit <at> debbugs.gnu.org; Wed, 14 Sep 2022 10:09:23 -0400
Received: from quimby.gnus.org ([95.216.78.240]:49438)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oYT4q-00011c-6J
 for 57793 <at> debbugs.gnu.org; Wed, 14 Sep 2022 10:09:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 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=bUaAJVkzCeZjWko6LSZPQxN6TITKdM3fQt8wTqyXdmU=; b=FdrARFx7b3IORxtpPAweOqcqZm
 0LJJPneMTNO+HMGuKH/QTCLOeXoM1QnZIyb5TWIHcn+JrIhScq8OotrHyf3HyAlTf9mDaVMUOZipU
 lqLfsQMHl95dgY4VqJZbqB1+9Zndhu7OOGhAqUnQzLVWSbe8J7IhklTt9xj7Q3FmX3DY=;
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 1oYT4h-0007BB-Er; Wed, 14 Sep 2022 16:09:13 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#57793: 29.0.50; image-crop/image-elide + save-buffer
 creates invalid image file
In-Reply-To: <CADwFkmm3DKmGRzLibec2f99iOsyHJ7BhWkQFeTBBhq+VkGGmXA@HIDDEN>
 (Stefan Kangas's message of "Tue, 13 Sep 2022 23:13:48 -0700")
References: <CADwFkmm3DKmGRzLibec2f99iOsyHJ7BhWkQFeTBBhq+VkGGmXA@HIDDEN>
X-Now-Playing: David Bowie's _Brilliant Live Adventures (1): Ouvrez Le Chien
 (live Dallas '95)_: "Andy Warhol"
Date: Wed, 14 Sep 2022 16:09:10 +0200
Message-ID: <87illq82ux.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
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: Stefan Kangas <stefankangas@HIDDEN> writes: > I can save
 an invalid image with image-crop.el using this recipe: > > 0. emacs -Q
 some-image.jpg
 > 1. c > 2. Drag region > 3. RET > 4. C-x C-s (`save-buffer') > > Now I have
 two image files: > > som [...] 
 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: 57793
Cc: 57793 <at> debbugs.gnu.org
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 (---)

Stefan Kangas <stefankangas@HIDDEN> writes:

> I can save an invalid image with image-crop.el using this recipe:
>
> 0. emacs -Q some-image.jpg
> 1. c
> 2. Drag region
> 3. RET
> 4. C-x C-s (`save-buffer')
>
> Now I have two image files:
>
>     some-image.jpg      [invalid, doesn't open]
>     some-image.jpg~     [the original file]

This should now be fixed.

> Should we just disable `C-x C-s' if it's not a "plain text" image
> (e.g. an SVG)?

Or perhaps the opposite?  It (now) saves the cropped image just fine,
but if you save it as SVG, it's not going to be an actual SVG image.

> Also, how about moving `image-save' from "o" to "C-x C-s", while making
> sure it does TRT?

I was wondering whether all the image keys should be moved to under one
prefix -- there's starting to be so many of them that it's easier to hit
a command by mistake.

So, like, put them all under...  er...  `i'?  So `i r' for image-rotate
(but make it repeating so that you can rotate a lot with `i r r r'.)




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

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


Received: (at submit) by debbugs.gnu.org; 14 Sep 2022 06:13:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 14 02:13:55 2022
Received: from localhost ([127.0.0.1]:53458 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYLel-0002OH-1j
	for submit <at> debbugs.gnu.org; Wed, 14 Sep 2022 02:13:55 -0400
Received: from lists.gnu.org ([209.51.188.17]:50028)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oYLej-0002O9-3a
 for submit <at> debbugs.gnu.org; Wed, 14 Sep 2022 02:13:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53972)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stefankangas@HIDDEN>)
 id 1oYLei-0003RB-V0
 for bug-gnu-emacs@HIDDEN; Wed, 14 Sep 2022 02:13:52 -0400
Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:45980)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <stefankangas@HIDDEN>)
 id 1oYLeh-0002JT-00
 for bug-gnu-emacs@HIDDEN; Wed, 14 Sep 2022 02:13:52 -0400
Received: by mail-ot1-x32f.google.com with SMTP id
 ck2-20020a056830648200b0065603aef276so4208643otb.12
 for <bug-gnu-emacs@HIDDEN>; Tue, 13 Sep 2022 23:13:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date; bh=dD0AraX/Uk8YsFfBR0wGzUDFCn10fxmsZfRJQUQ+bM4=;
 b=CooZf3s4jmEdTiQJ36ES6MulJaWL6/L7zvDO9QtK+C5tj7mSm1GMwiTxTeKOf0fIEj
 quQdjZe6CB3ygkZqaLolCKZfZhHWSOFQLSk8m6LtQMHR1IVBYoNzii4/VLyRvjmXE7z5
 MrKUGGOZy033sEephAZzCt/m8FXMeDgzRkvv6Rf7VR3Wu4GrSRGIjA9M6luJqPNzwcDB
 444JwEpgMZ9i/rAc+Hi502H0sjH19q3YEgzk9nFzLUnfe5SI83TK+cQapvi4aBtSSofE
 HDobZj3Wy0lK7tMpXUVaPLUsZcKZ6LDJdaNRBCxsQE9UG1+qbqBj4k6gJZitsoai4oat
 gD/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date;
 bh=dD0AraX/Uk8YsFfBR0wGzUDFCn10fxmsZfRJQUQ+bM4=;
 b=rU4HHHwr1dVew4erz0WznwzeZtrBXu2bqEHBSDFZj4jOjBjGL0VKJN2KrbvatFs756
 vjJ30Jih9uIzVbc9kDlWtWhDgMY+4insW/CkuZ23bT1mFtYEusbi46rg892uHr3TXHvZ
 VQOgXOFoVmM/WHn7yvntkMo2Of9u41hLoJlvJttG2LjtJ8ZwOnCgOohLFEFkkE5YM4KH
 Q7RVWoK45vdutG7rOsTwCQYTIdlptFjIPcohhA9bZYF5xJZ9du0ViED+ssXdHQ3vunfx
 bIPE73FQZ+cLCXXHOhgIfJ84mfH/pv2608jR328e+ddMM7r3jZ5nu1bn28wnZEmvGcgU
 pBlA==
X-Gm-Message-State: ACgBeo0TimB+zUmeWCON5P7HkKKnzcx1FsnRz0lDtb8B5YEkmvZ8SBE8
 q7aIXY/abXFj+ZoMeHS89ihqPNefy8E/3cFBAGl0YsdB
X-Google-Smtp-Source: AA6agR7YZXU8dBlqBt8vAnMOHMYd3zu4ESIGF7R0UdM8qkRpIfLTvQP0jewNozKi9eOq1BDDrbLVg0imW2xXrE7XhNQ=
X-Received: by 2002:a05:6830:3c1:b0:637:28be:7920 with SMTP id
 p1-20020a05683003c100b0063728be7920mr13955622otc.105.1663136029109; Tue, 13
 Sep 2022 23:13:49 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 13 Sep 2022 23:13:48 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Tue, 13 Sep 2022 23:13:48 -0700
Message-ID: <CADwFkmm3DKmGRzLibec2f99iOsyHJ7BhWkQFeTBBhq+VkGGmXA@HIDDEN>
Subject: 29.0.50;
 image-crop/image-elide + save-buffer creates invalid image file
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2607:f8b0:4864:20::32f;
 envelope-from=stefankangas@HIDDEN; helo=mail-ot1-x32f.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
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.3 (--)

I can save an invalid image with image-crop.el using this recipe:

0. emacs -Q some-image.jpg
1. c
2. Drag region
3. RET
4. C-x C-s (`save-buffer')

Now I have two image files:

    some-image.jpg      [invalid, doesn't open]
    some-image.jpg~     [the original file]

Should we just disable `C-x C-s' if it's not a "plain text" image
(e.g. an SVG)?

Also, how about moving `image-save' from "o" to "C-x C-s", while making
sure it does TRT?

In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.24, cairo version 1.16.0) of 2022-09-14 built on joffe
Repository revision: fb42627c37f09f47119020c878ea0e76687009ff
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --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 WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: sv_SE.UTF-8
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  shell-dirtrack-mode: t
  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 hashcash mail-extr emacsbug message mailcap yank-media puny
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils etags fileloop generator xref
project files-x shell pcomplete comint ansi-color ring misearch
multi-isearch ffap thingatpt url-parse auth-source eieio eieio-core
password-cache json map byte-opt url-vars format-spec image-crop svg dom
xml image-mode exif comp comp-cstr warnings subr-x rx cl-seq cl-macs gv
cl-extra help-mode bytecomp byte-compile cconv dired-aux cus-edit pp
cus-start cus-load icons wid-edit 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/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 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
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 139550 12499)
 (symbols 48 11190 0)
 (strings 32 35573 7703)
 (string-bytes 1 8894362)
 (vectors 16 25900)
 (vector-slots 8 437332 24658)
 (floats 8 71 58)
 (intervals 56 1571 233)
 (buffers 1000 14))




Acknowledgement sent to Stefan Kangas <stefankangas@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#57793; 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, 14 Sep 2022 14:15:02 UTC

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