Thread: Segfault on CVS HEAD

Segfault on CVS HEAD

From
Bruce Momjian
Date:
I am seeing the following segmentation fault when doing 'gmake install'
on CVS HEAD;  any idea why?
$ gmake install/bin/sh ../config/mkinstalldirs '/usr/local/pgsql/lib/pgxs/src'/bin/sh ../config/install-sh -c -m 644
Makefile.global'/usr/local/pgsql/lib/pgxs/src/Makefile.global'/bin/sh ../config/install-sh -c -m 644 Makefile.port
'/usr/local/pgsql/lib/pgxs/src/Makefile.port'/bin/sh../config/install-sh -c -m 644 ./Makefile.shlib
'/usr/local/pgsql/lib/pgxs/src/Makefile.shlib'/bin/sh../config/install-sh -c -m 644 ./nls-global.mk
'/usr/local/pgsql/lib/pgxs/src/nls-global.mk'gmake-C port installgmake[1]: Entering directory
`/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'/bin/sh../../config/install-sh -c -m 644  libpgport.a
'/usr/local/pgsql/lib/libpgport.a'gmake[1]:Leaving directory `/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'gmake
-Ctimezone installgmake[1]: Entering directory `/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/timezone'gmake -C
../../src/portallgmake[2]: Entering directory `/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'gmake[2]: Nothing to
bedone for `all'.gmake[2]: Leaving directory `/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'gmake: *** [install]
Segmentationfault$
 

I rebooted my server but it didn't help.  All this just started today.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Segfault on CVS HEAD

From
Alvaro Herrera
Date:
Bruce Momjian wrote:

>     gmake: *** [install] Segmentation fault
>     $
> 
> I rebooted my server but it didn't help.  All this just started today.

Your make is buggy?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Segfault on CVS HEAD

From
Tom Lane
Date:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Bruce Momjian wrote:
>> gmake: *** [install] Segmentation fault

> Your make is buggy?

I'm not totally sure, but I think this is make reporting that install
crashed.  Perhaps a corrupted install executable?
        regards, tom lane


Re: Segfault on CVS HEAD

From
Bruce Momjian
Date:
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Bruce Momjian wrote:
> >> gmake: *** [install] Segmentation fault
>
> > Your make is buggy?
>
> I'm not totally sure, but I think this is make reporting that install
> crashed.  Perhaps a corrupted install executable?

Turns out the cause was a buggy gmake that segment fauled on this:

    $(if $(ZIC),$(ZIC),./zic) -d ...

It affects at least gmake 3.78.1 but is fixed in at least version 3.81.
I talked to Peter and it seemed easist to just simplify the gmake rules
and document the issue with a comment, attached.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/timezone/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/timezone/Makefile,v
retrieving revision 1.30
diff -c -c -r1.30 Makefile
*** src/timezone/Makefile    5 Jan 2009 10:25:59 -0000    1.30
--- src/timezone/Makefile    6 Jan 2009 02:06:26 -0000
***************
*** 38,49 ****
  all: submake-libpgport zic
  endif

  zic: $(ZICOBJS)
      $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)

  install: all installdirs
  ifeq (,$(with_system_tzdata))
!     $(if $(ZIC),$(ZIC),./zic) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
  endif
      $(MAKE) -C tznames $@

--- 38,57 ----
  all: submake-libpgport zic
  endif

+ # We could do this test in the action section:
+ #    $(if $(ZIC),$(ZIC),./zic)
+ # but gmake versions <= 3.78.1 or perhaps later have a bug
+ # that causes a segfault;  gmake 3.81 or later fixes this.
+ ifeq (,$(ZIC))
+ ZIC= ./zic
+ endif
+
  zic: $(ZICOBJS)
      $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)

  install: all installdirs
  ifeq (,$(with_system_tzdata))
!     $(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
  endif
      $(MAKE) -C tznames $@