[RFC][PATCH] Change to GuiView::goToFileRow

Stephan Witt st.witt at gmx.net
Sat Feb 15 13:41:19 UTC 2020

Am 15.02.2020 um 13:12 schrieb Enrico Forestieri <forenr at lyx.org>:
> On Fri, Feb 14, 2020 at 10:10:06PM +0100, Stephan Witt wrote:
>> Am 14.02.2020 um 21:00 schrieb Stephan Witt <st.witt at gmx.net>:
>>> Hi all,
>>> I’ve a problem in LyX master with reverse search I don’t have in 2.3.x.
>>> Unfortunately I cannot see the difference in LyX code causing it.
>>> The situation is: on Mac the directory /var is an symlink to private/var.
>>> So the temporary files are with real path below /private/var/. The SyncTex
>>> file contains this path name, e.g.
>>> Input:1:/private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.pfyyHSvCxUfX/lyx_tmpbuf0/./Tutorial.tex
>>> But the reverse search script is called with file name:
>>> /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.pfyyHSvCxUfX/lyx_tmpbuf0/Tutorial.tex
>>> Some normalization happens here. I’ve changed the lyxeditor script to see the call. It’s not
>>> the operation in line 85 (were sed is used to remove /private from path name).
>>> To make the GuiView::goToFileRow() implementation more robust I came to the attached patch.
>>> I’m confident it cannot hurt. But as I don’t understand the situation completely I ask for comments.
>> I think I got it myself. The difference is the Qt5 implementation of QDir::tempPath() probably.
>> I’ve armed the sources with debug output and with Qt-5.9.8 I get this:
>> frontends/qt4/GuiView.cpp (3505): goToFileRow: row 628 in file /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.akFIHtU22126/lyx_tmpbuf0/Tutorial.tex
>> frontends/qt4/GuiView.cpp (3506): goToFileRow: abstmp /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.akFIHtU22126
>> frontends/qt4/GuiView.cpp (3507): goToFileRow: realtmp /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.akFIHtU22126
>> So the correction in LyX goToFileRow implementation is triggered. But with Qt-5.12.6 this has changed.
>> What’s your opinion how to solve that?
> I may be dense, but I still fail to see the problem here and thus why your
> patch corrects it.

I don’t like the patch anymore either. Much to complex, IMO.

The problem is as follows:

The buffer lookup uses package().temp_dir().absFileName() as temporary directory base name.
This name isn’t the real path of it for Qt-5.9.8 and with Qt-5.12.6 it’s the real path name.

One example for the result of package().temp_dir().absFileName() is:

Qt-5.9.8 has /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.akFIHtU22126
Qt-5.12.6 has /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.akFIHtU22126

The path name externally given may be the real path or not. In my case it’s not (Skim output).
With this scenario the lookup is done with the non real path but the buffer uses the real path
and the lookup fails because of that.

I came up with another path. IMHO easier to understand. 
And it works with all variants of Qt and input.

A more generic fix would be to change the buffer lookup to use real path all the time internally.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: goToFileRow-2.patch
Type: application/octet-stream
Size: 2417 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200215/a1df822d/attachment.obj>

More information about the lyx-devel mailing list