Bug 177462 - graphics/dia: dia-0.97.2,1 fails to start
Summary: graphics/dia: dia-0.97.2,1 fails to start
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-29 05:30 UTC by andy
Modified: 2013-04-17 12:30 UTC (History)
0 users

See Also:


Attachments
dia.diff (898 bytes, patch)
2013-04-10 01:51 UTC, Golyashov Sergey
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description andy 2013-03-29 05:30:04 UTC
dia fails to start from the Gnome menu or the command line.  Splash screen appears for about 1 second then disappears.  No info or error on command line or in log file.  Also reported by another user.

How-To-Repeat: type dia on command line
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-03-29 22:33:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Golyashov Sergey 2013-04-09 07:55:45 UTC
Backtrace from [work dia]/objects/custom/shape_typeinfo.c:shape_typeinfo_load -> g_fopen -> fopen

/usr/src/lib/libc/stdio/fopen.c:
<<<===
(gdb) n
99      }
(gdb) l
94               * fseek and ftell.)
95               */
96              if (oflags & O_APPEND)
97                      (void)_sseek(fp, (fpos_t)0, SEEK_END);
98              return (fp);
99      }
(gdb) print fp
$17 = (FILE *) 0x807eb0740
(gdb) n
shape_typeinfo_load (info=0x80a3ead00) at shape_typeinfo.c:200
200       if (!f)
(gdb) print f
$18 = (FILE *) 0x7eb0740
===>>>

fopen return (FILE *) 0x807eb0740 but g_fopen return (FILE *) 0x7eb0740

So after call fread:

Program received signal SIGSEGV, Segmentation fault.
__fread (buf=0x7fffffffce20, size=512, count=1, fp=0x7eb0740) at /usr/src/lib/libc/stdio/fread.c:95
95              ORIENT(fp, -1);

This patch solves problem for me:

--- objects/custom/shape_typeinfo.c.orig	2013-04-09 01:48:15.838095782 +1100
+++ objects/custom/shape_typeinfo.c	2013-04-09 16:21:37.840874850 +1100
@@ -196,7 +195,7 @@
     saxHandler.warning = _warning;
     once = TRUE;
   }
-  f = g_fopen (info->filename, "rb");
+  f = fopen (info->filename, "rb");
   if (!f)
     return FALSE;
   while ((n = fread (buffer, 1, BLOCKSIZE, f)) > 0) {
Comment 3 andy 2013-04-09 15:20:05 UTC
Hi Golyashov:

Thank you for your reply.  I am not a developer, would you please give me 
exact instructions for how to apply patch.  Can i copy it to the files 
directory in /usr/ports/grahics/dia?  What should i name the file?

Thanks in advance.

On Tue, 9 Apr 2013, Golyashov Sergey wrote:

>
> Backtrace from [work dia]/objects/custom/shape_typeinfo.c:shape_typeinfo_load -> g_fopen -> fopen
>
> /usr/src/lib/libc/stdio/fopen.c:
> <<<===
> (gdb) n
> 99      }
> (gdb) l
> 94               * fseek and ftell.)
> 95               */
> 96              if (oflags & O_APPEND)
> 97                      (void)_sseek(fp, (fpos_t)0, SEEK_END);
> 98              return (fp);
> 99      }
> (gdb) print fp
> $17 = (FILE *) 0x807eb0740
> (gdb) n
> shape_typeinfo_load (info=0x80a3ead00) at shape_typeinfo.c:200
> 200       if (!f)
> (gdb) print f
> $18 = (FILE *) 0x7eb0740
> ===>>>
>
> fopen return (FILE *) 0x807eb0740 but g_fopen return (FILE *) 0x7eb0740
>
> So after call fread:
>
> Program received signal SIGSEGV, Segmentation fault.
> __fread (buf=0x7fffffffce20, size=512, count=1, fp=0x7eb0740) at /usr/src/lib/libc/stdio/fread.c:95
> 95              ORIENT(fp, -1);
>
> This patch solves problem for me:
>
> --- objects/custom/shape_typeinfo.c.orig	2013-04-09 01:48:15.838095782 +1100
> +++ objects/custom/shape_typeinfo.c	2013-04-09 16:21:37.840874850 +1100
> @@ -196,7 +195,7 @@
>     saxHandler.warning = _warning;
>     once = TRUE;
>   }
> -  f = g_fopen (info->filename, "rb");
> +  f = fopen (info->filename, "rb");
>   if (!f)
>     return FALSE;
>   while ((n = fread (buffer, 1, BLOCKSIZE, f)) > 0) {
>
Comment 4 Golyashov Sergey 2013-04-10 01:51:01 UTC
"glib.h" not include "glib/gstdio.h". But "glib/gstdio.h" declares a function g_fopen. Without this declare g_fopen returns integer.

My test compile:

test.c:12:4: warning: incompatible integer to pointer conversion assigning to 'FILE *' (aka 'struct __sFILE *') from 'int' [-Wint-conversion]
        f = g_fopen("test.txt", "rb");
          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.


Final patch for port attached to this message.

Regards.
Sergey Golyashov
Comment 5 dfilter service freebsd_committer freebsd_triage 2013-04-17 12:26:06 UTC
Author: kwm
Date: Wed Apr 17 11:25:52 2013
New Revision: 315957
URL: http://svnweb.freebsd.org/changeset/ports/315957

Log:
  convert NOPORTDOCS to PORT_OPTIONS:MDOCS
  Switch to desktop-file-utils uses.
  Remove shlib version.
  Fix glib.h header patch so the correct prototype is used, otherwise function
   returns the wrong time [1]
  Move pre-configure section to post-patch.
  
  PR:		ports/177462 [1]
  PR:		ports/177564 [1]
  Submitted by:	AN <andy@neu.net>
  		Luiz Eduardo Roncato Cordeiro <cordeiro@cert.br>
  Based on:	patch from Golyashov Sergey <svvord@ulona.org> in ports/177462
  Feature safe:	yes

Modified:
  head/graphics/dia/Makefile
  head/graphics/dia/pkg-plist

Modified: head/graphics/dia/Makefile
==============================================================================
--- head/graphics/dia/Makefile	Wed Apr 17 10:02:28 2013	(r315956)
+++ head/graphics/dia/Makefile	Wed Apr 17 11:25:52 2013	(r315957)
@@ -4,22 +4,22 @@
 
 PORTNAME=	dia
 DISTVERSION=	0.97.2
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	graphics gnome
 MASTER_SITES=	GNOME
 DIST_SUBDIR=	gnome2
 
-MAINTAINER?=	gnome@FreeBSD.org
+MAINTAINER=	gnome@FreeBSD.org
 COMMENT=	Diagram creation program, similar to Visio
 
 LIB_DEPENDS=	popt:${PORTSDIR}/devel/popt \
 		png15:${PORTSDIR}/graphics/png
 
-USES=		pathfix
+USES=		pathfix desktop-file-utils
 USE_XZ=		yes
 USE_GMAKE=	yes
-USE_GNOME=	gtk20 gnomeprefix libxslt libartlgpl2 intlhack \
-		desktopfileutils
+USE_GNOME=	gtk20 gnomeprefix libxslt libartlgpl2 intlhack
 INSTALLS_ICONS=	yes
 USE_GETTEXT=	yes
 GNU_CONFIGURE=	yes
@@ -28,8 +28,9 @@ CONFIGURE_ENV=	LIBS="-L${LOCALBASE}/lib 
 CPPFLAGS+=	-I${LOCALBASE}/include
 CONFIGURE_ARGS=	--disable-gnome
 
+.include <bsd.port.options.mk>
 
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 BUILD_DEPENDS=	${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:${PORTSDIR}/textproc/docbook-xsl
 MAN1=		dia.1
 MANLANG=	"" fr
@@ -47,7 +48,7 @@ MANLANG=	"" fr
 .include <bsd.port.pre.mk>
 
 .if ${ARCH} == "i386"
-LIB_DEPENDS+=		EMF.1:${PORTSDIR}/graphics/libemf
+LIB_DEPENDS+=		EMF:${PORTSDIR}/graphics/libemf
 CONFIGURE_ARGS+=	--enable-libemf
 PLIST_SUB+=		WMF=""
 .else
@@ -58,11 +59,12 @@ PLIST_SUB+=		WMF="@comment "
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
 		${WRKSRC}/lib/intl.c
-	@${REINPLACE_CMD} -e 's|glib/.*\.h>|glib.h>|g' \
+	@${REINPLACE_CMD} -e 's|glib/gstrfuncs.h>|glib.h>|g' \
+		-e 's|glib/gtestutils.h|glib.h|g' \
 		${WRKSRC}/objects/custom/shape_typeinfo.c \
 		${WRKSRC}/tests/test-objects.c \
 		${WRKSRC}/tests/test-boundingbox.c
-.if defined(NOPORTDOCS)
+.if ! ${PORT_OPTIONS:MDOCS}
 	@${REINPLACE_CMD} -e '/SUBDIRS/s|data doc tests|data tests|g' \
 		${WRKSRC}/Makefile.in
 .endif
@@ -70,13 +72,8 @@ post-patch:
 		${XARGS} ${REINPLACE_CMD} -e \
 		's,\(^GTK_LIBS.*\),\1 ${PTHREAD_LIBS}, ; \
 		 s,\(^GTK_CFLAGS = \),\1 ${PTHREAD_CFLAGS} ,'
-
-pre-configure:
 	@${REINPLACE_CMD} -e 's|http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl|${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl| ; \
 		s|echo aout|echo elf|g ; s|/usr/include/libEMF|${LOCALBASE}/include/libEMF|g' \
 		${WRKSRC}/configure
 
-post-install:
-	@-update-desktop-database
-
 .include <bsd.port.post.mk>

Modified: head/graphics/dia/pkg-plist
==============================================================================
--- head/graphics/dia/pkg-plist	Wed Apr 17 10:02:28 2013	(r315956)
+++ head/graphics/dia/pkg-plist	Wed Apr 17 11:25:52 2013	(r315957)
@@ -1849,5 +1849,3 @@ share/mime-info/dia.mime
 @dirrmtry man/fr/man1
 @dirrmtry man/fr
 @dirrm lib/dia
-@exec %%LOCALBASE%%/bin/update-desktop-database > /dev/null || /usr/bin/true
-@unexec %%LOCALBASE%%/bin/update-desktop-database > /dev/null || /usr/bin/true
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Koop Mast freebsd_committer freebsd_triage 2013-04-17 12:26:58 UTC
State Changed
From-To: open->closed

Patch based on the patch by Golvashov Sergey was committed to ports.