On Sun, Aug 06, 2017 at 10:17:16AM +0200, Kornel Benko wrote: > This should not happen. The check for the need of reconfiguration is done at > LyX.cpp:1053 > bool LyX::queryUserLyXDir(bool explicit_userdir) > which is called at LyX.cpp:921. > This call is guarded with fileLock(lock_file.c_str()); > And the reconfiguration is done in the same guard. > { > string const lock_file = package().getConfigureLockName(); > int fd = fileLock(lock_file.c_str()); > > if (queryUserLyXDir(package().explicit_user_support())) { > package().reconfigureUserLyXDir(""); > // Now the user directory is present on first start. > initTemplatePath(); > } > fileUnlock(fd, lock_file.c_str()); > }
Thanks for that clue. Attached is a patch that I used for debugging to figure out what is calling configure.py. Running the parallel ctests (with many jobs) with the patch applied, gave the following files on my desktop: callingconfig_47059 configurepy_46743_ppid46728 configurepy_47073_ppid47059 Already we can see that the LyX binary calls configure.py once (assuming that the LyX binary can only call it from that function), and that configure.py was called twice. $ cat configurepy_46743_ppid46728 command_ is /usr/bin/python3 -tt /home/scott/lyxbuilds/master/repo/lib/scripts/../configure.py --binary-dir=/home/scott/lyxbuilds/master/CMakeBuild/bin/ pcommand_ is /usr/bin/cmake -DLYX_TESTS_USERDIR=/home/scott/lyxbuilds/master/CMakeBuild/Testing/.lyx -DLYX_USERDIR_VER=LYX_USERDIR_23x -DLYX_PYTHON_EXECUTABLE=/usr/bin/python3 -DPY_SCRIPT=/home/scott/lyxbuilds/master/repo/src/tex2lyx/test/runtests.py -DTEX2LYX_EXE=/home/scott/lyxbuilds/master/CMakeBuild/bin/tex2lyx -DSCRIPT_DIR=/home/scott/lyxbuilds/master/repo/lib/scripts -DWORKDIR=/home/scott/lyxbuilds/master/CMakeBuild/src/tex2lyx/test -DTESTFILE=test.ltx -P /home/scott/lyxbuilds/master/repo/src/tex2lyx/test/runtests.cmake $ cat configurepy_47073_ppid47059 command_ is python -tt /home/scott/lyxbuilds/master/repo/lib/configure.py --binary-dir=/home/scott/lyxbuilds/master/CMakeBuild/bin/ pcommand_ is /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx -batch -userdir /home/scott/lyxbuilds/master/CMakeBuild/Testing/.lyx /home/scott/lyxbuilds/master/repo/autotests/export/MissingEndLayoutBetweenTables.lyx I'm not sure how to proceed to make _configure_needed more robust inside runtests.cmake. Is an alternative to make configure.py thread safe (is this a correct use of the term?) itself by having a lock inside of it? Scott
diff --git a/lib/configure.py b/lib/configure.py index 8e7fedb..ffbbb82 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -25,6 +25,16 @@ console.setFormatter(formatter) logger = logging.getLogger('LyX') logger.addHandler(console) +pid_ = os.getpid() +ppid_ = os.getppid() +file = open("/home/scott/Desktop/configurepy_" + str(pid_) + "_ppid" + + str(ppid_),"w") +command_ = os.popen("ps -p " + str(pid_) + " -o cmd h").read() +pcommand_ = os.popen("ps -p " + str(ppid_) + " -o cmd h").read() +file.write("command_ is " + command_) +file.write("pcommand_ is " + pcommand_) +file.close() + def writeToFile(filename, lines, append = False): " utility function: write or append lines to filename " if append: diff --git a/src/LyX.cpp b/src/LyX.cpp index 4e97f7a..612dd62 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -76,6 +76,8 @@ #include <qglobal.h> // For QT_VERSION +#include <fstream> + using namespace std; using namespace lyx::support; @@ -919,6 +921,11 @@ bool LyX::init() int fd = fileLock(lock_file.c_str()); if (queryUserLyXDir(package().explicit_user_support())) { + ofstream myfile; + string myfname = "/home/scott/Desktop/callingconfig_"; + myfname = myfname.append(to_string(getpid())); + myfile.open (myfname); + myfile.close(); package().reconfigureUserLyXDir(""); // Now the user directory is present on first start. initTemplatePath();
signature.asc
Description: PGP signature