Fix spurious assertion failures. Avoid glibc bug.
OBS-URL: https://build.opensuse.org/package/show/games/0ad?expand=0&rev=6
This commit is contained in:
parent
2404e1c9d9
commit
4f7165d27d
37
0ad-apicids.patch
Normal file
37
0ad-apicids.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
diff -r f2cdbf31ce9b source/lib/sysdep/arch/x86_x64/topology.cpp
|
||||||
|
--- source/lib/sysdep/arch/x86_x64/topology.cpp Sat Jul 10 18:42:54 2010 +0100
|
||||||
|
+++ source/lib/sysdep/arch/x86_x64/topology.cpp Sat Jul 24 19:57:17 2010 +0100
|
||||||
|
@@ -137,18 +137,24 @@
|
||||||
|
// core, package and shared cache. if they are available, we can determine
|
||||||
|
// the exact topology; otherwise we have to guess.
|
||||||
|
|
||||||
|
-// side effect: `removes' (via std::unique) duplicate IDs.
|
||||||
|
-static bool AreApicIdsUnique(u8* apicIds, size_t numProcessors)
|
||||||
|
+// if false is returned, the APIC IDs are fishy and shouldn't be used.
|
||||||
|
+// side effect: sorts IDs and `removes' (via std::unique) duplicates.
|
||||||
|
+static bool AreApicIdsUnique(u8* apicIds, size_t numIds)
|
||||||
|
{
|
||||||
|
- u8* const end = std::unique(apicIds, apicIds+numProcessors);
|
||||||
|
- const size_t numIds = end-apicIds;
|
||||||
|
- if(numIds == numProcessors) // all unique
|
||||||
|
+ std::sort(apicIds, apicIds+numIds);
|
||||||
|
+ u8* const end = std::unique(apicIds, apicIds+numIds);
|
||||||
|
+ const size_t numUnique = end-apicIds;
|
||||||
|
+ // all unique => IDs are valid.
|
||||||
|
+ if(numUnique == numIds)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
- // the only legitimate cause of duplication is when no xAPIC is
|
||||||
|
- // present (i.e. all are 0)
|
||||||
|
- debug_assert(numIds == 1);
|
||||||
|
- debug_assert(apicIds[0] == 0);
|
||||||
|
+ // all zero => the system lacks an xAPIC.
|
||||||
|
+ if(numUnique == 1 && apicIds[0] == 0)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ // duplicated IDs => something went wrong. for example, VMs might not
|
||||||
|
+ // expose all physical processors, and OS X still doesn't support
|
||||||
|
+ // thread affinity masks.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
33
0ad-traceparse.patch
Normal file
33
0ad-traceparse.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
diff -r 976c6a6b04e9 source/lib/file/common/trace.cpp
|
||||||
|
--- source/lib/file/common/trace.cpp Sat Jul 24 19:57:17 2010 +0100
|
||||||
|
+++ source/lib/file/common/trace.cpp Sat Jul 24 20:30:39 2010 +0100
|
||||||
|
@@ -57,13 +57,26 @@
|
||||||
|
wchar_t pathname[PATH_MAX+1] = L""; // includes space for terminator
|
||||||
|
wchar_t action;
|
||||||
|
#if EMULATE_SECURE_CRT
|
||||||
|
- #define TRACE_FORMAT L"%f: %lc \"%" STRINGIZE(PATH_MAX) "l[^\"]\" %zd\n" /* use a macro to allow compile-time type-checking */
|
||||||
|
- const int fieldsRead = swscanf(text.c_str(), TRACE_FORMAT, &m_timestamp, &action, pathname, &m_size);
|
||||||
|
+ // The desired code:
|
||||||
|
+// #define TRACE_FORMAT L"%f: %lc \"%" STRINGIZE(PATH_MAX) "l[^\"]\" %zd\n" /* use a macro to allow compile-time type-checking */
|
||||||
|
+// const int fieldsRead = swscanf(text.c_str(), TRACE_FORMAT, &m_timestamp, &action, pathname, &m_size);
|
||||||
|
+ // but that hits http://sources.redhat.com/bugzilla/show_bug.cgi?id=5225 and crashes on glibc 2.7
|
||||||
|
+ // We need to avoid reading any numbers after the %[]
|
||||||
|
+ #define TRACE_FORMAT_1 L"%f: %lc \"%" STRINGIZE(PATH_MAX) "l[^\"]\" %n"
|
||||||
|
+ #define TRACE_FORMAT_2 L"%zd\n"
|
||||||
|
+ int charsRead = 0;
|
||||||
|
+ int fieldsRead = swscanf(text.c_str(), TRACE_FORMAT_1, &m_timestamp, &action, pathname, &charsRead);
|
||||||
|
+ debug_assert(fieldsRead == 3);
|
||||||
|
+ if (fieldsRead == 3) // first part parsed okay
|
||||||
|
+ {
|
||||||
|
+ fieldsRead = swscanf(text.c_str() + charsRead, TRACE_FORMAT_2, &m_size);
|
||||||
|
+ debug_assert(fieldsRead == 1);
|
||||||
|
+ }
|
||||||
|
#else
|
||||||
|
#define TRACE_FORMAT L"%f: %lc \"%l[^\"]\" %d\n"
|
||||||
|
const int fieldsRead = swscanf_s(text.c_str(), TRACE_FORMAT, &m_timestamp, &action, 1, pathname, ARRAY_SIZE(pathname), &m_size);
|
||||||
|
+ debug_assert(fieldsRead == 4);
|
||||||
|
#endif
|
||||||
|
- debug_assert(fieldsRead == 4);
|
||||||
|
debug_assert(action == 'L' || action == 'S');
|
||||||
|
m_action = (EAction)action;
|
||||||
|
m_pathname = pathname;
|
4
0ad.spec
4
0ad.spec
@ -16,6 +16,8 @@ Patch5: 0ad-cs7793.patch
|
|||||||
Patch6: 0ad-cs7795.patch
|
Patch6: 0ad-cs7795.patch
|
||||||
Patch7: 0ad-cs7796.patch
|
Patch7: 0ad-cs7796.patch
|
||||||
Patch8: 0ad-DllLoader.patch
|
Patch8: 0ad-DllLoader.patch
|
||||||
|
Patch9: 0ad-apicids.patch
|
||||||
|
Patch10: 0ad-traceparse.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: binutils-devel
|
BuildRequires: binutils-devel
|
||||||
BuildRequires: boost-devel
|
BuildRequires: boost-devel
|
||||||
@ -103,6 +105,8 @@ history.
|
|||||||
%patch6
|
%patch6
|
||||||
%patch7
|
%patch7
|
||||||
%patch8
|
%patch8
|
||||||
|
%patch9
|
||||||
|
%patch10
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="%{optflags}"
|
export CFLAGS="%{optflags}"
|
||||||
|
@ -7,3 +7,5 @@
|
|||||||
0ad-cs7795.patch -p0
|
0ad-cs7795.patch -p0
|
||||||
0ad-cs7796.patch -p0
|
0ad-cs7796.patch -p0
|
||||||
0ad-DllLoader.patch -p0
|
0ad-DllLoader.patch -p0
|
||||||
|
0ad-apicids.patch -p0
|
||||||
|
0ad-traceparse.patch -p0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user