Fix getauxval error at qemu 12/308312/1 accepted/tizen/unified/20240322.174329 accepted/tizen/unified/x/20240326.073333
authorJinWang An <jinwang.an@samsung.com>
Thu, 21 Mar 2024 08:10:34 +0000 (17:10 +0900)
committerJinWang An <jinwang.an@samsung.com>
Thu, 21 Mar 2024 08:10:34 +0000 (17:10 +0900)
Change-Id: I2e7b652ed9d66f2f52b8bbac4f8b19caf603bf6e
Signed-off-by: JinWang An <jinwang.an@samsung.com>
packaging/fix_getauxval_error_at_qemu.patch [new file with mode: 0644]
packaging/glib2.spec

diff --git a/packaging/fix_getauxval_error_at_qemu.patch b/packaging/fix_getauxval_error_at_qemu.patch
new file mode 100644 (file)
index 0000000..bac4231
--- /dev/null
@@ -0,0 +1,30 @@
+diff --git a/glib/gutils.c b/glib/gutils.c
+index 4bccd7229..c983e71c3 100644
+--- a/glib/gutils.c
++++ b/glib/gutils.c
+@@ -3011,7 +3011,24 @@ g_check_setuid (void)
+   value = getauxval (AT_SECURE);
+   errsv = errno;
+   if (errsv)
+-    g_error ("getauxval () failed: %s", g_strerror (errsv));
++    {
++/*
++    Apparently, Tizen is built with qemu version < 2.12.
++
++    qemu 2.12 introduces providing AT_SECURE in auxiliary vector,
++    and the only purpose of using getauxval in glib is to get AT_SECURE.
++
++    If g_check_setuid() bails out with error, some packages may not build,
++    as their building process requires executing tools that call g_check_setuid().
++
++    So, don't bail out with error if getauxval(AT_SECURE) fails.
++    Instead, set the result of checking suid to FALSE (no suid).
++
++    It may be reverted if all the builds are made within qemu >= 2.12.
++*/
++/*    g_error ("getauxval () failed: %s", g_strerror (errsv));*/
++      return FALSE;
++    }
+   return value;
+ #elif defined(HAVE_ISSETUGID) && !defined(__BIONIC__)
+   /* BSD: http://www.freebsd.org/cgi/man.cgi?query=issetugid&sektion=2 */
index d04ff4f..af1fcc7 100644 (file)
@@ -31,6 +31,7 @@ Source6:        macros.glib2
 Source7:        gtk-doc.m4
 Source8:        LICENSE.MIT
 Source99:       baselibs.conf
+Source101:      fix_getauxval_error_at_qemu.patch
 Source200:      kdbus1.patch
 Source201:      kdbus2.patch
 Source1001:    glib2.manifest
@@ -225,6 +226,7 @@ for gdbus component.
 
 %prep
 %setup -q -n %{name}-%{version}
+%{__patch} -p1 < %{SOURCE101}
 
 %build
 cp %{SOURCE3} .