Bug 113822 - kbabel crashes at startup if I select many marked files
Summary: kbabel crashes at startup if I select many marked files
Alias: None
Product: kbabel
Classification: Miscellaneous
Component: general (show other bugs)
Version: 1.10.2
Platform: Gentoo Packages Linux
: HI crash
Target Milestone: ---
Assignee: Stanislav Visnovsky
Depends on:
Reported: 2005-10-04 07:38 UTC by manolis
Modified: 2006-11-06 17:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

kbabelrc file during the crash (5.87 KB, application/octet-stream)
2005-11-07 13:10 UTC, manolis
kbabel.defaultproject which crashes KBabel (4.90 KB, text/plain)
2006-07-23 12:11 UTC, Krzysztof Lichota
add "application/octet-stream" as valid project MIME type (619 bytes, patch)
2006-11-05 19:20 UTC, Stephan Johach

Note You need to log in before you can comment on or make changes to this bug.
Description manolis 2005-10-04 07:38:45 UTC
Version:           1.10.2 (using KDE KDE 3.4.2)
Installed from:    Gentoo Packages

I use kbabel katalog manager for my kde trunk translation.
If I mark many files and then exit the catalog manager. I then try to start kbabel editor or catalog manager I get the error:

Could'n load the default project:

Ofocourse the file exists in the folder. If I edit it manually and remove the line with markings, the catalog manager & editor work fine again, without complaining.
I can reproduce the problem in my system with the below markings line in kbabel.defaultproject:


(Maybe it is some limitation with the size of the loading variable...)
Comment 1 Nicolas Goutte 2005-10-05 14:46:39 UTC
Is it really a crash or do you only get a dialog box witht the error message?
Comment 2 manolis 2005-10-05 19:44:54 UTC
It is a crash. 
It pops up the message. Ofcouse kbabel (editor or catalog mngr) does not load.
And then I get a backtrace dialog for kbabel application crash.
Comment 3 Nicolas Goutte 2005-10-06 21:16:55 UTC
I have looked at the code. I do not understand why it would crash (but I do not understand either why the other bugs about settings are crashing too).

(I have not tried yet to reproduce it.)

Have a nice day!
Comment 4 manolis 2005-10-09 23:59:07 UTC
Nicolas can you please give me some information on which files should I look for the bug in websvn? You know the code, and I don't have much time to browse all the code.
Maybe I could help.
Comment 5 Nicolas Goutte 2005-10-20 09:55:28 UTC
To comment #4:
the catalog manager uses the functions CatalogManagerView::readMarker and CatalogManagerView::saveMarker (kdesdk/kbabel/catalogmanagerview.cpp) to set the markers in the (project) configure file.

However those functions are very short. The main work is done by the KConfig classes in kdelibs by the corresponding functions handling QStringList in kdelibs/kdecore/kconfigbase.cpp .)

That is as far as I have gone with this bug. As there are other bugs for KBabel that seems to be relate to config files somehow, I do not think that it is necessarily a problem of this code.

(As for me knowing KBabel's code, sorry, I do not know it that much.)

Have a nice day!

PS.: to comment #3: I have tried to reproduce it and I could not reproduce it.
Comment 6 Stanislav Visnovsky 2005-11-07 12:19:58 UTC
Could you attach the kbabelrc file that crashes kbabel?
Comment 7 manolis 2005-11-07 13:10:40 UTC
Created attachment 13320 [details]
kbabelrc file during the crash

Notice though as I say in my first post, that the file that causes the crash is
the kbabelrc.defaultproject and not kbabelrc. In fact If I remove the line
or If I shorten it a bit the crash disappears.
The Marker= that Crashes:

the Marker= line that does not crash:

or Marker=
Comment 8 manolis 2005-12-21 10:17:41 UTC
Is still this bug unconfirmed ? Hasn't anyone confirmed yet, or am I the only one...

Same happens with kde 3.5.0 
Comment 9 Nicolas Goutte 2005-12-21 14:06:31 UTC
On Wednesday 21 December 2005 10:17, manolis wrote:
> Is still this bug unconfirmed ? Hasn't anyone
> confirmed yet, or am I the only one...

From what I know it is still not reproduced, even less by a developer.

> Same happens with kde 3.5.0

That is rather bad. :-(

Have a nice day!
Comment 10 Krzysztof Lichota 2006-07-23 12:08:19 UTC
Happens still in KDE 3.5.3.
However, it is not in kbabelrc, but in .kde/share/config/kbabel.defaultproject
Removing files from line with "Marker=" fixes the problem.

Steps to reproduce:
1. Run catalog manager.
2. Mark many files (I guess 30 is enough, maybe 40).
3. Close Manager and Kbabel.
4. Start KBabel -> message box stating something like "Cannot read kbabel.default project". After clicking OK it crashes.

(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1233945728 (LWP 15623)]
[KCrash handler]
#6  0xb7d7974f in KBabel::Project::identitySettings ()
   from /usr/lib/libkbabelcommon.so.3
#7  0xb7d4eb96 in KBabel::Catalog::identitySettings ()
   from /usr/lib/libkbabelcommon.so.3
#8  0xb7d53b0a in KBabel::Catalog::getNumberOfPluralForms ()
   from /usr/lib/libkbabelcommon.so.3
#9  0xb7d56dbb in KBabel::Catalog::readPreferences ()
   from /usr/lib/libkbabelcommon.so.3
#10 0xb7d6293a in KBabel::Catalog::Catalog ()
   from /usr/lib/libkbabelcommon.so.3
#11 0x0807f74b in KBabelSplash::staticMetaObject ()
#12 0x080cba0a in KBabelSplash::staticMetaObject ()
#13 0x08071a93 in ?? ()
#14 0x0825ca28 in ?? ()
#15 0xbfe2e3a4 in ?? ()
#16 0x08123b77 in typeinfo name for QDict<QWidget> ()
#17 0xbfe2e394 in ?? ()
#18 0x0813f330 in ?? ()
#19 0x082348e0 in ?? ()
#20 0x017c2a64 in ?? ()
#21 0xb7414148 in vtable for QTimer () from /usr/lib/libqt-mt.so.3
#22 0xbfe2e324 in ?? ()
#23 0x00000000 in ?? ()
Comment 11 Krzysztof Lichota 2006-07-23 12:11:34 UTC
Created attachment 17095 [details]
kbabel.defaultproject which crashes KBabel

Default project setting which crash KBabel.
Save as $HOME/.kde/share/config/kbabel.defaultproject to test.
Comment 12 Stephan Johach 2006-11-05 19:17:27 UTC
I can reproduce the crash here. The reason it crashes is the broken error handling of "invalid" project files.

The reason the project is suspected as invalid is, the Project::Project constructor has a call to KMimeType::findByURL() and checks for 

"text/plain" but the type is "application/octet-stream". The project object
then is invalid and no initialized correctly but later on use. That leads
to the crash.

Using the command "file" on a console leads to:

hunsum@leviathan:~/.kde/share/config$ file kbabel.defaultproject
kbabel.defaultproject: UTF-8 Unicode text, with very long lines
hunsum@leviathan:~/.kde/share/config$ cd
hunsum@leviathan:~$ file kde-de
kde-de: UTF-8 Unicode text

So the reason for the "application/octet-stream" is the very long line it seems. But that should not crash kbabel.

I have a patch here to load the project file even with the long line.
Comment 13 Stephan Johach 2006-11-05 19:20:50 UTC
Created attachment 18421 [details]
add "application/octet-stream" as valid project MIME type

Please try this out. I will commit at least in trunk if it works for you.
Comment 14 Stephan Johach 2006-11-06 17:34:07 UTC
SVN commit 602716 by johach:

Fixed loading of project files with very long lines.
They are detected als "application/octet-stream".

 M  +5 -0      kbproject.cpp  

--- branches/KDE/3.5/kdesdk/kbabel/common/kbproject.cpp #602715:602716
@@ -76,6 +76,11 @@
             // Empty files are allowed too
             kdWarning() << "Empty KBabel project file!" << endl;
+	else if ( mime->name() == "application/octet-stream" )
+        {
+	    // this can happen if the file has some very long lines
+	    kdWarning() << "KBabel project file detected as octet-stream! Perhaps there are very long lines in it!" << endl;
+        }
             // Unknown mime type, abort!