GNU bug report logs -
#35548
image.c uses deprecated rsvg_handle_write etc.
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Fri, 3 May 2019 19:24:01 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
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 35548 in the body.
You can then email your comments to 35548 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Fri, 03 May 2019 19:24:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 03 May 2019 19:24:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I just upgraded my Emacs build platform to Fedora 30 and found that
Emacs wouldn't build when configured with --enable-gcc-warnings. The
problem is that starting in librsvg 2.45.1, the librsvg functions
rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
those functions. Although I pacified GCC by installing the attached
patch into Emacs master, the underlying problem is still there and an
rsvg expert should take a look at this at some point.
[0001-Pacify-librsvg-2.45.1-and-later.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 04 Jul 2019 03:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 35548 <at> debbugs.gnu.org (full text, mbox):
On Sat, 04 May 2019 04:23:32 +0900,
Paul Eggert wrote:
>
> I just upgraded my Emacs build platform to Fedora 30 and found that
> Emacs wouldn't build when configured with --enable-gcc-warnings. The
> problem is that starting in librsvg 2.45.1, the librsvg functions
> rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
> those functions. Although I pacified GCC by installing the attached
> patch into Emacs master, the underlying problem is still there and an
> rsvg expert should take a look at this at some point.
If we omit Windows DLL stuff, then the patch would be as simple as
below. But Eli may dislike this (even with DLL support) for the very
reasons he dislikes the patch for Bug#36315 the other participants
prefer:
1. If Windows DLL support is completed, then it will add to a new
entry to dynamic-library-alist for libgio that librsvg is using
as a sub-library.
(See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#62)
2. It just looks like we are using libgio and not librsvg.
(See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36315#56)
YAMAMOTO Mitsuharu
mituharu <at> math.s.chiba-u.ac.jp
diff --git a/src/image.c b/src/image.c
index 6ead12166b6..6d065d66f0f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9490,6 +9490,21 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
g_type_init ();
#endif
+#if LIBRSVG_CHECK_VERSION (2, 32, 0) && !defined WINDOWSNT
+ /* In order to replace rsvg_handle_write and rsvg_handle_close that
+ are deprecated in librsvg 2.45.1 (Bug#35548), we need
+ rsvg_handle_new_from_stream_sync that requires librsvg
+ 2.32.0. */
+ GInputStream *input_stream = g_memory_input_stream_new_from_data (contents,
+ size, NULL);
+ GFile *base_file = g_file_new_for_path (filename);
+ rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+ RSVG_HANDLE_FLAGS_NONE,
+ NULL, &err);
+ g_object_unref (base_file);
+ g_object_unref (input_stream);
+ if (err) goto rsvg_error;
+#else
/* Make a handle to a new rsvg object. */
rsvg_handle = rsvg_handle_new ();
@@ -9499,17 +9514,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
if (filename)
rsvg_handle_set_base_uri (rsvg_handle, filename);
- /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
- rsvg_handle_write and rsvg_handle_close. FIXME: Use functions
- like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
- and remove this hack. */
- #if GNUC_PREREQ (4, 6, 0)
- #pragma GCC diagnostic push
- #endif
- #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- #endif
-
/* Parse the contents argument and fill in the rsvg_handle. */
rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
if (err) goto rsvg_error;
@@ -9518,10 +9522,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
for further writes. */
rsvg_handle_close (rsvg_handle, &err);
if (err) goto rsvg_error;
-
- #if GNUC_PREREQ (4, 6, 0)
- #pragma GCC diagnostic pop
- #endif
+#endif
rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
if (! check_image_size (f, dimension_data.width, dimension_data.height))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 04 Jul 2019 04:20:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 35548 <at> debbugs.gnu.org (full text, mbox):
On Thu, 04 Jul 2019 12:14:08 +0900,
YAMAMOTO Mitsuharu wrote:
>
> On Sat, 04 May 2019 04:23:32 +0900,
> Paul Eggert wrote:
> >
> > I just upgraded my Emacs build platform to Fedora 30 and found that
> > Emacs wouldn't build when configured with --enable-gcc-warnings. The
> > problem is that starting in librsvg 2.45.1, the librsvg functions
> > rsvg_handle_write and rsvg_handle_close are deprecated, and Emacs calls
> > those functions. Although I pacified GCC by installing the attached
> > patch into Emacs master, the underlying problem is still there and an
> > rsvg expert should take a look at this at some point.
>
> If we omit Windows DLL stuff, then the patch would be as simple as
> below.
Oops, I forgot NULL-check for filename.
YAMAMOTO Mitsuharu
mituharu <at> math.s.chiba-u.ac.jp
diff --git a/src/image.c b/src/image.c
index 6ead12166b6..726edb014dc 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9490,6 +9490,22 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
g_type_init ();
#endif
+#if LIBRSVG_CHECK_VERSION (2, 32, 0) && !defined WINDOWSNT
+ /* In order to replace rsvg_handle_write and rsvg_handle_close that
+ are deprecated in librsvg 2.45.1 (Bug#35548), we need
+ rsvg_handle_new_from_stream_sync that requires librsvg
+ 2.32.0. */
+ GInputStream *input_stream = g_memory_input_stream_new_from_data (contents,
+ size, NULL);
+ GFile *base_file = filename ? g_file_new_for_path (filename) : NULL;
+ rsvg_handle = rsvg_handle_new_from_stream_sync (input_stream, base_file,
+ RSVG_HANDLE_FLAGS_NONE,
+ NULL, &err);
+ if (base_file)
+ g_object_unref (base_file);
+ g_object_unref (input_stream);
+ if (err) goto rsvg_error;
+#else
/* Make a handle to a new rsvg object. */
rsvg_handle = rsvg_handle_new ();
@@ -9499,17 +9515,6 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
if (filename)
rsvg_handle_set_base_uri (rsvg_handle, filename);
- /* Suppress GCC deprecation warnings starting in librsvg 2.45.1 for
- rsvg_handle_write and rsvg_handle_close. FIXME: Use functions
- like rsvg_handle_new_from_gfile_sync on newer librsvg versions,
- and remove this hack. */
- #if GNUC_PREREQ (4, 6, 0)
- #pragma GCC diagnostic push
- #endif
- #if LIBRSVG_CHECK_VERSION (2, 45, 1) && GNUC_PREREQ (4, 2, 0)
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- #endif
-
/* Parse the contents argument and fill in the rsvg_handle. */
rsvg_handle_write (rsvg_handle, (unsigned char *) contents, size, &err);
if (err) goto rsvg_error;
@@ -9518,10 +9523,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
for further writes. */
rsvg_handle_close (rsvg_handle, &err);
if (err) goto rsvg_error;
-
- #if GNUC_PREREQ (4, 6, 0)
- #pragma GCC diagnostic pop
- #endif
+#endif
rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
if (! check_image_size (f, dimension_data.width, dimension_data.height))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 04 Jul 2019 12:55:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 35548 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 04 Jul 2019 12:14:08 +0900
> From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> Cc: 35548 <at> debbugs.gnu.org
>
> If we omit Windows DLL stuff, then the patch would be as simple as
> below. But Eli may dislike this (even with DLL support) for the very
> reasons he dislikes the patch for Bug#36315 the other participants
> prefer:
When we must move to other APIs because the libraries stop supporting
the ones we use, my liking or disliking that is hardly relevant. It
would be unreasonable for me to put my preferences before development
needs, would it not?
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Wed, 10 Jul 2019 19:45:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
bug acknowledged by developer.
(Wed, 10 Jul 2019 19:45:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 35548-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks, I attempted to port that patch to MS-Windows, installed the attached,
and am marking this bug as done.
[0001-Avoid-functions-deprecated-in-librsvg-2.45.1.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 11 Jul 2019 12:19:01 GMT)
Full text and
rfc822 format available.
Message #22 received at submit <at> debbugs.gnu.org (full text, mbox):
On Wed 10 Jul 2019, Paul Eggert wrote:
> Thanks, I attempted to port that patch to MS-Windows, installed the attached,
> and am marking this bug as done.
This patch breaks SVG support on 64bit MSYS2 Windows builds, using
librsvg 2.44.14.
AndyM
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 11 Jul 2019 12:54:02 GMT)
Full text and
rfc822 format available.
Message #25 received at submit <at> debbugs.gnu.org (full text, mbox):
On Thu 11 Jul 2019, Andy Moreton wrote:
> On Wed 10 Jul 2019, Paul Eggert wrote:
>
>> Thanks, I attempted to port that patch to MS-Windows, installed the attached,
>> and am marking this bug as done.
>
> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
> librsvg 2.44.14.
The problem is that some of the dynamically loaded functionas are
actually in gio, not glib. Please install the following patch to fix it.
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 044b82ed1e..2e45d8623b 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -278,6 +278,7 @@ libgnutls-version
'(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll")))
'(svg "librsvg-2-2.dll")
'(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
+ '(gio "libgio-2.0-0.dll")
'(glib "libglib-2.0-0.dll")
'(gobject "libgobject-2.0-0.dll")
(if (>= libgnutls-version 30400)
diff --git a/src/image.c b/src/image.c
index 3695342232..8ffb08b147 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9336,22 +9336,23 @@ DEF_DLL_FN (void, g_clear_error, (GError **));
static bool
init_svg_functions (void)
{
- HMODULE library, gdklib = NULL, glib = NULL, gobject = NULL;
+ HMODULE library, gdklib = NULL, gio = NULL, glib = NULL, gobject = NULL;
- if (!(glib = w32_delayed_load (Qglib))
+ if (!(gio = w32_delayed_load (Qgio))
+ || !(glib = w32_delayed_load (Qglib))
|| !(gobject = w32_delayed_load (Qgobject))
|| !(gdklib = w32_delayed_load (Qgdk_pixbuf))
|| !(library = w32_delayed_load (Qsvg)))
{
if (gdklib) FreeLibrary (gdklib);
if (gobject) FreeLibrary (gobject);
if (glib) FreeLibrary (glib);
+ if (gio) FreeLibrary (gio);
return 0;
}
#if LIBRSVG_CHECK_VERSION (2, 32, 0)
- LOAD_DLL_FN (glib, g_file_new_for_path);
- LOAD_DLL_FN (glib, g_memory_input_stream_new_from_data);
+ LOAD_DLL_FN (gio, g_file_new_for_path);
+ LOAD_DLL_FN (gio, g_memory_input_stream_new_from_data);
LOAD_DLL_FN (library, rsvg_handle_new_from_stream_sync);
#else
LOAD_DLL_FN (library, rsvg_handle_new);
@@ -10228,6 +10229,7 @@ syms_of_image (void)
#ifdef HAVE_NTGUI
/* Other libraries used directly by svg code. */
DEFSYM (Qgdk_pixbuf, "gdk-pixbuf");
+ DEFSYM (Qgio, "gio");
DEFSYM (Qglib, "glib");
DEFSYM (Qgobject, "gobject");
#endif /* HAVE_NTGUI */
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 11 Jul 2019 13:31:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 35548 <at> debbugs.gnu.org (full text, mbox):
> From: Andy Moreton <andrewjmoreton <at> gmail.com>
> Date: Thu, 11 Jul 2019 13:18:45 +0100
>
> On Wed 10 Jul 2019, Paul Eggert wrote:
>
> > Thanks, I attempted to port that patch to MS-Windows, installed the attached,
> > and am marking this bug as done.
>
> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
> librsvg 2.44.14.
Should be fixed now, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35548
; Package
emacs
.
(Thu, 11 Jul 2019 14:29:01 GMT)
Full text and
rfc822 format available.
Message #31 received at submit <at> debbugs.gnu.org (full text, mbox):
On Thu 11 Jul 2019, Eli Zaretskii wrote:
>> From: Andy Moreton <andrewjmoreton <at> gmail.com>
>> Date: Thu, 11 Jul 2019 13:18:45 +0100
>>
>> On Wed 10 Jul 2019, Paul Eggert wrote:
>>
>> > Thanks, I attempted to port that patch to MS-Windows, installed the attached,
>> > and am marking this bug as done.
>>
>> This patch breaks SVG support on 64bit MSYS2 Windows builds, using
>> librsvg 2.44.14.
>
> Should be fixed now, thanks.
Thanks Eli, all working again.
AndyM
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 09 Aug 2019 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.