ports/182846: patch misc/ossp-uuid to prevent postgresql crash
Christopher Hall
christopherhall.hsw at gmail.com
Wed Oct 9 02:40:00 UTC 2013
>Number: 182846
>Category: ports
>Synopsis: patch misc/ossp-uuid to prevent postgresql crash
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 09 02:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Christopher Hall
>Release: 9.1-RELEASE-p20
>Organization:
>Environment:
9.1-RELEASE-p20 amd64 from PCBSD 9.1 install
>Description:
The misc/ossp-uuid library contains two functions that have the same name
as functions in FreeBSD libc. These are uuid_create and uuid_compare.
When postgresql-contrib (any version) is loaded attempting a
select uuid_generate_v4();
will crash the postgresql server with a bus error (signal 10).
The reason is that the ossp-uuid module is accessing the uuid_create from libc
and the uuid_make from ossp-uuid so the uuid struct do not match.
>How-To-Repeat:
in psql command line:
select uuid_generate_v4();
connected server will crash
>Fix:
The attached patch solves this by:
1. adding #defines to header to rename the two fuctions
2. adding aliases to library for the renamed functions
After reinstalling misc/ossp-uuid with the changes the postgresqlXX-contrib
can be recompiled and reinstalled and the the uuid module will fuction
correctly, allowing postgresql server to generate uuids.
Patch attached with submission follows:
diff -urN ossp-uuid.ORIG/files/patch-uuid.c ossp-uuid/files/patch-uuid.c
--- ossp-uuid.ORIG/files/patch-uuid.c 1970-01-01 08:00:00.000000000 +0800
+++ ossp-uuid/files/patch-uuid.c 2013-10-09 09:46:24.117554804 +0800
@@ -0,0 +1,28 @@
+--- uuid.c.orig 2008-03-07 18:49:59.000000000 +0800
++++ uuid.c 2013-10-05 12:36:27.550965193 +0800
+@@ -28,6 +28,7 @@
+ */
+
+ /* own headers (part 1/2) */
++#define __OSSP__COMPILING_UUID_C 1
+ #include "uuid.h"
+ #include "uuid_ac.h"
+
+@@ -93,6 +94,17 @@
+ unsigned long time_seq; /* last timestamp sequence counter */
+ };
+
++/* create aliases to access the functions hidden by FreeBSD libc */
++#if defined(__FreeBSD__)
++
++uuid_rc_t __ossp__uuid_create(uuid_t **uuid)
++ __attribute__ ((alias ("uuid_create")));
++
++uuid_rc_t __ossp__uuid_compare(const uuid_t *uuid1, const uuid_t *uuid2, int *result)
++ __attribute__ ((alias ("uuid_compare")));
++
++#endif
++
+ /* create UUID object */
+ uuid_rc_t uuid_create(uuid_t **uuid)
+ {
diff -urN ossp-uuid.ORIG/files/patch-uuid.h.in ossp-uuid/files/patch-uuid.h.in
--- ossp-uuid.ORIG/files/patch-uuid.h.in 1970-01-01 08:00:00.000000000 +0800
+++ ossp-uuid/files/patch-uuid.h.in 2013-10-09 09:46:17.407539642 +0800
@@ -0,0 +1,15 @@
+--- uuid.h.in.orig 2008-03-07 18:49:59.000000000 +0800
++++ uuid.h.in 2013-10-05 12:36:27.550965193 +0800
+@@ -93,6 +93,12 @@
+ struct uuid_st;
+ typedef struct uuid_st uuid_t;
+
++/* resolve conflicts with uuid_create/uuid_compare in FreeBSD libc */
++#if defined(__FreeBSD__) && !defined(__OSSP__COMPILING_UUID_C)
++#define uuid_create __ossp__uuid_create
++#define uuid_compare __ossp__uuid_compare
++#endif
++
+ /* UUID object handling */
+ extern uuid_rc_t uuid_create ( uuid_t **_uuid);
+ extern uuid_rc_t uuid_destroy ( uuid_t *_uuid);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list