Bug 494579 - Attempt to centralize setjmp.h leads to confusing results
Attempt to centralize setjmp.h leads to confusing results
Product: Fedora
Classification: Fedora
Component: libpng (Show other bugs)
All Linux
high Severity medium
: ---
: ---
Assigned To: Tom Lane
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-04-07 10:24 EDT by Jeroen van Meeuwen
Modified: 2013-07-02 23:22 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-12-18 04:12:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jeroen van Meeuwen 2009-04-07 10:24:06 EDT
Description of problem:

Compiling an application with PNG support leads to the inclusion of /usr/include/libpng12/pngconf.h.

In this file, the following snippet occurs:


/* This is an attempt to force a single setjmp behaviour on Linux.  If
 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.

#  ifdef __linux__
#    ifdef _BSD_SOURCE
#      define PNG_SAVE_BSD_SOURCE
#      undef _BSD_SOURCE
#    endif
#    ifdef _SETJMP_H
     /* If you encounter a compiler error here, see the explanation
      * near the end of INSTALL.
         __pngconf.h__ already includes setjmp.h;
         __dont__ include it again.;
#    endif
#  endif /* __linux__ */

   /* include setjmp.h for error handling */
#  include <setjmp.h>

#  ifdef __linux__
#      ifndef _BSD_SOURCE
#        define _BSD_SOURCE
#      endif
#      undef PNG_SAVE_BSD_SOURCE
#    endif
#  endif /* __linux__ */

This application I'm building (LGPLv3) includes many different header files from many different locations, including /usr/include/setjmp.h and /usr/include/bits/setjmp.h (glibc-headers). Other packages include setjmp.h as well, and.

It is wrong for the above snippet to check for _SETJMP_H being defined or not, as it is set by glibc-header's setjmp.h. I could not find a way to define PNG_NOT_SETJMP_SUPPORTED or PNG_SETJMP_NOT_SUPPORTED from within the external application I wanted to compile. If there is a way, please let me know ;-)

Maybe, libpng12/pngconf.h should use _LIBPNG_SETJMP_H such as /usr/include/bits/setjmp.h does in glibc-headers (using _BITS_SETJMP_H)

Version-Release number of selected component (if applicable):

Comment 1 Tom Lane 2009-04-07 20:11:54 EDT
Actually, that code is very intentionally trying to check whether you already included setjmp.h; the consequences of not doing this appear worse than those of doing it.  I'd suggest doing what the comment tells you to, ie make sure you include png.h ahead of setjmp.h.

I've asked upstream whether they can't make this a little less painful in the next major release, but it will probably not be changing in the 1.2.x series because it'd break existing applications.  The fundamental problem is that linux contains two incompatible versions of setjmp/longjmp, and if you use one while libpng is using the other, your code *will* fail.

You might be able to reduce your pain by including png.h only in one or a few modules (that also contain whatever code tries to catch longjmps out of libpng).
Comment 2 Jeroen van Meeuwen 2009-04-08 09:33:54 EDT
The code does include png.h which in turn includes setjmp.h. Fwiw, the software I'm attempting to compile is:


Download link: http://www.ecmwf.int/products/data/software/download/software_files/Magics++-2.6.4.tar.gz

The code including png.h is at:

Magics++-2.6.4/src/drivers/OpenGL/OpenGLBaseWidget.cc:45:#include <png.h>
Magics++-2.6.4/src/drivers/OpenGL/OpenGLLabelWidget.cc:45:#include <png.h>
Magics++-2.6.4/src/drivers/OpenGL/OpenGLTextureItem.cc:41:#include <png.h>

Not including setjmp.h here:

[jmeeuwen@ghandalf OpenGL]$ grep -rin setjmp.h *
[jmeeuwen@ghandalf OpenGL]$ pwd

Or anyone else for that matter:

[jmeeuwen@ghandalf Magics++-2.6.4]$ grep -rin setjmp.h *
[jmeeuwen@ghandalf Magics++-2.6.4]$ pwd
Comment 3 Bug Zapper 2009-11-18 02:50:16 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 4 Bug Zapper 2009-12-18 04:12:51 EST
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.