dev-libs/glib: import glib-2.32.4-r1 from upstream

Changed KEYWORDS to enable x86, amd64, and arm.

BUG=chromium-os:34103
TEST=remote trybot runs for x86, amd64, arm targets.

Change-Id: I10545517231e0aeb48dd75bbf1c007c67fd32682
Reviewed-on: https://gerrit.chromium.org/gerrit/32410
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
This commit is contained in:
Ben Chan 2012-09-06 10:41:28 -07:00 committed by Gerrit
parent 8fff790b91
commit d2a3143115
12 changed files with 410 additions and 328 deletions

View File

@ -1,2 +1,3 @@
DIST glib-2.30.2.tar.xz 5818860 RMD160 d8fc7c876bd15ea3a9255d4d0a67d745e3790488 SHA1 bc7be8572122997e4d5fc6691f51602f28cd4e3a SHA256 f0e91e6333321ddb48fa12b5c66f56c3d5f05325748c66dd2e9016c278ff8e82 DIST glib-2.32.4-AS_IF-patches.tar.xz 8584 SHA256 c61a87bbed8b09148f70f2651696430ab262d8ee905ebe2e0e963bb9038c5545 SHA512 cea825c379ea9014014f8a6f3a9fcf228e6b4245c649df4d86f6d86d1d655fd927ef1115fd66521cc48b2929d8cd504a284c7a8fb5ff38dc2b83ac4140655049 WHIRLPOOL e778094ad8ebe6fdc236942c21ee8ce2266712a08672b521f931159dd81d3452fcb8b6556c98c82b60548b1d9703a3ff332d02970a01565b6f5c4bcd02e74b46
DIST pkg-config-0.26.tar.gz 396399 RMD160 face3d16ec338b9b1ab41d56d6e4d1a5624b52d0 SHA1 fd71a70b023b9087c8a7bb76a0dc135a61059652 SHA256 94c1936a797c930fb3e4e5a154165b6268caba22b32d24083dd4c492a533c8af DIST glib-2.32.4.tar.xz 6178556 SHA256 a5d742a4fda22fb6975a8c0cfcd2499dd1c809b8afd4ef709bda4d11b167fae2 SHA512 bc8b2d6afae7635f940065eca3e854ee171812c7b582d55313db11d28875495dbf41fc0a260347b30f7490daa65ccc377d8a2d60bb3a26d07997606d8e3d989f WHIRLPOOL 35aec94088acff460685c0b1bb2e6fcffadb0f9f0044b93f3fa042ed82dd52efb5e56022575c0ebcfda4230d38edc26a916623f0bfcbfc8e1c6b76a3133d43bc
DIST pkg-config-0.26.tar.gz 396399 SHA256 94c1936a797c930fb3e4e5a154165b6268caba22b32d24083dd4c492a533c8af SHA512 9390d5918dd4ac520b914d2330aa7cae2587ca7b21b03bc88372fd5dbbd78e33eeb3fca39fcdb6dd10113658f03118a1c8829149c7029eb0dd80348d100170a4 WHIRLPOOL f535946a02192a9bffc7be0fae454e25aa86af8bac7f47622d52ed13f77f1ba05ff9b5693b2a501981e3991e4e1595eced22dee4ab748b310baa7d57267a62a7

View File

@ -1,39 +0,0 @@
From Debian, this one is needed for gcc < 4.1...
--- glib-2.10.0/glib/gatomic.c 2006-02-24 14:02:51.000000000 +0000
+++ glib-2.10.0/glib/gatomic.c 2006-03-06 18:12:06.000000000 +0000
@@ -414,14 +414,14 @@
g_atomic_int_exchange_and_add (volatile gint *atomic,
gint val)
{
- return __sync_fetch_and_add (atomic, val);
+ return __sync_fetch_and_add_si (atomic, val);
}
void
g_atomic_int_add (volatile gint *atomic,
gint val)
{
- __sync_fetch_and_add (atomic, val);
+ __sync_fetch_and_add_si (atomic, val);
}
gboolean
@@ -429,7 +429,7 @@
gint oldval,
gint newval)
{
- return __sync_bool_compare_and_swap (atomic, oldval, newval);
+ return __sync_bool_compare_and_swap_si (atomic, oldval, newval);
}
gboolean
@@ -437,7 +437,7 @@
gpointer oldval,
gpointer newval)
{
- return __sync_bool_compare_and_swap ((long *)atomic,
+ return __sync_bool_compare_and_swap_di ((long *)atomic,
(long)oldval, (long)newval);
}

View File

@ -1,20 +0,0 @@
Temporary workaround for gio tests failure when ran without FEATURES=userpriv
until upstream bug #552912 is fixed
--- gio/tests/live-g-file.c.orig 2008-09-25 05:44:12.848556034 +0300
+++ gio/tests/live-g-file.c 2008-09-25 06:12:34.248726237 +0300
@@ -769,11 +769,14 @@
if (posix_compat)
{
/* target directory is not accessible (no execute flag) */
+#if 0
+/* Fails when ran as root */
do_copy_move (root, item, TEST_DIR_NO_ACCESS,
TEST_NO_ACCESS);
/* target directory is readonly */
do_copy_move (root, item, TEST_DIR_NO_WRITE,
TEST_NO_ACCESS);
+#endif
}
}
}

View File

@ -1,19 +0,0 @@
Tests fail when upgrading glib from 2.22 to 2.24 if sys-devel/gdb is installed
because gdb is run on .libs/assert-msg-test before LD_LIBRARY_PATH is set. This
causes gdb to use the system-wide glib instead, and fail on the test.
This patch exports LD_LIBRARY_PATH before running gdb
https://bugzilla.gnome.org/621368
---
--- tests/run-assert-msg-test.sh
+++ tests/run-assert-msg-test.sh
@@ -34,6 +34,7 @@ if [ -e ".libs/lt-$msg_test" ]; then
msg_test="lt-$msg_test"
fi
echo_v "Running gdb on assert-msg-test"
+export LD_LIBRARY_PATH="`dirname $PWD`/glib/.libs:$LD_LIBRARY_PATH"
OUT=$(gdb --batch --ex run --ex "print (char*) __glib_assert_msg" .libs/$msg_test 2> $error_out) || \
fail "failed to run gdb"

View File

@ -1,75 +0,0 @@
Use an external gdbus-codegen package
--- configure.ac
+++ configure.ac
@@ -367,7 +367,7 @@
AC_SUBST(PERL_PATH)
# Need suitable python path for greport
-AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
+# AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
dnl ***********************
@@ -3857,8 +3857,6 @@
gthread/Makefile
gthread/tests/Makefile
gio/Makefile
-gio/gdbus-2.0/codegen/Makefile
-gio/gdbus-2.0/codegen/config.py
gio/xdgmime/Makefile
gio/inotify/Makefile
gio/libasyncns/Makefile
--- docs/reference/gio/Makefile.am
+++ docs/reference/gio/Makefile.am
@@ -138,8 +138,7 @@
gio-querymodules.1 \
glib-compile-schemas.1 \
gsettings.1 \
- gdbus.1 \
- gdbus-codegen.1
+ gdbus.1
if ENABLE_MAN
--- gio/Makefile.am
+++ gio/Makefile.am
@@ -2,7 +2,7 @@
NULL =
-SUBDIRS = gdbus-2.0/codegen
+SUBDIRS =
if OS_UNIX
SUBDIRS += libasyncns xdgmime
--- gio/tests/gdbus-object-manager-example/Makefile.am
+++ gio/tests/gdbus-object-manager-example/Makefile.am
@@ -21,10 +21,8 @@
gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \
$(NULL)
-$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile
+ $(AM_V_GEN) gdbus-codegen \
--interface-prefix org.gtk.GDBus.Example.ObjectManager. \
--c-namespace Example \
--c-generate-object-manager \
--- gio/tests/Makefile.am
+++ gio/tests/Makefile.am
@@ -266,10 +266,8 @@
gdbus_close_pending_LDADD = $(progs_ldadd)
if OS_UNIX
-gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile
+ $(AM_V_GEN) gdbus-codegen \
--interface-prefix org.project. \
--generate-c-code gdbus-test-codegen-generated \
--c-generate-object-manager \

View File

@ -1,61 +0,0 @@
Description: Handle the G_HOME environment variable to override the passwd entry
This will allow to fix various kinds of build failures due to restricted
build environments.
Author: Josselin Mouette <joss@debian.org>
Origin: vendor
--- a/docs/reference/glib/running.sgml
+++ b/docs/reference/glib/running.sgml
@@ -213,6 +213,22 @@
</para>
</formalpara>
+<formalpara id="G_HOME">
+ <title><envar>G_HOME</envar></title>
+
+ <para>
+ For various reasons, GLib applications ignore the <envar>HOME</envar>
+ environment variable on Unix systems and will use the user directory
+ as specified by the <filename>passwd</filename> entry, which is more
+ reliable.
+ </para>
+ <para>
+ The <envar>G_HOME</envar> environment variable will override any
+ other setting for the home directory. It is not meant for daily usage,
+ but it is useful in testing or building environments.
+ </para>
+</formalpara>
+
</refsect2>
<refsect2 id="setlocale">
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -1626,11 +1626,14 @@
}
#endif /* !G_OS_WIN32 */
+ g_home_dir = g_strdup (g_getenv ("G_HOME"));
+
#ifdef G_OS_WIN32
/* We check $HOME first for Win32, though it is a last resort for Unix
* where we prefer the results of getpwuid().
*/
- g_home_dir = g_strdup (g_getenv ("HOME"));
+ if (!g_home_dir)
+ g_home_dir = g_strdup (g_getenv ("HOME"));
/* Only believe HOME if it is an absolute path and exists */
if (g_home_dir)
@@ -1926,6 +1929,11 @@
* homedir = g_get_home_dir (<!-- -->);
* ]|
*
+ * However, to allow changing this value for testing and development
+ * purposes, the value of the <envar>G_HOME</envar> environment
+ * variable, if set, will override the <filename>passwd</filename>
+ * entry.
+ *
* Returns: the current user's home directory
*/
G_CONST_RETURN gchar*

View File

@ -1,32 +0,0 @@
From 1c9eceaccb6e6c4339cd6951cf53fbd60ae80b8b Mon Sep 17 00:00:00 2001
From: Alexandre Rostovtsev <tetromino@gentoo.org>
Date: Mon, 14 Nov 2011 01:43:22 -0500
Subject: [PATCH] _g_dbus_get_machine_id(): check /etc/machine-id too
machine-id can be in /etc or in /var/lib/dbus.
https://bugzilla.gnome.org/show_bug.cgi?id=663928
---
gio/gdbusprivate.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 55ac883..68c3ddf 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -1985,7 +1985,11 @@ _g_dbus_get_machine_id (GError **error)
gchar *ret;
/* TODO: use PACKAGE_LOCALSTATEDIR ? */
ret = NULL;
- if (!g_file_get_contents ("/var/lib/dbus/machine-id",
+ if (!g_file_get_contents ("/etc/machine-id",
+ &ret,
+ NULL,
+ NULL) &&
+ !g_file_get_contents ("/var/lib/dbus/machine-id",
&ret,
NULL,
error))
--
1.7.8.rc1

View File

@ -1,36 +0,0 @@
Fix from upstream for building with C++ compilers:
https://bugzilla.gnome.org/show_bug.cgi?id=663880
From 5d9f05eef147f17d71e38c9fba2e3f622c9ed21b Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Sat, 12 Nov 2011 10:26:31 -0500
Subject: [PATCH] glib-unix.h: Add G_BEGIN/END_DECLS
The omission was pointed out in bug 663880.
---
glib/glib-unix.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/glib/glib-unix.h b/glib/glib-unix.h
index 9642b5c..7be37f0 100644
--- a/glib/glib-unix.h
+++ b/glib/glib-unix.h
@@ -38,6 +38,8 @@
#error "This header may only be used on UNIX"
#endif
+G_BEGIN_DECLS
+
/**
* G_UNIX_ERROR:
*
@@ -77,4 +79,6 @@ guint g_unix_signal_add (gint signum,
GSourceFunc handler,
gpointer user_data);
-#endif
+G_END_DECLS
+
+#endif /* __G_UNIX_H__ */
--
1.7.7.1

View File

@ -0,0 +1,99 @@
From 732f04b55f59b8107a7fbe317317edb5f184ea8f Mon Sep 17 00:00:00 2001
From: Priit Laes <plaes@plaes.org>
Date: Fri, 3 Feb 2012 09:08:28 +0200
Subject: [PATCH] Split out gdbus codegen
---
configure.ac | 4 +---
docs/reference/gio/Makefile.am | 3 +--
gio/Makefile.am | 2 +-
gio/tests/Makefile.am | 6 ++----
gio/tests/gdbus-object-manager-example/Makefile.am | 6 ++----
5 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4cf04a1..0bb18c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -356,7 +356,7 @@ fi
AC_SUBST(PERL_PATH)
# Need suitable python path for greport
-AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
+# AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
dnl ***********************
@@ -3525,8 +3525,6 @@ gobject/glib-mkenums
gobject/tests/Makefile
gthread/Makefile
gio/Makefile
-gio/gdbus-2.0/codegen/Makefile
-gio/gdbus-2.0/codegen/config.py
gio/xdgmime/Makefile
gio/inotify/Makefile
gio/fen/Makefile
diff --git a/docs/reference/gio/Makefile.am b/docs/reference/gio/Makefile.am
index 535aa26..5027dd5 100644
--- a/docs/reference/gio/Makefile.am
+++ b/docs/reference/gio/Makefile.am
@@ -144,8 +144,7 @@ man_MANS = \
glib-compile-resources.1 \
gsettings.1 \
gresource.1 \
- gdbus.1 \
- gdbus-codegen.1
+ gdbus.1
if ENABLE_MAN
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 67eeae6..277931b 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.decl
NULL =
-SUBDIRS = gdbus-2.0/codegen
+SUBDIRS =
if OS_UNIX
SUBDIRS += xdgmime
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index e987fd1..66af8cf 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -275,10 +275,8 @@ gdbus_close_pending_SOURCES = gdbus-close-pending.c gdbus-sessionbus.c gdbus-ses
gdbus_close_pending_LDADD = $(progs_ldadd)
if OS_UNIX
-gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile
+ $(AM_V_GEN) gdbus-codegen \
--interface-prefix org.project. \
--generate-c-code gdbus-test-codegen-generated \
--c-generate-object-manager \
diff --git a/gio/tests/gdbus-object-manager-example/Makefile.am b/gio/tests/gdbus-object-manager-example/Makefile.am
index 9861d0e..9ca6eb9 100644
--- a/gio/tests/gdbus-object-manager-example/Makefile.am
+++ b/gio/tests/gdbus-object-manager-example/Makefile.am
@@ -21,10 +21,8 @@ GDBUS_GENERATED = \
gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \
$(NULL)
-$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile
+ $(AM_V_GEN) gdbus-codegen \
--interface-prefix org.gtk.GDBus.Example.ObjectManager. \
--c-namespace Example \
--c-generate-object-manager \
--
1.7.8.4

View File

@ -0,0 +1,247 @@
From 4c2928a54482913cf236bff0e66650a8f47e17ea Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Wed, 22 Aug 2012 18:26:11 +0000
Subject: CVE-2012-3524: Hardening for being run in a setuid environment
Some programs attempt to use libglib (or even libgio) when setuid.
For a long time, GTK+ simply aborted if launched in this
configuration, but we never had a real policy for GLib.
I'm not sure whether we should advertise such support. However, given
that there are real-world programs that do this currently, we can make
them safer with not too much effort.
Better to fix a problem caused by an interaction between two
components in *both* places if possible.
This patch adds a private function g_check_setuid() which is used to
first ensure we don't run an external dbus-launch binary if
DBUS_SESSION_BUS_ADDRESS isn't set.
Second, we also ensure the local VFS is used in this case. The
gdaemonvfs extension point will end up talking to the session bus
which is typically undesirable in a setuid context.
Implementing g_check_setuid() is interesting - whether or not we're
running in a privilege-escalated path is operating system specific.
Note that GTK+'s code to check euid versus uid worked historically on
Unix, more modern systems have filesystem capabilities and SELinux
domain transitions, neither of which are captured by the uid
comparison.
On Linux/glibc, the way this works is that the kernel sets an
AT_SECURE flag in the ELF auxiliary vector, and glibc looks for it on
startup. If found, then glibc sets a public-but-undocumented
__libc_enable_secure variable which we can use. Unfortunately, while
it *previously* worked to check this variable, a combination of newer
binutils and RPM break it:
http://www.openwall.com/lists/owl-dev/2012/08/14/1
So for now on Linux/glibc, we fall back to the historical Unix version
until we get glibc fixed.
On some BSD variants, there is a issetugid() function. On other Unix
variants, we fall back to what GTK+ has been doing.
Reported-By: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Colin Walters <walters@verbum.org>
---
diff --git a/configure.ac b/configure.ac
index 584df1d..67ea1a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -583,9 +583,20 @@ AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
# Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2)
+AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)
+AC_CACHE_CHECK([for __libc_enable_secure], glib_cv_have_libc_enable_secure,
+ [AC_TRY_LINK([#include <unistd.h>
+ extern int __libc_enable_secure;],
+ [return __libc_enable_secure;],
+ glib_cv_have_libc_enable_secure=yes,
+ glib_cv_have_libc_enable_secure=no)])
+AS_IF([test x$glib_cv_have_libc_enable_secure = xyes], [
+ AC_DEFINE(HAVE_LIBC_ENABLE_SECURE, 1,
+ [Define if you have the __libc_enable_secure variable (GNU libc, eglibc)])
+])
+
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
@@ -984,7 +995,7 @@ AC_MSG_RESULT(unsigned $glib_size_type)
# Check for some functions
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
-AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid)
+AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid getresuid)
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat)
# Check for high-resolution sleep functions
AC_CHECK_FUNCS(splice)
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index 4aa13b9..96b6343 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -37,6 +37,7 @@
#include "giostream.h"
#include "gasyncresult.h"
#include "gsimpleasyncresult.h"
+#include "glib-private.h"
#include "gdbusprivate.h"
#include "giomodule-priv.h"
#include "gdbusdaemon.h"
@@ -1023,6 +1024,14 @@ get_session_address_dbus_launch (GError **error)
restore_dbus_verbose = FALSE;
old_dbus_verbose = NULL;
+ /* Don't run binaries as root if we're setuid. */
+ if (GLIB_PRIVATE_CALL (g_check_setuid) ())
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Cannot spawn a message bus when setuid"));
+ goto out;
+ }
+
machine_id = _g_dbus_get_machine_id (error);
if (machine_id == NULL)
{
diff --git a/gio/gvfs.c b/gio/gvfs.c
index dda8afb..9afbcec 100644
--- a/gio/gvfs.c
+++ b/gio/gvfs.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <string.h>
#include "gvfs.h"
+#include "glib-private.h"
#include "glocalvfs.h"
#include "gresourcefile.h"
#include "giomodule-priv.h"
@@ -191,6 +192,8 @@ g_vfs_parse_name (GVfs *vfs,
GVfs *
g_vfs_get_default (void)
{
+ if (GLIB_PRIVATE_CALL (g_check_setuid) ())
+ return g_vfs_get_local ();
return _g_io_module_get_default (G_VFS_EXTENSION_POINT_NAME,
"GIO_USE_VFS",
(GIOModuleVerifyFunc)g_vfs_is_active);
diff --git a/glib/genviron.c b/glib/genviron.c
index 59a8bbe..9525cf0 100644
--- a/glib/genviron.c
+++ b/glib/genviron.c
@@ -40,6 +40,7 @@
#include <windows.h>
#endif
+#include "glib-private.h"
#include "gmem.h"
#include "gmessages.h"
#include "gstrfuncs.h"
diff --git a/glib/glib-private.c b/glib/glib-private.c
index 3946e77..3506782 100644
--- a/glib/glib-private.c
+++ b/glib/glib-private.c
@@ -38,7 +38,9 @@ glib__private__ (void)
g_wakeup_signal,
g_wakeup_acknowledge,
- g_get_worker_context
+ g_get_worker_context,
+
+ g_check_setuid
};
return &table;
diff --git a/glib/glib-private.h b/glib/glib-private.h
index fde0be8..87da6f3 100644
--- a/glib/glib-private.h
+++ b/glib/glib-private.h
@@ -25,6 +25,8 @@
G_GNUC_INTERNAL
GMainContext * g_get_worker_context (void);
+G_GNUC_INTERNAL
+gboolean g_check_setuid (void);
#define GLIB_PRIVATE_CALL(symbol) (glib__private__()->symbol)
@@ -40,6 +42,8 @@ typedef struct {
/* See gmain.c */
GMainContext * (* g_get_worker_context) (void);
/* Add other private functions here, initialize them in glib-private.c */
+
+ gboolean (* g_check_setuid) (void);
} GLibPrivateVTable;
GLibPrivateVTable *glib__private__ (void);
diff --git a/glib/gutils.c b/glib/gutils.c
index 38b5e44..f8a38d1 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2409,3 +2409,60 @@ g_get_tmp_dir (void)
}
#endif
+
+/* Private API:
+ *
+ * Returns %TRUE if the current process was executed as setuid (or an
+ * equivalent __libc_enable_secure is available). See:
+ * http://osdir.com/ml/linux.lfs.hardened/2007-04/msg00032.html
+ */
+gboolean
+g_check_setuid (void)
+{
+ /* TODO: get __libc_enable_secure exported from glibc.
+ * See http://www.openwall.com/lists/owl-dev/2012/08/14/1
+ */
+#if 0 && defined(HAVE_LIBC_ENABLE_SECURE)
+ {
+ /* See glibc/include/unistd.h */
+ extern int __libc_enable_secure;
+ return __libc_enable_secure;
+ }
+#elif defined(HAVE_ISSETUGID)
+ /* BSD: http://www.freebsd.org/cgi/man.cgi?query=issetugid&sektion=2 */
+ return issetugid ();
+#elif defined(G_OS_UNIX)
+ uid_t ruid, euid, suid; /* Real, effective and saved user ID's */
+ gid_t rgid, egid, sgid; /* Real, effective and saved group ID's */
+
+ static gsize check_setuid_initialised;
+ static gboolean is_setuid;
+
+ if (g_once_init_enter (&check_setuid_initialised))
+ {
+#ifdef HAVE_GETRESUID
+ /* These aren't in the header files, so we prototype them here.
+ */
+ int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
+ int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
+
+ if (getresuid (&ruid, &euid, &suid) != 0 ||
+ getresgid (&rgid, &egid, &sgid) != 0)
+#endif /* HAVE_GETRESUID */
+ {
+ suid = ruid = getuid ();
+ sgid = rgid = getgid ();
+ euid = geteuid ();
+ egid = getegid ();
+ }
+
+ is_setuid = (ruid != euid || ruid != suid ||
+ rgid != egid || rgid != sgid);
+
+ g_once_init_leave (&check_setuid_initialised, 1);
+ }
+ return is_setuid;
+#else
+ return FALSE;
+#endif
+}
--
cgit v0.9.0.2

View File

@ -0,0 +1,27 @@
From 6d032421b4871105e1f37bb75a5ec7b012f19f61 Mon Sep 17 00:00:00 2001
From: Alexandre Rostovtsev <tetromino@gentoo.org>
Date: Sun, 15 Jul 2012 22:30:07 -0400
Subject: [PATCH] gio: use /usr/share/bash-completion for bashcomp
In Gentoo, we use /usr/share/bash-completion, not
/usr/share/bash-completion/completions.
---
gio/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 704367c..bee9dc6 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -715,7 +715,7 @@ gdbus_LDADD = libgio-2.0.la \
$(top_builddir)/glib/libglib-2.0.la \
$(top_builddir)/gobject/libgobject-2.0.la
-completiondir = $(datadir)/bash-completion/completions
+completiondir = $(datadir)/bash-completion
completion_DATA = \
completion/gdbus \
completion/gsettings \
--
1.7.8.6

View File

@ -1,26 +1,30 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/glib/glib-2.30.2-r1.ebuild,v 1.1 2012/01/10 21:25:04 vapier Exp $ # $Header: /var/cvsroot/gentoo-x86/dev-libs/glib/glib-2.32.4-r1.ebuild,v 1.6 2012/10/06 21:17:44 blueness Exp $
EAPI="4" EAPI="4"
PYTHON_DEPEND="utils? 2" PYTHON_DEPEND="utils? 2"
# Avoid runtime dependency on python when USE=test # Avoid runtime dependency on python when USE=test
inherit autotools gnome.org libtool eutils flag-o-matic multilib pax-utils python toolchain-funcs virtualx inherit autotools gnome.org libtool eutils flag-o-matic gnome2-utils multilib pax-utils python toolchain-funcs virtualx linux-info
DESCRIPTION="The GLib library of C routines" DESCRIPTION="The GLib library of C routines"
HOMEPAGE="http://www.gtk.org/" HOMEPAGE="http://www.gtk.org/"
SRC_URI="${SRC_URI} SRC_URI="${SRC_URI}
http://dev.gentoo.org/~tetromino/distfiles/glib/${P}-AS_IF-patches.tar.xz
http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz" # pkg.m4 for eautoreconf http://pkgconfig.freedesktop.org/releases/pkg-config-0.26.tar.gz" # pkg.m4 for eautoreconf
LICENSE="LGPL-2" LICENSE="LGPL-2+"
SLOT="2" SLOT="2"
IUSE="debug doc fam selinux +static-libs systemtap test utils xattr" IUSE="debug doc fam kernel_linux selinux static-libs systemtap test utils xattr"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~x86-linux" KEYWORDS="~alpha amd64 arm hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
RDEPEND="virtual/libiconv RDEPEND="virtual/libiconv
virtual/libffi virtual/libffi
sys-libs/zlib sys-libs/zlib
|| (
>=dev-libs/elfutils-0.142
>=dev-libs/libelf-0.8.12 )
xattr? ( sys-apps/attr ) xattr? ( sys-apps/attr )
fam? ( virtual/fam ) fam? ( virtual/fam )
utils? ( >=dev-util/gdbus-codegen-${PV} )" utils? ( >=dev-util/gdbus-codegen-${PV} )"
@ -39,7 +43,10 @@ DEPEND="${RDEPEND}
>=dev-util/gdbus-codegen-${PV} >=dev-util/gdbus-codegen-${PV}
>=sys-apps/dbus-1.2.14 ) >=sys-apps/dbus-1.2.14 )
!<dev-util/gtk-doc-1.15-r2" !<dev-util/gtk-doc-1.15-r2"
PDEPEND="!<gnome-base/gvfs-1.6.4-r990" # Earlier versions do not work with glib PDEPEND="x11-misc/shared-mime-info
!<gnome-base/gvfs-1.6.4-r990"
# shared-mime-info needed for gio/xdgmime, bug #409481
# Earlier versions of gvfs do not work with glib
pkg_setup() { pkg_setup() {
# Needed for gio/tests/gdbus-testserver.py # Needed for gio/tests/gdbus-testserver.py
@ -47,42 +54,30 @@ pkg_setup() {
python_set_active_version 2 python_set_active_version 2
python_pkg_setup python_pkg_setup
fi fi
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
linux-info_pkg_setup
fi
} }
src_prepare() { src_prepare() {
mv -vf "${WORKDIR}"/pkg-config-*/pkg.m4 "${WORKDIR}"/ || die epatch "${FILESDIR}"/${P}-CVE-2012-3524.patch
if use ia64 ; then mv -f "${WORKDIR}"/pkg-config-*/pkg.m4 "${WORKDIR}"/ || die
# Only apply for < 4.1
local major=$(gcc-major-version)
local minor=$(gcc-minor-version)
if (( major < 4 || ( major == 4 && minor == 0 ) )); then
epatch "${FILESDIR}/glib-2.10.3-ia64-atomic-ops.patch"
fi
fi
# Fix from upstream for building with C++ compilers.
epatch "${FILESDIR}"/${P}-missing-decls.patch
# Don't fail gio tests when ran without userpriv, upstream bug 552912
# This is only a temporary workaround, remove as soon as possible
# epatch "${FILESDIR}/${PN}-2.18.1-workaround-gio-test-failure-without-userpriv.patch"
# Fix gmodule issues on fbsd; bug #184301 # Fix gmodule issues on fbsd; bug #184301
epatch "${FILESDIR}"/${PN}-2.12.12-fbsd.patch epatch "${FILESDIR}"/${PN}-2.12.12-fbsd.patch
# Fix test failure when upgrading from 2.22 to 2.24, upstream bug 621368
epatch "${FILESDIR}/${PN}-2.24-assert-test-failure.patch"
# Do not try to remove files on live filesystem, upstream bug #619274
sed 's:^\(.*"/desktop-app-info/delete".*\):/*\1*/:' \
-i "${S}"/gio/tests/desktop-app-info.c || die "sed failed"
# need to build tests if USE=doc for bug #387385 # need to build tests if USE=doc for bug #387385
if ! use test && ! use doc; then if ! use test && ! use doc; then
# don't waste time building tests # don't waste time building tests
sed 's/^\(.*\SUBDIRS .*\=.*\)tests\(.*\)$/\1\2/' -i $(find . -name Makefile.am -o -name Makefile.in) || die sed 's/^\(.*\SUBDIRS .*\=.*\)tests\(.*\)$/\1\2/' -i $(find . -name Makefile.am -o -name Makefile.in) || die
else else
# Do not try to remove files on live filesystem, upstream bug #619274
sed 's:^\(.*"/desktop-app-info/delete".*\):/*\1*/:' \
-i "${S}"/gio/tests/desktop-app-info.c || die "sed failed"
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629 # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629
if ! has_version dev-util/desktop-file-utils ; then if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system," ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
@ -110,16 +105,16 @@ src_prepare() {
fi fi
# gdbus-codegen is a separate package # gdbus-codegen is a separate package
epatch "${FILESDIR}/${PN}-2.30.1-external-gdbus-codegen.patch" epatch "${FILESDIR}/${PN}-2.31.x-external-gdbus-codegen.patch"
# Handle the G_HOME environment variable to override the passwd entry, upstream bug #142568 # bashcomp goes in /usr/share/bash-completion
epatch "${FILESDIR}/${PN}-2.30.1-homedir-env.patch" epatch "${FILESDIR}/${PN}-2.32.4-bashcomp.patch"
# Fix hardcoded path to machine-id wrt #390143 # AS_IF fixes from 2.33.x, needed for cross-compiling, bug #434770
epatch "${FILESDIR}/${PN}-2.30.2-machine-id.patch" epatch ../AS_IF-patches/*.patch
# disable pyc compiling # disable pyc compiling
echo '#!/bin/sh' > py-compile use test && python_clean_py-compile_files
# Needed for the punt-python-check patch, disabling timeout test # Needed for the punt-python-check patch, disabling timeout test
# Also needed to prevent croscompile failures, see bug #267603 # Also needed to prevent croscompile failures, see bug #267603
@ -135,7 +130,7 @@ src_configure() {
# Avoid circular depend with dev-util/pkgconfig and # Avoid circular depend with dev-util/pkgconfig and
# native builds (cross-compiles won't need pkg-config # native builds (cross-compiles won't need pkg-config
# in the target ROOT to work here) # in the target ROOT to work here)
if ! tc-is-cross-compiler && ! has_version dev-util/pkgconfig; then if ! tc-is-cross-compiler && ! $(tc-getPKG_CONFIG) --version >& /dev/null; then
if has_version sys-apps/dbus; then if has_version sys-apps/dbus; then
export DBUS1_CFLAGS="-I/usr/include/dbus-1.0 -I/usr/$(get_libdir)/dbus-1.0/include" export DBUS1_CFLAGS="-I/usr/include/dbus-1.0 -I/usr/$(get_libdir)/dbus-1.0/include"
export DBUS1_LIBS="-ldbus-1" export DBUS1_LIBS="-ldbus-1"
@ -162,7 +157,6 @@ src_configure() {
$(use_enable static-libs static) \ $(use_enable static-libs static) \
$(use_enable systemtap dtrace) \ $(use_enable systemtap dtrace) \
$(use_enable systemtap systemtap) \ $(use_enable systemtap systemtap) \
--enable-regex \
--with-pcre=internal \ --with-pcre=internal \
--with-threads=posix --with-threads=posix
} }
@ -185,24 +179,20 @@ src_install() {
dodoc AUTHORS ChangeLog* NEWS* README dodoc AUTHORS ChangeLog* NEWS* README
insinto /usr/share/bash-completion
for f in gdbus gsettings; do
newins "${ED}/etc/bash_completion.d/${f}-bash-completion.sh" ${f}
done
rm -rf "${ED}/etc"
# Completely useless with or without USE static-libs, people need to use # Completely useless with or without USE static-libs, people need to use
# pkg-config # pkg-config
find "${D}" -name '*.la' -exec rm -f {} + find "${D}" -name '*.la' -exec rm -f {} +
} }
src_test() { src_test() {
gnome2_environment_reset
unset DBUS_SESSION_BUS_ADDRESS unset DBUS_SESSION_BUS_ADDRESS
export XDG_CONFIG_DIRS=/etc/xdg export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share export XDG_DATA_DIRS=/usr/local/share:/usr/share
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp" export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export XDG_DATA_HOME="${T}"
unset GSETTINGS_BACKEND # bug 352451 unset GSETTINGS_BACKEND # bug 352451
export LC_TIME=C # bug #411967
# Related test is a bit nitpicking # Related test is a bit nitpicking
mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"