Bug 393224

Summary: Kbibtex does not automatically detect lyx pipe created by Kile
Product: [Applications] KBibTeX Reporter: Kishore Gopalakrishnan <kishore96>
Component: GeneralAssignee: Thomas Fischer <fischer>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 0.7   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 0.8
Sentry Crash Report:

Description Kishore Gopalakrishnan 2018-04-17 13:39:30 UTC
Kile (I'm using version 2.9.91 of Kile) creates its lyx pipe in /tmp. Kbibtex does not seem to be able to detect it automatically (the 'send to LyX/Kile' feature does not work). However, if I manually specify the location of the pipe in 'settings > configure kbibtex > saving and exporting > Manually specified LyX pipe', I am able to use the aforementioned feature properly. Kbibtex should also search in /tmp for a Lyx pipe.
Comment 1 Thomas Fischer 2018-04-18 18:54:40 UTC
I am suprised that you encounter this problem. I make a fresh installation of Kile 2.9.91. It created its Lyx pipes in /tmp using a random name, but it created symbolics to these pipes from the two traditional locations which KBibTeX check by default:

# ls -l /home/testuser/.lyxpipe.in
lrwxrwxrwx 1 testuser testuser 27 18 apr 20.23 /home/testuser/.lyxpipe.in -> /tmp/kile-dhJsCe.lyxpipe.in
# ls -l ll /home/testuser/.lyx/lyxpipe.in
lrwxrwxrwx 1 testuser testuser 31 18 apr 20.23 /home/testuser/.lyx/lyxpipe.in -> /tmp/kile-dhJsCe.lyx/lyxpipe.in

The problem is that KBibTeX does not follow those symbolic links to the actual pipe, i.e. it technically correctly detects the symbolic links as symbolic links but not as pipes.

I'll prepare a patch to fix this problem.
Comment 2 Thomas Fischer 2018-04-18 18:58:47 UTC
A minor update to my previous comment, it contained an earlier draft of my comment. Please ignore the initial "I am suprised that you encounter this problem.".
Comment 3 Thomas Fischer 2018-04-18 19:20:11 UTC
Git commit 23ce89b6b09b7264231038506231c6b1d35d69d1 by Thomas Fischer.
Committed on 18/04/2018 at 19:19.
Pushed by thomasfischer into branch 'kbibtex/0.8'.

Resolving symbolic links to LyX pipe

Newer Kile versions (at least 2.9.91) create the LyX pipe files in /tmp
(on Linux systems, at least) and then place symbolic links to those pipes
in the user's home directory both as ~/.lyxpipe.in and ~/.lyx/lyxpipe.in
(for the 'in' pipe).

Before this patch, KBibTeX would detect those symbolic links and discard
them as not being named pipes instead of resolving them to get the real
named pipe.
As introduced in this patch, symbolic links are resolved using
QFileInfo::canonicalFilePath().

As another change introduced in this patch, the previous code
duplication when checking both in ~/ and ~/.lyx for a LyX pipe has been
addressed.
FIXED-IN: 0.8

M  +8    -27   src/processing/lyx.cpp

https://commits.kde.org/kbibtex/23ce89b6b09b7264231038506231c6b1d35d69d1
Comment 4 Thomas Fischer 2018-04-18 19:20:52 UTC
Git commit 6d1b52bac177032fb401cb4fa1574e5e4161f91b by Thomas Fischer.
Committed on 18/04/2018 at 19:20.
Pushed by thomasfischer into branch 'master'.

Resolving symbolic links to LyX pipe

Newer Kile versions (at least 2.9.91) create the LyX pipe files in /tmp
(on Linux systems, at least) and then place symbolic links to those pipes
in the user's home directory both as ~/.lyxpipe.in and ~/.lyx/lyxpipe.in
(for the 'in' pipe).

Before this patch, KBibTeX would detect those symbolic links and discard
them as not being named pipes instead of resolving them to get the real
named pipe.
As introduced in this patch, symbolic links are resolved using
QFileInfo::canonicalFilePath().

As another change introduced in this patch, the previous code
duplication when checking both in ~/ and ~/.lyx for a LyX pipe has been
addressed.

M  +8    -27   src/processing/lyx.cpp

https://commits.kde.org/kbibtex/6d1b52bac177032fb401cb4fa1574e5e4161f91b