Segmentation Fault

Bug #6624 reported by Joselo
16
Affects Status Importance Assigned to Milestone
CFEngine
Invalid
Undecided
Unassigned
cfengine (Ubuntu)
Fix Released
High
Unassigned
Breezy
Invalid
Critical
Unassigned
cfengine2 (Debian)
Fix Released
Unknown

Bug Description

when I launch

$ cfengine -h

i got the following error:
GNU cfengine: A system configuration engine
1.6.5
Free Software Foundation 1995-2000
Donated by Mark Burgess, Faculty of Engineering,
Oslo University College, 0254 Oslo, Norway

Options:

Segmentation fault

-J.

Revision history for this message
In , Morten Werner Olsen (werner-skolelinux) wrote : Re: gcc4 compilation error

forwarded 299676 <email address hidden>
thanks

On Tue, Mar 15, 2005 at 08:41:59PM -0800, Jeff Sheltren wrote:

> Using gcc 4.0, I am unable to compile cfengine. Here is what is output
> during the build:
>
> ----------
>
> if gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/db4 -I/usr/include
> -pthread -g -O2 -Wreturn-type -Wmissing-prototypes -Wuninitialized -pthread
> -O2 -Wall -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -m32 -march=i386 -mtune=pentium4
> -I/usr/include/db4 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pthread -O2
> -Wall -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -m32 -march=i386 -mtune=pentium4
> -I/usr/include/db4 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -MT init.o -MD
> -MP -MF ".deps/init.Tpo" -c -o init.o init.c; \
> then mv -f ".deps/init.Tpo" ".deps/init.Po"; else rm -f ".deps/init.Tpo";
> exit 1; fi
> In file included from init.c:33:
> cf.extern.h:73: error: array type has incomplete element type
> init.c: In function 'CheckWorkDirectories':
> init.c:96: warning: too many arguments for format
> init.c:116: warning: too many arguments for format
> init.c:176: warning: too many arguments for format
> init.c:89: warning: ignoring return value of 'chown', declared with
> attribute warn_unused_result
> init.c:109: warning: ignoring return value of 'chown', declared with
> attribute warn_unused_result
> init.c:130: warning: ignoring return value of 'chown', declared with
> attribute warn_unused_result
> init.c:150: warning: ignoring return value of 'chown', declared with
> attribute warn_unused_result
> init.c:182: warning: ignoring return value of 'chown', declared with
> attribute warn_unused_result
>
> ----------
>
> Apparently, the definition of OPTIONS[] in cf.extern.h is not allowed since
> you can't have an array of incomplete types. See
> http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html for a bit more info. I am
> not quite sure what to change to get this working correctly.

One of our Debian users have reported the same bug [1] with a patch
included. Mark, do you check it out?

- Werner

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=299676

Revision history for this message
In , Morten Werner Olsen (werner-skolelinux) wrote : Re: Bug#299676: cfengine2: FTBFS (amd64/gcc-4.0): array type has incomplete element type

On Tue, Mar 15, 2005 at 08:58:19PM +0100, Andreas Jochens wrote:

> When building 'cfengine2' on amd64 with gcc-4.0,
> I get the following error:

[snip]

> With the attached patch 'cfengine2' can be compiled
> on amd64 using gcc-4.0.

FYI: One of the subscribers to the bug-cfengine mailinglist [1] get
buffer overflow errors trying to run cfkey and/or cfagent with your
patch.

- Werner

[1] http://lists.gnu.org/archive/html/bug-cfengine/2005-03/msg00021.html

Revision history for this message
In , Andreas Jochens (aj-andaco) wrote : cfengine2: [NEW PATCH] FTBFS (amd64/gcc-4.0): array type has incomplete element type

The attached patch uses a different fix for the FTBFS problem with gcc-4.0.

The previous patch apparently caused buffer overflows.

Regards
Andreas Jochens

diff -urN ../tmp-orig/cfengine2-2.1.13/debian/patches/gcc4_fix ./debian/patches/gcc4_fix
--- ../tmp-orig/cfengine2-2.1.13/debian/patches/gcc4_fix 1970-01-01 01:00:00.000000000 +0100
+++ ./debian/patches/gcc4_fix 2005-03-24 12:59:58.830365233 +0100
@@ -0,0 +1,12 @@
+diff -urN tmp/src/cf.extern.h cfengine-2.1.13/src/cf.extern.h
+--- tmp/src/cf.extern.h 2005-01-06 14:29:51.000000000 +0100
++++ cfengine-2.1.13/src/cf.extern.h 2005-03-24 12:59:53.676756819 +0100
+@@ -28,6 +28,8 @@
+ /* */
+ /*******************************************************************/
+
++#include "getopt.h"
++
+ #if defined HAVE_PTHREAD_H && (defined HAVE_LIBPTHREAD || defined BUILDTIN_GCC_THREAD)
+ extern pthread_mutex_t MUTEX_SYSCALL;
+ extern pthread_mutex_t MUTEX_LOCK;

Revision history for this message
Joselo (jose-lacapital) wrote :

when I launch

$ cfengine -h

i got the following error:
GNU cfengine: A system configuration engine
1.6.5
Free Software Foundation 1995-2000
Donated by Mark Burgess, Faculty of Engineering,
Oslo University College, 0254 Oslo, Norway

Options:

Segmentation fault

-J.

Joselo (jose-lacapital)
Changed in cfengine:
assignee: nobody → jose-lacapital
Revision history for this message
Joselo (jose-lacapital) wrote :

The distribution I'm using is Breezy (5.10)

Changed in cfengine:
assignee: jose-lacapital → nobody
status: Unconfirmed → In Progress
Revision history for this message
Joselo (jose-lacapital) wrote :

The problem was the the the GCC4 Fix patch (015_gcc4_fix)

In gcc4:

- Arrays of incomplete element type are invalid in C. GCC now issues an error for such arrays. Declarations such as extern struct s x[]; (where struct s has not been defined) can be moved after the definition of struct s. Function parameters declared as arrays of incomplete type can instead be declared as pointers. (from GCC 4.0 Releses)

the solution was... replace the 015_gcc4_fix, for this patch...

The problem was the the the GCC4 Fix patch (015_gcc4_fix)

In gcc4:

- Arrays of incomplete element type are invalid in C. GCC now issues an error for such arrays. Declarations such as extern struct s x[]; (where struct s has not been defined) can be moved after the definition of struct s. Function parameters declared as arrays of incomplete type can instead be declared as pointers. (from GCC 4.0 Releses)

the solution was, to replace the 015_gcc4_fix. this patch work's for me (see attach)

Revision history for this message
Joselo (jose-lacapital) wrote : GCC4 Fix

The problem was the the the GCC4 Fix patch (015_gcc4_fix)

In gcc4:

- Arrays of incomplete element type are invalid in C. GCC now issues an error for such arrays. Declarations such as extern struct s x[]; (where struct s has not been defined) can be moved after the definition of struct s. Function parameters declared as arrays of incomplete type can instead be declared as pointers. (from GCC 4.0 Releses)

Joselo (jose-lacapital)
Changed in cfengine:
status: In Progress → Unconfirmed
Joselo (jose-lacapital)
Changed in cfengine:
status: Unconfirmed → Fix Committed
Revision history for this message
Laurent Bigonville (bigon) wrote :

This still presents in dapper

Changed in cfengine:
status: Unconfirmed → Confirmed
Revision history for this message
Guillaume Desmottes (cassidy) wrote :

The fix seems to work fine on my Dapper.

Changed in cfengine:
assignee: nobody → motumergers
Changed in cfengine:
assignee: motumergers → motu
Revision history for this message
In , Morten Werner Forsbring (werner-debian) wrote : Re: Bug#299676: cfengine2: FTBFS (amd64/gcc-4.0): array type has incomplete element type

On Tue, Mar 15, 2005 at 08:58:19PM +0100, Andreas Jochens wrote:

In cfengine 2.1.20 your patches has been "replaced" with the following
lines:

src/cf.extern.h:

> +-extern struct option OPTIONS[];
> ++extern struct option *OPTIONS;

extern struct option OPTIONS[49];

src/globals.c:

> +- PRIVATE struct option OPTIONS[] =
> ++ PRIVATE struct option *OPTIONS =

PRIVATE struct option OPTIONS[49] =

And according to the build-log [1] cfengine2 seems to build fine on
amd64 with gcc4.0 now. If we don't hear anything from you the next
week I will close this bug.

- Werner

[1] http://buildd.debian.org/fetch.php?&pkg=cfengine2&ver=2.1.20-1&arch=amd64&stamp=1144357926&file=log&as=raw

Revision history for this message
In , Andreas Jochens (aj-andaco) wrote :

Hello,

On 06-Apr-07 17:20, Morten Werner Olsen wrote:
> And according to the build-log [1] cfengine2 seems to build fine on
> amd64 with gcc4.0 now. If we don't hear anything from you the next
> week I will close this bug.

cfengine2 indeed builds fine on amd64 with gcc-4.0 now, thanks!

Regards
Andreas Jochens

Revision history for this message
In , Morten Werner Forsbring (werner-debian) wrote :

On Fri, Apr 07, 2006 at 05:45:35PM +0200, Andreas Jochens wrote:

> > And according to the build-log [1] cfengine2 seems to build fine on
> > amd64 with gcc4.0 now. If we don't hear anything from you the next
> > week I will close this bug.
>
> cfengine2 indeed builds fine on amd64 with gcc-4.0 now, thanks!

Thank you too, closing it now. :)

- Werner

Revision history for this message
Dennis Kaarsemaker (dennis) wrote :

One Ubuntu task is enough

Changed in cfengine:
status: Fix Committed → Rejected
Revision history for this message
Chuck Short (zulcss) wrote :

gcc4 fix has already been applied according to the changelog. I doubt this will be fixed for breezy.

Changed in cfengine:
status: Confirmed → Fix Released
Revision history for this message
Joselo (jose-lacapital) wrote :

the fix that was included into cfengine was wrong, because of replace structure array with the pointer. What my patch does, is to includes the definition of the Structure before the definition of the global array.

Revision history for this message
Reinhard Tartler (siretart) wrote :

according to the debian bug, this causes a ftbfs rather than a segfault. Can you comment on this, since on ubuntu, I cannot see any ftbfs

Revision history for this message
Reinhard Tartler (siretart) wrote :

Joselo claims the patch was wrong and the problem would still persist

Changed in cfengine:
assignee: motu → nobody
status: Fix Released → Needs Info
Revision history for this message
Joselo (jose-lacapital) wrote :

I mean, the original patch.. which i replace. I didn't take a look at any new patch.

Revision history for this message
Laurent Bigonville (bigon) wrote :

assign to the motu reviewer team

Changed in cfengine:
assignee: nobody → motureviewers
Revision history for this message
Barry deFreese (bddebian) wrote :

Is this resolved in cfengine2 from Debian? It has been synced in Edgy. Thank you.

Revision history for this message
Rocco Stanzione (trappist) wrote :

Apparently not. Still segfaults in edgy.

Changed in cfengine:
status: Needs Info → Confirmed
Changed in cfengine:
assignee: motureviewers → nobody
Revision history for this message
Laurent Bigonville (bigon) wrote :

The package has been removed from debian testing and unstable.
http://packages.qa.debian.org/c/cfengine.html

What about removing the package from ubuntu?

Revision history for this message
Sarah Kowalik (hobbsee-deactivatedaccount) wrote :
Revision history for this message
Matti Lindell (mlind) wrote :

package removed in favor of cfengine2

Changed in cfengine:
status: Confirmed → Fix Released
Matti Lindell (mlind)
Changed in cfengine:
status: New → Invalid
Revision history for this message
Roman Plessl (roman-plessl) wrote :

the following patch fixes the segmentation fault in the cfengine-1.6.5 package for my ubuntu feisty installation (amd64)

(I'm still using the cfengine 1.6.5 as an helping tool for a system management tool.)

Revision history for this message
Roman Plessl (roman-plessl) wrote :

I have now rebuild the cfengine-1.6.5 package for ubuntu hardy 8.04 (ia32, amd64)
based on the ubuntu edgy sources with the following modifications:

* removed the gcc4 patch (015_gcc4_fix)
* added getopt patch (attached to this comment)

cfengine runs without any segfaults and works as expected

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.