Bug 420161 - Lokalize opens source file in endless instances of external editor
Summary: Lokalize opens source file in endless instances of external editor
Status: RESOLVED FIXED
Alias: None
Product: lokalize
Classification: Applications
Component: general (show other bugs)
Version: 19.12
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Simon Depiets
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-16 14:21 UTC by Valdas
Modified: 2020-05-06 06:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Console output: Lokalize start, open project, click on source link, kill Lokalize (70.77 KB, text/plain)
2020-04-16 14:21 UTC, Valdas
Details
Settings -> General (48.52 KB, image/png)
2020-04-17 07:35 UTC, Valdas
Details
Failed build log (make) (2.84 KB, text/plain)
2020-04-26 12:54 UTC, Valdas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Valdas 2020-04-16 14:21:36 UTC
Created attachment 127593 [details]
Console output: Lokalize start, open project, click on source link, kill Lokalize

STEPS TO REPRODUCE
1. Download source code wich contains translation files (for example maser branch of Inkscape);
2. Open project and click on entry in "Translation Units" window;
3. In window "Unit metadata" section "File:" click on link to source code; for example I got link "../src/live_effects/effect.cpp:275";
4. Dialog "Source file lookup" appears; click "Locally" and select correct folder (link to source file must be valid);

After that:
- usage of all CPU core jumps to 100%,
- memory usage grows until it reaches ~100%,
- constantly appearing instances of text editor (in my case: Kate; in count 239 after killing Lokalize); all editors contains same file;
- Lokalize became unresponsive;
- process newer ends until I kill Lokalize.

EXPECTED RESULT

Lokalize must open link in only one external editor.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 19.10
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.67.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION

Attached console output.
Comment 1 Simon Depiets 2020-04-17 05:03:56 UTC
Hello,
What are your external editor settings in lokalize ?

It's in Settings/General/Use a custom editor to open source files
Comment 2 Valdas 2020-04-17 07:35:49 UTC
Created attachment 127600 [details]
Settings -> General
Comment 3 Valdas 2020-04-17 07:36:06 UTC
Setting "Use a custom editor to open source files" is unchecked. Attaching screenshot.
Comment 4 Simon Depiets 2020-04-26 07:31:18 UTC
Confirmed with that po file from inkscape, I'll work on a fix

Quite impressive spam :)
Comment 5 Valdas 2020-04-26 09:00:47 UTC
 Recently I found:
 - if option "Use custom editor" is unchecked then during that "spam" I can switch desktops, use a process manager to kill Lokalize;
 - if that option is checked (field contains a string "kate %1:%2") then during "spam" system becomes unresponsive (can't switch desktops, etc.), I can only move mouse and press "Power" button to shutdown PC.
Comment 6 Simon Depiets 2020-04-26 10:48:32 UTC
What folder did you select for the sources ? The one containing the po files?
Comment 7 Simon Depiets 2020-04-26 11:16:23 UTC
Git commit 4812b6a3019ee7c49e52b5c4ad0fecc889f865ba by Simon Depiets.
Committed on 26/04/2020 at 11:09.
Pushed by sdepiets into branch 'master'.

Prevent infinite loop on empty src folder

There was an issue when the source folder didn't contain any source files, in that case the list of source files/directories remained empty and the folder was subsequently rescanned, creating an infinite loop.

M  +4    -1    src/project/project.cpp
M  +2    -0    src/project/project.h

https://commits.kde.org/lokalize/4812b6a3019ee7c49e52b5c4ad0fecc889f865ba
Comment 8 Valdas 2020-04-26 11:57:35 UTC
(In reply to Simon Depiets from comment #6)
> What folder did you select for the sources ? The one containing the po files?

Folder containing the PO files.
Comment 9 Simon Depiets 2020-04-26 12:12:19 UTC
I had an infinite loop there because that folder doesn't contain any source file, thus paths with ../ work only through direct resolution, but the indexation of the folder had an infinite loop.
Could you build lokalize from master and give it a try?
Comment 10 Valdas 2020-04-26 12:53:30 UTC
(In reply to Simon Depiets from comment #9)
> Could you build lokalize from master and give it a try?

I followed instructions from https://userbase.kde.org/Lokalize. Also I installed packages about which CMake complained.
 But I had no success to build Lokalize (make log attached). Wrong versions of installed libraries.
Comment 11 Valdas 2020-04-26 12:54:35 UTC
Created attachment 127893 [details]
Failed build log (make)
Comment 12 Valdas 2020-04-26 12:55:59 UTC
I meant: wrong version of libraries?
Comment 13 Simon Depiets 2020-04-26 13:09:29 UTC
I just changed that because it's deprecated in the latest Qt, it should build if you "git revert 1bf326b"
Comment 14 Valdas 2020-04-26 13:53:05 UTC
(In reply to Simon Depiets from comment #13)
> I just changed that because it's deprecated in the latest Qt, it should
> build if you "git revert 1bf326b"
 I executed "git checkout 1bf326b" instead of "git revert..." (complains about registering, e-mail, and then every time prints "fatal: revert failed"), then applied a patch (I followed a link in comment #7) and compiled Lokalize.
 Now file in a link is opened in external editor and no more "spam". But I can do it only once, second click on a link has no effect.
Comment 15 Simon Depiets 2020-04-26 14:30:05 UTC
What are the source files/messages you're trying to open? I noticed some files are missing from inkscape sources (until I build I guess)
Comment 16 Valdas 2020-04-26 15:13:24 UTC
(In reply to Simon Depiets from comment #15)
> What are the source files/messages you're trying to open? I noticed some
> files are missing from inkscape sources (until I build I guess)
 I am working on file "./po/lt.po"; there in first entry "Smart Jelly" is a link "../share/filters/filters.svg.h:2". If click that link then file opens in Kate. And after that this and other links no longer works (no reaction from Lokalize).
 I also found that some files are missing, maybe they are in "build" subfolder (I  had build a Inkscape but didn't check if they are there).
 To get sources I used command "git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git" as written in "https://inkscape.org/develop/getting-started/".
Comment 17 Simon Depiets 2020-05-06 06:44:18 UTC
I can't reproduce the files not opening, if you didn't check custom editor, then files will be opened according to the defined file association (for instance xml are opened in chrome on my computer).
Comment 18 Simon Depiets 2020-05-06 06:51:17 UTC
Git commit 754114c4da162f3660d4a241830b3492442b3eaa by Simon Depiets.
Committed on 06/05/2020 at 06:50.
Pushed by sdepiets into branch 'release/20.04'.

Prevent infinite loop on empty src folder

There was an issue when the source folder didn't contain any source files, in that case the list of source files/directories remained empty and the folder was subsequently rescanned, creating an infinite loop.

M  +4    -1    src/project/project.cpp
M  +2    -0    src/project/project.h

https://commits.kde.org/lokalize/754114c4da162f3660d4a241830b3492442b3eaa