On Wed, Nov 29, 2006 at 09:53:29AM +0100, [EMAIL PROTECTED] wrote:
> On Wed, 29 Nov 2006, Enrico Forestieri wrote:
> 
> > $ ./src/lyx-qt4.exe -dbg info -geometry 800x600+100+30
> > Setting debug level to info
> > Debugging `info' (General information)
> > Wrong command line option `-geometry'. Exiting.
> > Deleting tmp dir /tmp
> > Not deleting /tmp.
> 
> Did it actually try to delete /tmp? Just wondering if there is a hardcoded 
> check for *not* deleting /tmp or something? (Or maybe it checks that the 
> thing to be deleted isn't a directory)

Yes, it actually tries to delete /tmp if an unrecognized option appears
on the command line. I think this is due to a changed initialization
order, such that temp_dir() simply contains "/tmp" instead of
"/tmp/lyx_tmpdirXXXXX". This is the patch from Georg:

--- lyx-devel/trunk/src/lyx_main.C (original)
+++ lyx-devel/trunk/src/lyx_main.C Tue Nov 28 21:04:16 2006
@@ -414,6 +414,14 @@

        // do any other cleanup procedures now
        lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << 
endl;
+
+       // Prevent the deletion of /tmp if LyX was called with invalid
+       // arguments. Does not work on windows.
+       // FIXME: Fix the real bug instead.
+       if (package().temp_dir() == "/tmp") {
+               lyxerr << "Not deleting /tmp." << endl;
+               return;
+       }

        if (!destroyDir(package().temp_dir())) {
                docstring const msg =

-- 
Enrico

Reply via email to