Re: Exception when opening Document-settings on Solaris
OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. Done. I've also reopened the bug report with a comment. this starts to be pita :( I updated from svn on July 17 evening, and the GCC3 bug is still there. are you sure you havent frontend_helpers.cpp patched by some previous work ? looking into source i dont see how this can happen. I applied Enrico's last patch (try/catch solution) with success. anyway - this patch reverts _any_ changes done wrt bug 2738, does it work for you ? we can either commit this patch or if jose release rc3 with dovs work we can add try-catch patch to the bump. BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ??? this happens not only with this file. pavel Index: frontend_helpers.cpp === --- frontend_helpers.cpp(revision 19134) +++ frontend_helpers.cpp(working copy) @@ -40,7 +40,6 @@ #include algorithm #include fstream -#include locale using std::string; using std::vector; @@ -1108,22 +1107,10 @@ LanguagePair, bool { public: -#if 1//defined(__GNUC__) (!defined(USE_WCHAR_T) || __GNUC__ 4) bool operator()(LanguagePair const lhs, LanguagePair const rhs) const { return lhs.first rhs.first; } -#else -// this is supposed to fix bug 2738, but it is not stable yet -// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 - Sorter() : loc_() {}; - bool operator()(LanguagePair const lhs, - LanguagePair const rhs) const { - return loc_(lhs.first, rhs.first); - } -private: - std::locale loc_; -#endif }; } // namespace anon
Re: Exception when opening Document-settings on Solaris
Pavel Sanda [EMAIL PROTECTED] writes: are you sure you havent frontend_helpers.cpp patched by some previous work ? looking into source i dont see how this can happen. I might have messed things up, but I'm pretty sure. I applied Enrico's last patch (try/catch solution) with success. anyway - this patch reverts _any_ changes done wrt bug 2738, does it work for you ? Yes, either removing locale sorting or applying try/catch solution work here: Document-Settings opens all right. BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ??? this happens not only with this file. Could it come from the \author: Herbert Voß line located in the preamble? -- Jean-Pierre
Re: Exception when opening Document-settings on Solaris
BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ??? this happens not only with this file. Could it come from the \author: Herbert Voß line located in the preamble? no, other files with this line work well. pavel
Re: Exception when opening Document-settings on Solaris
BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ??? this happens not only with this file. FYI: $ wget http://www.lyx.org/trac/browser/lyx-devel/tags/lyx-1_4_4/src/frontends/controllers/tex_helpers.C --03:16:55-- http://www.lyx.org/trac/browser/lyx-devel/tags/lyx-1_4_4/src/frontends/controllers/tex_helpers.C = `tex_helpers.C' Resolving www.lyx.org... 62.70.27.115 Connecting to www.lyx.org|62.70.27.115|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.texnik.de/ [following] --03:16:55-- http://www.texnik.de/ = `index.html.2' Resolving www.texnik.de... 81.169.145.91 Connecting to www.texnik.de|81.169.145.91|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 162 [text/html] 0K 100% 14.05 MB/s 03:16:55 (14.05 MB/s) - `index.html.2' saved [162/162] --- it will be difficult to say anything before looking into apache and trac logs :( pavel
Re: Exception when opening Document->settings on Solaris
> > > OK then. Enrico earlier agreed with this and then we will have more time > > > to > > > fix this properly. > > > > Done. I've also reopened the bug report with a comment. this starts to be pita :( > I updated from svn on July 17 evening, and the GCC3 bug is still > there. are you sure you havent frontend_helpers.cpp patched by some previous work ? looking into source i dont see how this can happen. > I applied Enrico's last patch (try/catch solution) with success. anyway - this patch reverts _any_ changes done wrt bug 2738, does it work for you ? we can either commit this patch or if jose release rc3 with dovs work we can add try-catch patch to the bump. > BTW with trac, trying to display frontend_helpers.cpp redirects me to > http://tug.org/TeXnik/ ??? this happens not only with this file. pavel Index: frontend_helpers.cpp === --- frontend_helpers.cpp(revision 19134) +++ frontend_helpers.cpp(working copy) @@ -40,7 +40,6 @@ #include #include -#include using std::string; using std::vector; @@ -1108,22 +1107,10 @@ LanguagePair, bool> { public: -#if 1//defined(__GNUC__) && (!defined(USE_WCHAR_T) || __GNUC__ < 4) bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { return lhs.first < rhs.first; } -#else -// this is supposed to fix bug 2738, but it is not stable yet -// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 - Sorter() : loc_("") {}; - bool operator()(LanguagePair const & lhs, - LanguagePair const & rhs) const { - return loc_(lhs.first, rhs.first); - } -private: - std::locale loc_; -#endif }; } // namespace anon
Re: Exception when opening Document->settings on Solaris
Pavel Sanda <[EMAIL PROTECTED]> writes: > > are you sure you havent frontend_helpers.cpp patched by some previous > work ? looking into source i dont see how this can happen. I might have messed things up, but I'm pretty sure. > > > I applied Enrico's last patch (try/catch solution) with success. > > anyway - this patch reverts _any_ changes done wrt bug 2738, > does it work for you ? Yes, either removing locale sorting or applying try/catch solution work here: Document->Settings opens all right. > > > BTW with trac, trying to display frontend_helpers.cpp redirects me to > > http://tug.org/TeXnik/ ??? > > this happens not only with this file. Could it come from the \author: Herbert Voß line located in the preamble? -- Jean-Pierre
Re: Exception when opening Document->settings on Solaris
> > > BTW with trac, trying to display frontend_helpers.cpp redirects me to > > > http://tug.org/TeXnik/ ??? > > > > this happens not only with this file. > > Could it come from the > \author: Herbert Voß > line located in the preamble? no, other files with this line work well. pavel
Re: Exception when opening Document->settings on Solaris
> > > > BTW with trac, trying to display frontend_helpers.cpp redirects me to > > > > http://tug.org/TeXnik/ ??? > > > > > > this happens not only with this file. FYI: $ wget http://www.lyx.org/trac/browser/lyx-devel/tags/lyx-1_4_4/src/frontends/controllers/tex_helpers.C --03:16:55-- http://www.lyx.org/trac/browser/lyx-devel/tags/lyx-1_4_4/src/frontends/controllers/tex_helpers.C => `tex_helpers.C' Resolving www.lyx.org... 62.70.27.115 Connecting to www.lyx.org|62.70.27.115|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.texnik.de/ [following] --03:16:55-- http://www.texnik.de/ => `index.html.2' Resolving www.texnik.de... 81.169.145.91 Connecting to www.texnik.de|81.169.145.91|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 162 [text/html] 0K 100% 14.05 MB/s 03:16:55 (14.05 MB/s) - `index.html.2' saved [162/162] --- it will be difficult to say anything before looking into apache and trac logs :( pavel
Re: Exception when opening Document-settings on Solaris
Jürgen Spitzmüller [EMAIL PROTECTED] writes: José Matos wrote: OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. Done. I've also reopened the bug report with a comment. I updated from svn on July 17 evening, and the GCC3 bug is still there. I applied Enrico's last patch (try/catch solution) with success. -- Jean-Pierre BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ???
Re: Exception when opening Document->settings on Solaris
Jürgen Spitzmüller <[EMAIL PROTECTED]> writes: > > José Matos wrote: > > OK then. Enrico earlier agreed with this and then we will have more time to > > fix this properly. > > Done. I've also reopened the bug report with a comment. I updated from svn on July 17 evening, and the GCC3 bug is still there. I applied Enrico's last patch (try/catch solution) with success. -- Jean-Pierre BTW with trac, trying to display frontend_helpers.cpp redirects me to http://tug.org/TeXnik/ ???
Re: Exception when opening Document-settings on Solaris
On Fri, Jul 13, 2007 at 01:16:31PM +0200, Pavel Sanda wrote: The exception is thrown by the locale constructor, not when the ordering is performed. are you sure this holds for all previous crashes ? Yes, I am pretty sure. -- Enrico
Re: Exception when opening Document->settings on Solaris
On Fri, Jul 13, 2007 at 01:16:31PM +0200, Pavel Sanda wrote: > > The exception is thrown by the locale constructor, not when the > > ordering is performed. > > are you sure this holds for all previous crashes ? Yes, I am pretty sure. -- Enrico
Re: Exception when opening Document-settings on Solaris
The exception is thrown by the locale constructor, not when the ordering is performed. are you sure this holds for all previous crashes ? but even if this is not true, we can add one 'idle' call of loc() inside try block which would catch it beforehead. pavel
Re: Exception when opening Document->settings on Solaris
> The exception is thrown by the locale constructor, not when the > ordering is performed. are you sure this holds for all previous crashes ? but even if this is not true, we can add one 'idle' call of loc() inside try block which would catch it beforehead. pavel
Re: Exception when opening Document-settings on Solaris
Enrico Forestieri [EMAIL PROTECTED] writes: Yes, this is r18988 striking again :( I don't think that this is related to the platform but rather to the compiler version. I think that gcc 3.x is missing some locale facets. Jean-Pierre, does the attached patch solve the bug for you? Solved, thanks a lot. -- Jean-Pierre
Re: Exception when opening Document-settings on Solaris
Pavel == Pavel Sanda [EMAIL PROTECTED] writes: Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. Pavel Ouch. What if we instead of using multiple #ifs catch the Pavel exception and decide what kind sorter would be used ? Or maybe revert the locale sorting patch for 1.5.0 and take the time to get it right. JMarc
Re: Exception when opening Document-settings on Solaris
On Wednesday 11 July 2007 20:36:25 Enrico Forestieri wrote: Yes, this is r18988 striking again :( I don't think that this is related to the platform but rather to the compiler version. I think that gcc 3.x is missing some locale facets. Jean-Pierre, does the attached patch solve the bug for you? Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. Is this (!defined(USE_WCHAR_T) still required? As far as I understood you argument this would be enough: #if defined(__GNUC__) __GNUC__ 4) Or at least the other way around: #if defined(__GNUC__) __GNUC__ 4) || (!defined(USE_WCHAR_T) -- José Abílio
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 10:05:09AM +0100, José Matos wrote: On Wednesday 11 July 2007 20:36:25 Enrico Forestieri wrote: Yes, this is r18988 striking again :( I don't think that this is related to the platform but rather to the compiler version. I think that gcc 3.x is missing some locale facets. Jean-Pierre, does the attached patch solve the bug for you? Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. Is this (!defined(USE_WCHAR_T) still required? I think so, see below. As far as I understood you argument this would be enough: #if defined(__GNUC__) __GNUC__ 4) No, because it doesn't catch systems where sizeof(wchar_t) == 2 and gcc = 4.0. Or at least the other way around: #if defined(__GNUC__) __GNUC__ 4) || (!defined(USE_WCHAR_T) This one would also catch MSVC, which AFAIK has no problem with the locale sorting. -- Enrico
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 09:26:55AM +0200, Jean-Marc Lasgouttes wrote: Pavel == Pavel Sanda [EMAIL PROTECTED] writes: Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. Pavel Ouch. What if we instead of using multiple #ifs catch the Pavel exception and decide what kind sorter would be used ? Or maybe revert the locale sorting patch for 1.5.0 and take the time to get it right. This one may be the best option. -- Enrico
Re: Exception when opening Document-settings on Solaris
On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: This one would also catch MSVC, which AFAIK has no problem with the locale sorting. OK. You can commit the change. -- Enrico -- José Abílio
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 10:53:54AM +0100, José Matos wrote: On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: This one would also catch MSVC, which AFAIK has no problem with the locale sorting. OK. You can commit the change. I did it. -- Enrico
Re: Exception when opening Document-settings on Solaris
On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: This one would also catch MSVC, which AFAIK has no problem with the locale sorting. OK. You can commit the change. even if this change helps for solaris i fear many crashes on systems with strangely set locales. the changeset should be reverted back until we know how safely detect the error. btw have anybody better solution than handling the exception ? pavel
Re: Exception when opening Document-settings on Solaris
Pavel Sanda wrote: even if this change helps for solaris i fear many crashes on systems with strangely set locales. the changeset should be reverted back until we know how safely detect the error. FWIW, I agree. Jürgen
Re: Exception when opening Document-settings on Solaris
Pavel Sanda wrote: On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: This one would also catch MSVC, which AFAIK has no problem with the locale sorting. OK. You can commit the change. even if this change helps for solaris i fear many crashes on systems with strangely set locales. the changeset should be reverted back until we know how safely detect the error. btw have anybody better solution than handling the exception ? What do you mean by handling the exception? Fallback to the non wchar_t solution if an exception is caught? For this to work the choice of using wchar_t or not must be done at run-time; unfortunately the source code is really not ready to do that now (lots of #ifdef). Abdel.
Re: Exception when opening Document-settings on Solaris
What do you mean by handling the exception? Fallback to the non wchar_t yes solution if an exception is caught? For this to work the choice of using wchar_t or not must be done at run-time; unfortunately the source code is really not ready to do that now (lots of #ifdef). wont be possible to avoid any ifdefs by doing something like : try locale stuff (init+sort); catch any_error: do non_locale stuff ? (i'm not much familiar with exceptions, maybe just talking nonsense.) pavel
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 12:54:39PM +0200, Pavel Sanda wrote: wont be possible to avoid any ifdefs by doing something like : try locale stuff (init+sort); catch any_error: do non_locale stuff Note that this is used in a sorting context, so the comparison should be as fast as possible. I don't think that the try/catch game fits the bill here. -- Enrico
Re: Exception when opening Document-settings on Solaris
Note that this is used in a sorting context, so the comparison should be as fast as possible. I don't think that the try/catch we are sorting some ~50 items. anyway it can be written that try block is entered only once per one sorting. pavel
Re: Exception when opening Document-settings on Solaris
Pavel Sanda wrote: even if this change helps for solaris i fear many crashes on systems with strangely set locales. I even get the crash by - LANG=en_EN lyx - Tools-Preferences Jürgen
Re: Exception when opening Document-settings on Solaris
Jürgen Spitzmüller wrote: even if this change helps for solaris i fear many crashes on systems with strangely set locales. I even get the crash by - LANG=en_EN lyx - Tools-Preferences For 1.5.0, I propose the attached. Jürgen Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (Revision 19060) +++ src/frontends/controllers/frontend_helpers.cpp (Arbeitskopie) @@ -1108,12 +1108,14 @@ LanguagePair, bool { public: -#if defined(__GNUC__) (!defined(USE_WCHAR_T) || __GNUC__ 4) +#if 1//defined(__GNUC__) (!defined(USE_WCHAR_T) || __GNUC__ 4) bool operator()(LanguagePair const lhs, LanguagePair const rhs) const { return lhs.first rhs.first; } #else +// this is supposed to fix bug 2738, but it is not stable yet +// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 Sorter() : loc_() {}; bool operator()(LanguagePair const lhs, LanguagePair const rhs) const {
Re: Exception when opening Document-settings on Solaris
Jürgen Spitzmüller wrote: Jürgen Spitzmüller wrote: even if this change helps for solaris i fear many crashes on systems with strangely set locales. I even get the crash by - LANG=en_EN lyx - Tools-Preferences For 1.5.0, I propose the attached. +1. By the way, I just had a look at bug 2738... it might be a stupid question but why not just do the language filtering directly in the Document dialog instead of pre-filtering using this local stuff? Abdel.
Re: Exception when opening Document-settings on Solaris
On Thursday 12 July 2007 16:51:55 Jürgen Spitzmüller wrote: For 1.5.0, I propose the attached. Jürgen OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. -- José Abílio
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 05:18:04PM +0100, José Matos wrote: On Thursday 12 July 2007 16:51:55 Jürgen Spitzmüller wrote: For 1.5.0, I propose the attached. Jürgen OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. Please, wait a minute. I have another option. -- Enrico
Re: Exception when opening Document-settings on Solaris
José Matos wrote: OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. Done. I've also reopened the bug report with a comment. Jürgen
Re: Exception when opening Document-settings on Solaris
Enrico Forestieri wrote: Please, wait a minute. I have another option. too late. Jürgen
Re: Exception when opening Document-settings on Solaris
On Thursday 12 July 2007 17:26:54 Enrico Forestieri wrote: I have another option. Tell us more. :-) -- Enrico -- José Abílio
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 06:32:28PM +0200, Jürgen Spitzmüller wrote: Enrico Forestieri wrote: Please, wait a minute. I have another option. too late. No problem. The attached patch should solve the problems related to sorting according to the locale rules. I think that there is no other way. When a locale is not installed, normal ordering through is performed, otherwise the locale rules are obeyed. The crash you were having with LANG=en_EN was probably due to the fact that you don't have that locale installed. If you install it, the crash disappears. This patch accounts for this case, too, i.e., if you don't have a locale, you get normal ordering, but after you install it, you can have that locale ordering. Only the poor systems which don't have support for wchar_t are left in the cold. And before you ask, yes this also accounts for the missing facets in GCC 3. -- Enrico Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (revision 19061) +++ src/frontends/controllers/frontend_helpers.cpp (working copy) @@ -1108,21 +1108,31 @@ class Sorter LanguagePair, bool { public: -#if 1//defined(__GNUC__) (!defined(USE_WCHAR_T) || __GNUC__ 4) +#if !defined(USE_WCHAR_T) defined(__GNUC__) bool operator()(LanguagePair const lhs, LanguagePair const rhs) const { return lhs.first rhs.first; } #else -// this is supposed to fix bug 2738, but it is not stable yet -// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 - Sorter() : loc_() {}; + Sorter() : loc_ok(true) + { + try { + loc_ = std::locale(); + } catch (...) { + loc_ok = false; + } + }; + bool operator()(LanguagePair const lhs, LanguagePair const rhs) const { - return loc_(lhs.first, rhs.first); + if (loc_ok) + return loc_(lhs.first, rhs.first); + else + return lhs.first rhs.first; } private: std::locale loc_; + bool loc_ok; #endif };
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 05:36:03PM +0100, José Matos wrote: On Thursday 12 July 2007 17:26:54 Enrico Forestieri wrote: I have another option. Tell us more. :-) The exception is thrown by the locale constructor, not when the ordering is performed. So, we catch it there and then either use the locale facilities or the normal ordering. See patch in the other post. -- Enrico
Re: Exception when opening Document-settings on Solaris
On Thursday 12 July 2007 18:06:42 Enrico Forestieri wrote: The exception is thrown by the locale constructor, not when the ordering is performed. So, we catch it there and then either use the locale facilities or the normal ordering. See patch in the other post. I saw the patch and I agree with the way it is done. This time though I will be on the safe side (read chicken) and I would suggest to delay this for 1.5.1. OK? -- Enrico -- José Abílio
Re: Exception when opening Document-settings on Solaris
José Matos wrote: I saw the patch and I agree with the way it is done. This time though I will be on the safe side (read chicken) and I would suggest to delay this for 1.5.1. OK? I was about to say the same. The patch looks correct, but the bug is not too crucial to get it in urgently. Jürgen
Re: Exception when opening Document-settings on Solaris
On Thu, Jul 12, 2007 at 07:16:45PM +0200, Jürgen Spitzmüller wrote: José Matos wrote: I saw the patch and I agree with the way it is done. This time though I will be on the safe side (read chicken) and I would suggest to delay this for 1.5.1. OK? I was about to say the same. The patch looks correct, but the bug is not too crucial to get it in urgently. No problem with me. Anyway, I already tested it on three different systems, so I am confident that it works ;-) -- Enrico
Re: Exception when opening Document-settings on Solaris
Enrico Forestieri wrote: No problem with me. Anyway, I already tested it on three different systems, so I am confident that it works ;-) We'll release 1.5.1 soon :-) Jürgen
Re: Exception when opening Document->settings on Solaris
Enrico Forestieri <[EMAIL PROTECTED]> writes: > > > Yes, this is r18988 striking again :( > > I don't think that this is related to the platform but rather to the > compiler version. I think that gcc 3.x is missing some locale facets. > > Jean-Pierre, does the attached patch solve the bug for you? Solved, thanks a lot. -- Jean-Pierre
Re: Exception when opening Document->settings on Solaris
> "Pavel" == Pavel Sanda <[EMAIL PROTECTED]> writes: >> Anyway, after r18988 LyX is not so much forgiving about wrong >> locales. On Linux, try for example: >> >> $ env LC_ALL=foo ./src/lyx-qt4 >> >> and you will get that exception, too. Pavel> Ouch. What if we instead of using multiple #ifs catch the Pavel> exception and decide what kind sorter would be used ? Or maybe revert the locale sorting patch for 1.5.0 and take the time to get it right. JMarc
Re: Exception when opening Document->settings on Solaris
On Wednesday 11 July 2007 20:36:25 Enrico Forestieri wrote: > > Yes, this is r18988 striking again :( > > I don't think that this is related to the platform but rather to the > compiler version. I think that gcc 3.x is missing some locale facets. > > Jean-Pierre, does the attached patch solve the bug for you? > > Anyway, after r18988 LyX is not so much forgiving about wrong locales. > On Linux, try for example: > > $ env LC_ALL=foo ./src/lyx-qt4 > > and you will get that exception, too. Is this "(!defined(USE_WCHAR_T)" still required? As far as I understood you argument this would be enough: #if defined(__GNUC__) && __GNUC__ < 4) Or at least the other way around: #if defined(__GNUC__) && __GNUC__ < 4) || (!defined(USE_WCHAR_T) -- José Abílio
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 10:05:09AM +0100, José Matos wrote: > On Wednesday 11 July 2007 20:36:25 Enrico Forestieri wrote: > > > > Yes, this is r18988 striking again :( > > > > I don't think that this is related to the platform but rather to the > > compiler version. I think that gcc 3.x is missing some locale facets. > > > > Jean-Pierre, does the attached patch solve the bug for you? > > > > Anyway, after r18988 LyX is not so much forgiving about wrong locales. > > On Linux, try for example: > > > > $ env LC_ALL=foo ./src/lyx-qt4 > > > > and you will get that exception, too. > > Is this "(!defined(USE_WCHAR_T)" still required? I think so, see below. > As far as I understood you argument this would be enough: > #if defined(__GNUC__) && __GNUC__ < 4) No, because it doesn't catch systems where sizeof(wchar_t) == 2 and gcc >= 4.0. > Or at least the other way around: > #if defined(__GNUC__) && __GNUC__ < 4) || (!defined(USE_WCHAR_T) This one would also catch MSVC, which AFAIK has no problem with the locale sorting. -- Enrico
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 09:26:55AM +0200, Jean-Marc Lasgouttes wrote: > > "Pavel" == Pavel Sanda <[EMAIL PROTECTED]> writes: > > >> Anyway, after r18988 LyX is not so much forgiving about wrong > >> locales. On Linux, try for example: > >> > >> $ env LC_ALL=foo ./src/lyx-qt4 > >> > >> and you will get that exception, too. > > Pavel> Ouch. What if we instead of using multiple #ifs catch the > Pavel> exception and decide what kind sorter would be used ? > > Or maybe revert the locale sorting patch for 1.5.0 and take the time > to get it right. This one may be the best option. -- Enrico
Re: Exception when opening Document->settings on Solaris
On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: > This one would also catch MSVC, which AFAIK has no problem with > the locale sorting. OK. You can commit the change. > -- > Enrico -- José Abílio
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 10:53:54AM +0100, José Matos wrote: > On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: > > This one would also catch MSVC, which AFAIK has no problem with > > the locale sorting. > > OK. You can commit the change. I did it. -- Enrico
Re: Exception when opening Document->settings on Solaris
> On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: > > This one would also catch MSVC, which AFAIK has no problem with > > the locale sorting. > > OK. You can commit the change. even if this change helps for solaris i fear many crashes on systems with strangely set locales. the changeset should be reverted back until we know how safely detect the error. btw have anybody better solution than handling the exception ? pavel
Re: Exception when opening Document->settings on Solaris
Pavel Sanda wrote: > even if this change helps for solaris i fear many crashes on systems > with strangely set locales. the changeset should be reverted back until > we know how safely detect the error. FWIW, I agree. Jürgen
Re: Exception when opening Document->settings on Solaris
Pavel Sanda wrote: On Thursday 12 July 2007 10:41:25 Enrico Forestieri wrote: This one would also catch MSVC, which AFAIK has no problem with the locale sorting. OK. You can commit the change. even if this change helps for solaris i fear many crashes on systems with strangely set locales. the changeset should be reverted back until we know how safely detect the error. btw have anybody better solution than handling the exception ? What do you mean by handling the exception? Fallback to the non wchar_t solution if an exception is caught? For this to work the choice of using wchar_t or not must be done at run-time; unfortunately the source code is really not ready to do that now (lots of #ifdef). Abdel.
Re: Exception when opening Document->settings on Solaris
> What do you mean by handling the exception? Fallback to the non wchar_t yes > solution if an exception is caught? For this to work the choice of > using wchar_t or not must be done at run-time; unfortunately the source > code is really not ready to do that now (lots of #ifdef). wont be possible to avoid any ifdefs by doing something like : try locale stuff (init+sort); catch any_error: do non_locale stuff ? (i'm not much familiar with exceptions, maybe just talking nonsense.) pavel
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 12:54:39PM +0200, Pavel Sanda wrote: > wont be possible to avoid any ifdefs by doing something like : > > try > locale stuff (init+sort); > catch any_error: do non_locale stuff Note that this is used in a sorting context, so the comparison should be as fast as possible. I don't think that the try/catch game fits the bill here. -- Enrico
Re: Exception when opening Document->settings on Solaris
> Note that this is used in a sorting context, so the comparison > should be as fast as possible. I don't think that the try/catch we are sorting some ~50 items. anyway it can be written that try block is entered only once per one sorting. pavel
Re: Exception when opening Document->settings on Solaris
Pavel Sanda wrote: > even if this change helps for solaris i fear many crashes on systems > with strangely set locales. I even get the crash by - LANG=en_EN lyx - Tools->Preferences Jürgen
Re: Exception when opening Document->settings on Solaris
Jürgen Spitzmüller wrote: > > even if this change helps for solaris i fear many crashes on systems > > with strangely set locales. > > I even get the crash by > - LANG=en_EN lyx > - Tools->Preferences For 1.5.0, I propose the attached. Jürgen Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (Revision 19060) +++ src/frontends/controllers/frontend_helpers.cpp (Arbeitskopie) @@ -1108,12 +1108,14 @@ LanguagePair, bool> { public: -#if defined(__GNUC__) && (!defined(USE_WCHAR_T) || __GNUC__ < 4) +#if 1//defined(__GNUC__) && (!defined(USE_WCHAR_T) || __GNUC__ < 4) bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { return lhs.first < rhs.first; } #else +// this is supposed to fix bug 2738, but it is not stable yet +// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 Sorter() : loc_("") {}; bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const {
Re: Exception when opening Document->settings on Solaris
Jürgen Spitzmüller wrote: Jürgen Spitzmüller wrote: even if this change helps for solaris i fear many crashes on systems with strangely set locales. I even get the crash by - LANG=en_EN lyx - Tools->Preferences For 1.5.0, I propose the attached. +1. By the way, I just had a look at bug 2738... it might be a stupid question but why not just do the language filtering directly in the Document dialog instead of pre-filtering using this local stuff? Abdel.
Re: Exception when opening Document->settings on Solaris
On Thursday 12 July 2007 16:51:55 Jürgen Spitzmüller wrote: > For 1.5.0, I propose the attached. > > Jürgen OK then. Enrico earlier agreed with this and then we will have more time to fix this properly. -- José Abílio
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 05:18:04PM +0100, José Matos wrote: > On Thursday 12 July 2007 16:51:55 Jürgen Spitzmüller wrote: > > For 1.5.0, I propose the attached. > > > > Jürgen > > OK then. Enrico earlier agreed with this and then we will have more time to > fix this properly. Please, wait a minute. I have another option. -- Enrico
Re: Exception when opening Document->settings on Solaris
José Matos wrote: > OK then. Enrico earlier agreed with this and then we will have more time to > fix this properly. Done. I've also reopened the bug report with a comment. Jürgen
Re: Exception when opening Document->settings on Solaris
Enrico Forestieri wrote: > Please, wait a minute. I have another option. too late. Jürgen
Re: Exception when opening Document->settings on Solaris
On Thursday 12 July 2007 17:26:54 Enrico Forestieri wrote: > I have another option. Tell us more. :-) > -- > Enrico -- José Abílio
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 06:32:28PM +0200, Jürgen Spitzmüller wrote: > Enrico Forestieri wrote: > > Please, wait a minute. I have another option. > > too late. No problem. The attached patch should solve the problems related to sorting according to the locale rules. I think that there is no other way. When a locale is not installed, normal ordering through "<" is performed, otherwise the locale rules are obeyed. The crash you were having with LANG=en_EN was probably due to the fact that you don't have that locale installed. If you install it, the crash disappears. This patch accounts for this case, too, i.e., if you don't have a locale, you get normal ordering, but after you install it, you can have that locale ordering. Only the poor systems which don't have support for wchar_t are left in the cold. And before you ask, yes this also accounts for the missing facets in GCC 3. -- Enrico Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (revision 19061) +++ src/frontends/controllers/frontend_helpers.cpp (working copy) @@ -1108,21 +1108,31 @@ class Sorter LanguagePair, bool> { public: -#if 1//defined(__GNUC__) && (!defined(USE_WCHAR_T) || __GNUC__ < 4) +#if !defined(USE_WCHAR_T) && defined(__GNUC__) bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { return lhs.first < rhs.first; } #else -// this is supposed to fix bug 2738, but it is not stable yet -// see http://bugzilla.lyx.org/show_bug.cgi?id=2738 - Sorter() : loc_("") {}; + Sorter() : loc_ok(true) + { + try { + loc_ = std::locale(""); + } catch (...) { + loc_ok = false; + } + }; + bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { - return loc_(lhs.first, rhs.first); + if (loc_ok) + return loc_(lhs.first, rhs.first); + else + return lhs.first < rhs.first; } private: std::locale loc_; + bool loc_ok; #endif };
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 05:36:03PM +0100, José Matos wrote: > On Thursday 12 July 2007 17:26:54 Enrico Forestieri wrote: > > I have another option. > > Tell us more. :-) The exception is thrown by the locale constructor, not when the ordering is performed. So, we catch it there and then either use the locale facilities or the normal ordering. See patch in the other post. -- Enrico
Re: Exception when opening Document->settings on Solaris
On Thursday 12 July 2007 18:06:42 Enrico Forestieri wrote: > The exception is thrown by the locale constructor, not when the > ordering is performed. So, we catch it there and then either > use the locale facilities or the normal ordering. See patch > in the other post. I saw the patch and I agree with the way it is done. This time though I will be on the safe side (read chicken) and I would suggest to delay this for 1.5.1. OK? > -- > Enrico -- José Abílio
Re: Exception when opening Document->settings on Solaris
José Matos wrote: > I saw the patch and I agree with the way it is done. This time though I > will be on the safe side (read chicken) and I would suggest to delay this > for 1.5.1. OK? I was about to say the same. The patch looks correct, but the bug is not too crucial to get it in urgently. Jürgen
Re: Exception when opening Document->settings on Solaris
On Thu, Jul 12, 2007 at 07:16:45PM +0200, Jürgen Spitzmüller wrote: > José Matos wrote: > > I saw the patch and I agree with the way it is done. This time though I > > will be on the safe side (read chicken) and I would suggest to delay this > > for 1.5.1. OK? > > I was about to say the same. The patch looks correct, but the bug is not too > crucial to get it in urgently. No problem with me. Anyway, I already tested it on three different systems, so I am confident that it works ;-) -- Enrico
Re: Exception when opening Document->settings on Solaris
Enrico Forestieri wrote: > No problem with me. Anyway, I already tested it on three different > systems, so I am confident that it works ;-) We'll release 1.5.1 soon :-) Jürgen
Re: Exception when opening Document-settings on Solaris
Jean-Pierre Chrétien wrote: Hello, All is OK with 1.5.0rc2, but with 1.5.0-svn, when I want to edit the settings of a template document on Solaris 2.8/Qt4.3.1, I get this: Caught normal exception: locale::facet::_S_create_c_locale name not valid Program received signal SIGABRT, Aborted. 0xfdf592f0 in __sigprocmask () from /usr/lib/libthread.so.1 (gdb) bt #0 0xfdf592f0 in __sigprocmask () from /usr/lib/libthread.so.1 #1 0xfdf4e59c in _resetsig () from /usr/lib/libthread.so.1 #2 0xfdf4dd3c in _sigon () from /usr/lib/libthread.so.1 #3 0xfdf50d98 in _thrp_kill () from /usr/lib/libthread.so.1 This backtrace seems minimal, should I recompile with --enable-debug ? Yes, and possibly --enable-stdlib-debug if that is not already set by default. Abdel.
Re: Exception when opening Document-settings on Solaris
All is OK with 1.5.0rc2, but with 1.5.0-svn, when I want to edit the settings of a template document on Solaris 2.8/Qt4.3.1, I get this: Caught normal exception: locale::facet::_S_create_c_locale name not valid could not be this somehow related to http://bugzilla.lyx.org/show_bug.cgi?id=2738 (ie does it happen before 18988 changeset) ? pavel
Re: Exception when opening Document-settings on Solaris
Abdelrazak Younes [EMAIL PROTECTED] writes: This backtrace seems minimal, should I recompile with --enable-debug ? Yes, and possibly --enable-stdlib-debug if that is not already set by default. Same result -- Jean-Pierre
Re: Exception when opening Document-settings on Solaris
On Wed, Jul 11, 2007 at 03:59:51PM +0200, Pavel Sanda wrote: All is OK with 1.5.0rc2, but with 1.5.0-svn, when I want to edit the settings of a template document on Solaris 2.8/Qt4.3.1, I get this: Caught normal exception: locale::facet::_S_create_c_locale name not valid could not be this somehow related to http://bugzilla.lyx.org/show_bug.cgi?id=2738 (ie does it happen before 18988 changeset) ? Yes, this is r18988 striking again :( I don't think that this is related to the platform but rather to the compiler version. I think that gcc 3.x is missing some locale facets. Jean-Pierre, does the attached patch solve the bug for you? Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. -- Enrico Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (revision 19044) +++ src/frontends/controllers/frontend_helpers.cpp (working copy) @@ -1108,7 +1108,7 @@ LanguagePair, bool { public: -#if !defined(USE_WCHAR_T) defined(__GNUC__) +#if defined(__GNUC__) (!defined(USE_WCHAR_T) || __GNUC__ 4) bool operator()(LanguagePair const lhs, LanguagePair const rhs) const { return lhs.first rhs.first;
Re: Exception when opening Document-settings on Solaris
Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. Ouch. What if we instead of using multiple #ifs catch the exception and decide what kind sorter would be used ? pavel
Re: Exception when opening Document->settings on Solaris
Jean-Pierre Chrétien wrote: Hello, All is OK with 1.5.0rc2, but with 1.5.0-svn, when I want to edit the settings of a template document on Solaris 2.8/Qt4.3.1, I get this: Caught "normal" exception: locale::facet::_S_create_c_locale name not valid Program received signal SIGABRT, Aborted. 0xfdf592f0 in __sigprocmask () from /usr/lib/libthread.so.1 (gdb) bt #0 0xfdf592f0 in __sigprocmask () from /usr/lib/libthread.so.1 #1 0xfdf4e59c in _resetsig () from /usr/lib/libthread.so.1 #2 0xfdf4dd3c in _sigon () from /usr/lib/libthread.so.1 #3 0xfdf50d98 in _thrp_kill () from /usr/lib/libthread.so.1 This backtrace seems minimal, should I recompile with --enable-debug ? Yes, and possibly --enable-stdlib-debug if that is not already set by default. Abdel.
Re: Exception when opening Document->settings on Solaris
> All is OK with 1.5.0rc2, but with 1.5.0-svn, > when I want to edit the settings of a template document > on Solaris 2.8/Qt4.3.1, I get this: > > Caught "normal" exception: locale::facet::_S_create_c_locale name not valid could not be this somehow related to http://bugzilla.lyx.org/show_bug.cgi?id=2738 (ie does it happen before 18988 changeset) ? pavel
Re: Exception when opening Document->settings on Solaris
Abdelrazak Younes <[EMAIL PROTECTED]> writes: > > > > This backtrace seems minimal, should I recompile with --enable-debug ? > > Yes, and possibly --enable-stdlib-debug if that is not already set by > default. Same result -- Jean-Pierre
Re: Exception when opening Document->settings on Solaris
On Wed, Jul 11, 2007 at 03:59:51PM +0200, Pavel Sanda wrote: > > All is OK with 1.5.0rc2, but with 1.5.0-svn, > > when I want to edit the settings of a template document > > on Solaris 2.8/Qt4.3.1, I get this: > > > > Caught "normal" exception: locale::facet::_S_create_c_locale name not valid > > could not be this somehow related to > http://bugzilla.lyx.org/show_bug.cgi?id=2738 > (ie does it happen before 18988 changeset) ? Yes, this is r18988 striking again :( I don't think that this is related to the platform but rather to the compiler version. I think that gcc 3.x is missing some locale facets. Jean-Pierre, does the attached patch solve the bug for you? Anyway, after r18988 LyX is not so much forgiving about wrong locales. On Linux, try for example: $ env LC_ALL=foo ./src/lyx-qt4 and you will get that exception, too. -- Enrico Index: src/frontends/controllers/frontend_helpers.cpp === --- src/frontends/controllers/frontend_helpers.cpp (revision 19044) +++ src/frontends/controllers/frontend_helpers.cpp (working copy) @@ -1108,7 +1108,7 @@ LanguagePair, bool> { public: -#if !defined(USE_WCHAR_T) && defined(__GNUC__) +#if defined(__GNUC__) && (!defined(USE_WCHAR_T) || __GNUC__ < 4) bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { return lhs.first < rhs.first;
Re: Exception when opening Document->settings on Solaris
> Anyway, after r18988 LyX is not so much forgiving about wrong locales. > On Linux, try for example: > > $ env LC_ALL=foo ./src/lyx-qt4 > > and you will get that exception, too. Ouch. What if we instead of using multiple #ifs catch the exception and decide what kind sorter would be used ? pavel