Re: [Fink-devel] qt3 and scribus bus error
Benjamin Reed wrote: That's strange, Q_OS_MAC should already be set in qglobal.h pretty muc no matter what, I can't imagine how that wouldn't be completely equivalent... Not for qt-x11. You are thinking about Qt/Mac, I suspect. In qglobal.h, I see #define QT_PLATFORM Q_OS_MACX11 #if defined(QT_PLATFORM) # if !defined(Q_OS_MACX11) #define Q_OS_MACX11 # endif #elif defined(__APPLE__) && defined(__GNUC__) # define Q_OS_MACX #elif defined(__MACOSX__) # define Q_OS_MACX [a lot more #elif's that are not used] #if defined(Q_OS_MAC9) || defined(Q_OS_MACX) # define Q_OS_MAC #endif Neither Q_OS_MACX nor Q_OS_MAC are defined, only Q_OS_MACX11. -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] qt3 and scribus bus error
Curiouser and curiouser... I came across a patch that has something to do with the subject. This patch was introduced almost a year ago into qt3-3.0.5-6 and was removed (forgotten?) in the update to qt-3.1. Here it is (from qt3-3.0.5-6.patch): --- qt-x11-free-3.0.5/src/tools/qstring.cpp Wed Sep 11 21:42:23 2002 +++ qt-x11-free-3.0.5-new/src/tools/qstring.cpp Wed Sep 11 21:42:26 2002 @@ -12528,7 +12528,7 @@ QStringData* QString::makeSharedNull() { QString::shared_null = new QStringData; -#if defined( Q_OS_MAC ) +#if 1 /* defined( Q_OS_MAC ) */ QString *that = const_cast(&QString::null); that->d = QString::shared_null; #endif I am not sure if I want to learn enough C++ to understand what this is doing. But I recompiled qt3 with this patch applied, and it helps, sort of. It does not eliminate crash No 1 ("QString crash1 = QString::null"), but it eliminates crashes No 2 (QDir) and 3 (QFile::open). And it even eliminates crash No 1, if anything else is done beforehand which invokes QString. For example, if crashtest No 2 is put before crashtest No 1, both don't crash. In particular, with this patched version of qt3, scribus-1.0-1 does not segfault any more, even when LANG is set. (In the meantime, I have made a package with a workaround, version 1.0.1-1). Max Horn wrote: Am Freitag, 08.08.03 um 17:35 Uhr schrieb Martin Costabel: [...] I am not buying this explanation completely, because on Darwin, this bus error happens *every time*, and on Linux, *never*. So it doesn't look like a problem involving randomly filled memory locations. Oh it's not a surprise. While the order in which static constructors are executed is not defined by the C++ standard, and may be completely random, on most target systems the order in which they are called is (semi-)deterministic. The reason why it never works on OS X and always on Linux could be something as trivial as that the one follow the rules "execute them alphabetically" and the other "execute them in reverse alphabetical order". Well the real rules will be different, involve the place where the constructors are defined etc., but you get the idea. I'll believe anything you say about C++ (given that I know nothing about it), but it really looks like QString:null *is* initialized, just not correctly. With the above patch, it is initialized correctly, at least sometimes. Or does this only change the time when it is initialized? -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] qt3 and scribus bus error
On Saturday, August 9, 2003, at 5:51PM, Martin Costabel wrote: -#if defined( Q_OS_MAC ) +#if 1 /* defined( Q_OS_MAC ) */ QString *that = const_cast(&QString::null); that->d = QString::shared_null; #endif I am not sure if I want to learn enough C++ to understand what this is doing. But I recompiled qt3 with this patch applied, and it helps, sort of. That's strange, Q_OS_MAC should already be set in qglobal.h pretty muc no matter what, I can't imagine how that wouldn't be completely equivalent... -- We put a lot of thought into our defaults. We like them. If we didn't, we would have made something else be the default. So keep your cotton-pickin' hands off our defaults. Don't touch. Consider them mandatory. "Mandatory defaults" has a nice ring to it. --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] qt3 and scribus bus error
On Saturday, August 9, 2003, at 7:11PM, Martin Costabel wrote: Neither Q_OS_MACX nor Q_OS_MAC are defined, only Q_OS_MACX11. You're right, that is a regression. I'll look into making a new release. -- We put a lot of thought into our defaults. We like them. If we didn't, we would have made something else be the default. So keep your cotton-pickin' hands off our defaults. Don't touch. Consider them mandatory. "Mandatory defaults" has a nice ring to it. --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] qt3 and scribus bus error
On Fri, Aug 08, 2003 at 05:35:16PM +0200, Martin Costabel wrote: Gak. There's no quick workaround that I'm aware of. The Scribus folks are relying on undefined behavior and we're stuck with the results. The only solutions I'm aware of both involve patching Scribus. You can either modify the routines in question so that they don't access static objects from other compilation units (that may, and probably will, include not calling methods in other compilation units which themselves might depend on static objects), or you can make certain the routines don't get called until after main() starts. > int crash1(){ > std::cout << "\n This is crashtest No 1\n"; > QString Crash1 = QString::null; > } Just a note: you not only have to worry about QString::null here, but std::cout as well. I've seen at least one platform choke and die on just such code (MSVC/Windows, I think). Just part of what makes cross-platform programming so much fun. - Dave --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] qt3 and scribus bus error
Am Freitag, 08.08.03 um 17:35 Uhr schrieb Martin Costabel: [...] I am not buying this explanation completely, because on Darwin, this bus error happens *every time*, and on Linux, *never*. So it doesn't look like a problem involving randomly filled memory locations. Oh it's not a surprise. While the order in which static constructors are executed is not defined by the C++ standard, and may be completely random, on most target systems the order in which they are called is (semi-)deterministic. The reason why it never works on OS X and always on Linux could be something as trivial as that the one follow the rules "execute them alphabetically" and the other "execute them in reverse alphabetical order". Well the real rules will be different, involve the place where the constructors are defined etc., but you get the idea. In any case, Scribus is using static objects to read in some character translation tables from some small text files before the main program starts up. For this, it uses qt file operations, which according to the above explanations should be a no-no in this situation. But "it works on Linux" (TM), so the scribus guys have no reason to change it. Well but it still is a bug in Scribus. They may not care if they work on non-Linux systems, but that doesn't change the fact that it:s a bug :-) They are apparently relying on behavior which the C++ standard explicitly calls undefined. The order in which static constructors are executed is arbitrary, and may even legally change each time you run a program. It may work for them now, but it's a very bad idea, not only for portability now, but also for future compatibility. If one day the Linux folks replace their dynamic linker with a new one, which changes the order it executes static constructors, then Scribus will go broke on Linux, too. It's bad design. They may not care, but it's a bug. Cheers, Max --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel