GNU bug report logs - #44655
28.0.50; Oversized SVG margin

Previous Next

Package: emacs;

Reported by: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>

Date: Sun, 15 Nov 2020 11:17:01 UTC

Severity: normal

Found in version 28.0.50

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44655 in the body.
You can then email your comments to 44655 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 11:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Matsievskiy S.V." <matsievskiysv <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 15 Nov 2020 11:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 11:59:11 +0300
Inserted into overlays SVG images have oversized bottom and right
margins. This bug was
introduced somewhere between 109eb1e7e29455418b40ca00bf5dad3e61e5fc78
and a32fd9f64d06ccd07a9beaf6d6f1283f7a80edac

To reproduce the bug, use the following code:

;; MathJax image
(setq image "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"
width=\"2.384ex\" height=\"2.676ex\" style=\"vertical-align:
-0.338ex;\" viewBox=\"0 -1006.6 1026.4 1152.1\" role=\"img\"
focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" aria-
labelledby=\"MathJax-SVG-1-Title\">
<title id=\"MathJax-SVG-1-Title\">x^2</title>
<defs aria-hidden=\"true\">
<path stroke-width=\"1\" id=\"E1-MJMATHI-78\" d=\"M52 289Q59 331 106
386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522
361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465
391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290
50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504
153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186
-10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142
101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26
194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251
392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52
289Z\"></path>
<path stroke-width=\"1\" id=\"E1-MJMAIN-32\" d=\"M109 429Q82 429 66
447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429
383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99
409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86
81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305
340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154
602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154
447T109 429Z\"></path>
</defs>
<g stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\"
transform=\"matrix(1 0 0 -1 0 0)\" aria-hidden=\"true\">
 <use xlink:href=\"#E1-MJMATHI-78\" x=\"0\" y=\"0\"></use>
 <use transform=\"scale(0.707)\" xlink:href=\"#E1-MJMAIN-32\" x=\"809\"
y=\"583\"></use>
</g>
</svg>")

(setq o (make-overlay 1 3))
(overlay-put o 'display (list (cons 'image (list :type 'svg :data image
:scale 2))))



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.23, cairo version 1.16.0)
 of 2020-11-14 built on KILLINGMACHINE
Repository revision: 61dca6e92ac972b832e889fbeab9b6131fc896fa
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version
11.0.12008000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure --with-imagemagick --prefix=/opt/emacs28 --enable-largefile
 --with-jpeg --with-png --with-json --with-threads'

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

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

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-
loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-
utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
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 elisp-
mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
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 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 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
emacs)

Memory information:
((conses 16 52735 5932)
 (symbols 48 6743 1)
 (strings 32 18259 1209)
 (string-bytes 1 607244)
 (vectors 16 11426)
 (vector-slots 8 163389 9435)
 (floats 8 21 47)
 (intervals 56 192 0)
 (buffers 992 10))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 17:25:35 +0000
[Message part 1 (text/plain, inline)]
On Sun, Nov 15, 2020 at 11:59:11AM +0300, Matsievskiy S.V. wrote:
> Inserted into overlays SVG images have oversized bottom and right
> margins. This bug was
> introduced somewhere between 109eb1e7e29455418b40ca00bf5dad3e61e5fc78
> and a32fd9f64d06ccd07a9beaf6d6f1283f7a80edac

This is exactly what I expected when I made the last change: someone
would quickly find an SVG that doesn't work.

All I can think of to do is ignore the deprecation of
svg_handle_get_dimensions and continue using it. The release notes for
librsvg 2.46 state it's deprecated but still available.

Patch attached. Are we happy to continue using deprecated functions?

(I was looking through the librsvg bug tracker and it looks as though
they want to move away from depending on Cairo. Perhaps this means
things will improve for us in the future.)
-- 
Alan Third
[0001-Fix-SVG-display-again-bug-44655.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:32:02 GMT) Full text and rfc822 format available.

Message #11 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Third <alan <at> idiocy.org>
Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 19:31:04 +0200
> Date: Sun, 15 Nov 2020 17:25:35 +0000
> From: Alan Third <alan <at> idiocy.org>
> Cc: 44655 <at> debbugs.gnu.org
> 
> All I can think of to do is ignore the deprecation of
> svg_handle_get_dimensions and continue using it. The release notes for
> librsvg 2.46 state it's deprecated but still available.
> 
> Patch attached. Are we happy to continue using deprecated functions?

Could it cause compilation failure if strict compiler switches are
used?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:34:02 GMT) Full text and rfc822 format available.

Message #14 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 17:33:39 +0000
On Sun, Nov 15, 2020 at 07:31:04PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 15 Nov 2020 17:25:35 +0000
> > From: Alan Third <alan <at> idiocy.org>
> > Cc: 44655 <at> debbugs.gnu.org
> > 
> > All I can think of to do is ignore the deprecation of
> > svg_handle_get_dimensions and continue using it. The release notes for
> > librsvg 2.46 state it's deprecated but still available.
> > 
> > Patch attached. Are we happy to continue using deprecated functions?
> 
> Could it cause compilation failure if strict compiler switches are
> used?

I don't believe so. They say they're still available. What switches
should I try?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:48:01 GMT) Full text and rfc822 format available.

Message #17 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Third <alan <at> idiocy.org>
Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 19:47:05 +0200
> Date: Sun, 15 Nov 2020 17:33:39 +0000
> From: Alan Third <alan <at> idiocy.org>
> Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
> 
> > > Patch attached. Are we happy to continue using deprecated functions?
> > 
> > Could it cause compilation failure if strict compiler switches are
> > used?
> 
> I don't believe so. They say they're still available. What switches
> should I try?

I was thinking about -Wdeprecated.  It could cause problem if used
with -Werror.  My question was whether some distributions include
these switches under some forged environments.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:53:01 GMT) Full text and rfc822 format available.

Message #20 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 17:52:20 +0000
On Sun, Nov 15, 2020 at 08:39:22PM +0300, Matsievskiy S.V. wrote:
> Is this the function 
> https://developer.gnome.org/rsvg/2.50/RsvgHandle.html#rsvg-handle-get-dimensions
> ?
> Cannot find a deprecation warning anywhere.

Yes, it's unclear what's going on, but they've marked the
RsvgDimensionData type as deprecated, and the release notes for 2.46
list the function as deprecated.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:56:01 GMT) Full text and rfc822 format available.

Message #23 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 20:39:22 +0300
Is this the function 
https://developer.gnome.org/rsvg/2.50/RsvgHandle.html#rsvg-handle-get-dimensions
?
Cannot find a deprecation warning anywhere.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sun, 15 Nov 2020 17:57:02 GMT) Full text and rfc822 format available.

Message #26 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sun, 15 Nov 2020 17:56:28 +0000
On Sun, Nov 15, 2020 at 07:47:05PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 15 Nov 2020 17:33:39 +0000
> > From: Alan Third <alan <at> idiocy.org>
> > Cc: matsievskiysv <at> gmail.com, 44655 <at> debbugs.gnu.org
> > 
> > > > Patch attached. Are we happy to continue using deprecated functions?
> > > 
> > > Could it cause compilation failure if strict compiler switches are
> > > used?
> > 
> > I don't believe so. They say they're still available. What switches
> > should I try?
> 
> I was thinking about -Wdeprecated.  It could cause problem if used
> with -Werror.  My question was whether some distributions include
> these switches under some forged environments.

Ah, I don't think I can answer that. Just trying those switches here
results in a build failure, but due to NS code, not librsvg.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Mon, 16 Nov 2020 22:35:02 GMT) Full text and rfc822 format available.

Message #29 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Alan Third <alan <at> idiocy.org>, matsievskiysv <at> gmail.com,
 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Mon, 16 Nov 2020 23:34:33 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> I was thinking about -Wdeprecated.  It could cause problem if used
> with -Werror.  My question was whether some distributions include
> these switches under some forged environments.

I tried adding -Wdeprecated to the Makefile and compiling (after
applying Alan's patches), and I got no warnings on Debian bullseye.

So I say go ahead and push the patch, and we'll see whether that holds
true for other systems, too, but my guess is that it'll be OK across the
board.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Wed, 18 Nov 2020 21:41:01 GMT) Full text and rfc822 format available.

Message #32 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Thu, 19 Nov 2020 00:40:00 +0300
Got clarification from Gnome. rsvg_handle_get_dimensions is not
deprecated:

https://discourse.gnome.org/t/rsvg-rsvg-handle-get-dimensions-deprecation/4821






Reply sent to Alan Third <alan <at> idiocy.org>:
You have taken responsibility. (Wed, 18 Nov 2020 23:09:01 GMT) Full text and rfc822 format available.

Notification sent to "Matsievskiy S.V." <matsievskiysv <at> gmail.com>:
bug acknowledged by developer. (Wed, 18 Nov 2020 23:09:01 GMT) Full text and rfc822 format available.

Message #37 received at 44655-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: "Matsievskiy S.V." <matsievskiysv <at> gmail.com>
Cc: 44655-done <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Wed, 18 Nov 2020 23:08:41 +0000
On Thu, Nov 19, 2020 at 12:40:00AM +0300, Matsievskiy S.V. wrote:
> Got clarification from Gnome. rsvg_handle_get_dimensions is not
> deprecated:
> 
> https://discourse.gnome.org/t/rsvg-rsvg-handle-get-dimensions-deprecation/4821

OK, thanks. The patch is pushed to master.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Fri, 20 Nov 2020 00:19:01 GMT) Full text and rfc822 format available.

Message #40 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Fri, 20 Nov 2020 00:18:38 +0000
On Wed 18 Nov 2020, Alan Third wrote:

> On Thu, Nov 19, 2020 at 12:40:00AM +0300, Matsievskiy S.V. wrote:
>> Got clarification from Gnome. rsvg_handle_get_dimensions is not
>> deprecated:
>> 
>> https://discourse.gnome.org/t/rsvg-rsvg-handle-get-dimensions-deprecation/4821
>
> OK, thanks. The patch is pushed to master.

This needs another fixup for the Windows build (64bit Mingw64):

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: image.o: in function `svg_load_image':
C:/emacs/git/emacs/master/src/image.c:9916: undefined reference to `rsvg_handle_get_dimensions'

It looks like the ifdefs for Windows in image.c do not do the runtime import of
rsvg_handle_get_dimensions if librvsg version < 2.46.0, but now it is
needed always.

    AndyM





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Fri, 20 Nov 2020 15:03:02 GMT) Full text and rfc822 format available.

Message #43 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andy Moreton <andrewjmoreton <at> gmail.com>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Fri, 20 Nov 2020 17:02:09 +0200
> From: Andy Moreton <andrewjmoreton <at> gmail.com>
> Date: Fri, 20 Nov 2020 00:18:38 +0000
> 
> C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: image.o: in function `svg_load_image':
> C:/emacs/git/emacs/master/src/image.c:9916: undefined reference to `rsvg_handle_get_dimensions'
> 
> It looks like the ifdefs for Windows in image.c do not do the runtime import of
> rsvg_handle_get_dimensions if librvsg version < 2.46.0, but now it is
> needed always.

Thanks, I hope I fixed that now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Fri, 20 Nov 2020 15:40:02 GMT) Full text and rfc822 format available.

Message #46 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Fri, 20 Nov 2020 15:39:41 +0000
On Fri 20 Nov 2020, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton <at> gmail.com>
>> Date: Fri, 20 Nov 2020 00:18:38 +0000
>> 
>> C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
>> image.o: in function `svg_load_image':
>> C:/emacs/git/emacs/master/src/image.c:9916: undefined reference to `rsvg_handle_get_dimensions'
>> 
>> It looks like the ifdefs for Windows in image.c do not do the runtime import of
>> rsvg_handle_get_dimensions if librvsg version < 2.46.0, but now it is
>> needed always.
>
> Thanks, I hope I fixed that now.

Thanks Eli, build is ok again.

    AndyM





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Dec 2020 12:24:06 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Fri, 05 Nov 2021 19:26:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Fri, 05 Nov 2021 19:29:01 GMT) Full text and rfc822 format available.

Message #53 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 44655 <at> debbugs.gnu.org
Subject: bug#44655: 28.0.50; Oversized SVG margin
Date: Fri, 5 Nov 2021 12:28:37 -0700
[Message part 1 (text/plain, inline)]
I ran into a problem building Emacs with Fedora 35 (released 3 days ago) 
related to the fix for bug#44655, and installed the attached to try to 
work around the issue (which is due to the deprecation of 
rsvg_handle_get_dimensions in librsvg 2.52.0 (2021-09-15)).
[0001-rsvg_handle_get_dimensions-is-deprecated-in-2.52.0.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 06 Nov 2021 12:57:01 GMT) Full text and rfc822 format available.

Message #56 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 6 Nov 2021 12:55:49 +0000
On Fri, Nov 05, 2021 at 12:28:37PM -0700, Paul Eggert wrote:
> I ran into a problem building Emacs with Fedora 35 (released 3 days ago)
> related to the fix for bug#44655, and installed the attached to try to work
> around the issue (which is due to the deprecation of
> rsvg_handle_get_dimensions in librsvg 2.52.0 (2021-09-15)).

There seems to be a lot of churn in the librsvg API at the moment, and
their documentation isn't keeping up as it still doesn't mark
rsvg_handle_get_dimensions as deprecated.

It appears they've introduced rsvg_handle_get_intrinsic_size_in_pixels
which does the same thing (but better) than my sizing code, but anyone
using librsvg 2.46-2.52, which is probably most people for now, can't
use it and probably don't want to use the old scheme, so I expect
there's no point replacing my code at the moment.

> -  if (viewbox_width == 0 || viewbox_height == 0)
> +#else
> +  /* In librsvg before 2.46.0, guess the viewbox from the image dimensions.  */
> +  RsvgDimensionData dimension_data;
> +  rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
> +  viewbox_width = dimension_data.width;
> +  viewbox_height = dimension_data.height;
>  #endif
> -  {
> -    /* The functions used above to get the geometry of the visible
> -       area of the SVG are only available in librsvg 2.46 and above,
> -       so in certain circumstances this code path can result in some
> -       parts of the SVG being cropped.  */
> -    RsvgDimensionData dimension_data;
> -
> -    rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
> -
> -    viewbox_width = dimension_data.width;
> -    viewbox_height = dimension_data.height;
> -  }
>  
>    compute_image_size (viewbox_width, viewbox_height, img,
>                        &width, &height);

The fall through is in place because if the image size is defined in
units we don't know (e.g. % or ex) then we end up with no idea what
size it should be.

Perhaps what we should do is move the final "else" section of the
previous code block (where rsvg_handle_get_geometry_for_layer is
called) into its own block which is executed

  if (viewbox_width == 0 || viewbox_height == 0)

instead of only in the case where rsvg_handle_get_intrinsic_dimensions
fails to return any dimensions. That way we should have *some*
dimensions without having to call rsvg_handle_get_dimensions.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Fri, 03 Dec 2021 18:47:02 GMT) Full text and rfc822 format available.

Message #59 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Alan Third <alan <at> idiocy.org>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Fri, 3 Dec 2021 10:45:55 -0800
[Message part 1 (text/plain, inline)]
On 11/6/21 05:55, Alan Third wrote:

> There seems to be a lot of churn in the librsvg API at the moment, and
> their documentation isn't keeping up as it still doesn't mark
> rsvg_handle_get_dimensions as deprecated.
> 
> It appears they've introduced rsvg_handle_get_intrinsic_size_in_pixels
> which does the same thing (but better) than my sizing code, but anyone
> using librsvg 2.46-2.52, which is probably most people for now, can't
> use it and probably don't want to use the old scheme, so I expect
> there's no point replacing my code at the moment.

If it improves on your code then let's try using it for bleeding-edge 
librsvg (2.52.0+).


> Perhaps what we should do is move the final "else" section of the
> previous code block (where rsvg_handle_get_geometry_for_layer is
> called) into its own block which is executed
> 
>    if (viewbox_width == 0 || viewbox_height == 0)
> 
> instead of only in the case where rsvg_handle_get_intrinsic_dimensions
> fails to return any dimensions. That way we should have *some*
> dimensions without having to call rsvg_handle_get_dimensions.

I installed a patch into master to do that, along with other patches to 
try using svg_handle_get_intrinsic_size_in_pixels with bleeding-edge 
librsvg, and to catch some potential integer overflow problems I noticed 
while doing all this (see attached).
[0001-More-robust-svg_load_image-fallback.patch (text/x-patch, attachment)]
[0002-Simplify-svg_load_image.patch (text/x-patch, attachment)]
[0003-Improve-overflow-checking-in-svg_load_image.patch (text/x-patch, attachment)]
[0004-Prefer-rsvg_handle_get_intrinsic_size_in_pixels.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 04 Dec 2021 10:47:01 GMT) Full text and rfc822 format available.

Message #62 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 4 Dec 2021 10:46:50 +0000
On Fri, Dec 03, 2021 at 10:45:55AM -0800, Paul Eggert wrote:
> On 11/6/21 05:55, Alan Third wrote:
> 
> > There seems to be a lot of churn in the librsvg API at the moment, and
> > their documentation isn't keeping up as it still doesn't mark
> > rsvg_handle_get_dimensions as deprecated.
> > 
> > It appears they've introduced rsvg_handle_get_intrinsic_size_in_pixels
> > which does the same thing (but better) than my sizing code, but anyone
> > using librsvg 2.46-2.52, which is probably most people for now, can't
> > use it and probably don't want to use the old scheme, so I expect
> > there's no point replacing my code at the moment.
> 
> If it improves on your code then let's try using it for bleeding-edge
> librsvg (2.52.0+).
> 
> 
> > Perhaps what we should do is move the final "else" section of the
> > previous code block (where rsvg_handle_get_geometry_for_layer is
> > called) into its own block which is executed
> > 
> >    if (viewbox_width == 0 || viewbox_height == 0)
> > 
> > instead of only in the case where rsvg_handle_get_intrinsic_dimensions
> > fails to return any dimensions. That way we should have *some*
> > dimensions without having to call rsvg_handle_get_dimensions.
> 
> I installed a patch into master to do that, along with other patches to try
> using svg_handle_get_intrinsic_size_in_pixels with bleeding-edge librsvg,
> and to catch some potential integer overflow problems I noticed while doing
> all this (see attached).

This all looks good to me. Thanks!
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 04 Dec 2021 11:02:02 GMT) Full text and rfc822 format available.

Message #65 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Alan Third <alan <at> idiocy.org>, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 04 Dec 2021 12:00:29 +0100
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> I installed a patch into master to do that, along with other patches
> to try using svg_handle_get_intrinsic_size_in_pixels with
> bleeding-edge librsvg, and to catch some potential integer overflow
> problems I noticed while doing all this (see attached).

I can't build Emacs now with this error:

    image.c: In function 'svg_load_image':
    image.c:10464:15: error: void value not ignored as it ought to be
    10464 |   has_viewbox = rsvg_handle_get_intrinsic_size_in_pixels (rsvg_handle,
          |               ^

This is on Win10 with Msys2, gcc 11.2 and librsvg 2.52.4.

Best, Arash




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 04 Dec 2021 11:45:02 GMT) Full text and rfc822 format available.

Message #68 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arash Esbati <arash <at> gnu.org>
Cc: alan <at> idiocy.org, eggert <at> cs.ucla.edu, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 04 Dec 2021 13:43:47 +0200
> From: Arash Esbati <arash <at> gnu.org>
> Date: Sat, 04 Dec 2021 12:00:29 +0100
> Cc: Alan Third <alan <at> idiocy.org>, 44655 <at> debbugs.gnu.org
> 
>     image.c: In function 'svg_load_image':
>     image.c:10464:15: error: void value not ignored as it ought to be
>     10464 |   has_viewbox = rsvg_handle_get_intrinsic_size_in_pixels (rsvg_handle,
>           |               ^
> 
> This is on Win10 with Msys2, gcc 11.2 and librsvg 2.52.4.

I hope I fixed this now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 04 Dec 2021 12:06:02 GMT) Full text and rfc822 format available.

Message #71 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: alan <at> idiocy.org, eggert <at> cs.ucla.edu, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 04 Dec 2021 13:05:03 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> I hope I fixed this now.

Yes, thanks for the quick fix.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44655; Package emacs. (Sat, 04 Dec 2021 16:08:02 GMT) Full text and rfc822 format available.

Message #74 received at 44655 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arash Esbati <arash <at> gnu.org>
Cc: alan <at> idiocy.org, eggert <at> cs.ucla.edu, 44655 <at> debbugs.gnu.org
Subject: Re: bug#44655: 28.0.50; Oversized SVG margin
Date: Sat, 04 Dec 2021 18:07:41 +0200
> From: Arash Esbati <arash <at> gnu.org>
> Cc: eggert <at> cs.ucla.edu,  alan <at> idiocy.org,  44655 <at> debbugs.gnu.org
> Date: Sat, 04 Dec 2021 13:05:03 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > I hope I fixed this now.
> 
> Yes, thanks for the quick fix.

Thanks for testing the fix.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Jan 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 76 days ago.

Previous Next


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