(In reply to Richard Elkins from comment #9) > The source code indicates that soffice.bin is the one starting a background > process that does not finish before soffice.bin exits. > > See: > https://github.com/LibreOffice/core/blob/master/shell/source/unix/exec/ > shellexec.cxx > Go to line 218: > > OString cmd = > #ifdef LINUX > // avoid blocking (call it in background) > "( " + aBuffer.makeStringAndClear() + " ) &"; > #else > aBuffer.makeStringAndClear(); > #endif > FILE *pLaunch = popen(cmd.getStr(), "w"); > if ( pLaunch != nullptr ) > { > if ( 0 == pclose( pLaunch ) ) > return; > > It would be interesting to understand why execution is in background *only* > for Linux. In my opinion, it is undesirable for command line execution in > any O/S. > > Other opinions? It is possible for me to be perfectly content with the > artificial `sleep N` in my shell script.
it was added in https://cgit.freedesktop.org/libreoffice/core/commit/?id=f5fe1aa1 to fix bug 32427 @Richard, can you confirm removing the mentioned ifdef condition would fix the issue? In that case we could submit a patch removing it. Most likely bug 32427 is obsolete nowadays... -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to libreoffice in Ubuntu. https://bugs.launchpad.net/bugs/1777285 Title: Batch libreoffice --convert-to offers no way to wait for document completion Status in LibreOffice: New Status in libreoffice package in Ubuntu: Confirmed Bug description: Command-line: libreoffice --convert-to odt:writer8 myfile.txt The returned status code ($?) is zero. So far, so good. But, when I try to access the ODT file (E.g. copy it), it doesn't yet exist. Adding `sync; sync; sync` right after the libreoffice batch execution did not help. Adding --headless as an option did not help. If I sleep for a few seconds immediately after the libreoffice batch execution, then the file finally gets completed before a subsequent command references the ODT file. Sample script: ### Create somehow a file called myfile.txt rm myfile.odt somewhere-else.odt libreoffice --headless --convert-to odt:writer8 myfile.txt RC=$? if [ $RC -ne 0 ]; then echo '*** libreoffice conversion failed for myfile.txt' exit 86 fi #sleep 3 ls *.odt Result: ls: cannot access '*.odt': No such file or directory If one changes the above script so that the sleep is executed, then the ODT file is available. Observation: It appears that executing libreoffice in batch mode is somehow kicking off a separate process to finish the ODT file. The exit to the shell and the availability of the ODT file should be synchronized. Before 18.04, I never saw this behavior. ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: libreoffice 1:6.0.3-0ubuntu1 ProcVersionSignature: Ubuntu 4.15.0-23.25-generic 4.15.18 Uname: Linux 4.15.0-23-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.2 Architecture: amd64 CurrentDesktop: XFCE Date: Sat Jun 16 17:07:02 2018 InstallationDate: Installed on 2017-10-13 (246 days ago) InstallationMedia: Xubuntu 17.10 "Artful Aardvark" - Alpha amd64 (20170926) SourcePackage: libreoffice UpgradeStatus: Upgraded to bionic on 2018-05-18 (29 days ago) To manage notifications about this bug go to: https://bugs.launchpad.net/df-libreoffice/+bug/1777285/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp

