Bug 43895

Summary: Never let users save in /tmp by default
Product: LibreOffice Reporter: Björn Michaelsen <bjoern.michaelsen>
Component: LibreofficeAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: medium CC: alculquicondor, andrzej, benjaoming, courrier.oou.fr.mjk, greggory.hz, lgodard.libre, nekohayo, pretzels.man
Version: 3.4.4 release   
Hardware: Other   
OS: Windows (All)   
URL: https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/905355
See Also: https://launchpad.net/bugs/905355
https://bugs.freedesktop.org/show_bug.cgi?id=61159
Whiteboard: EasyHack DifficultyBeginner SkillCpp target:3.6.0 target:3.5.3

Description Björn Michaelsen 2011-12-16 10:13:42 UTC
When you download something and choose to open it in LibreOffice, it will be saved in /tmp. If you choose Save As, the default saving location will be in /tmp.

I just lost a partly written exam that way. I thought it was on my Desktop, but oh no, it was in /tmp and after rebooting it's now gone.

The suggestion is to NEVER let /tmp be the default folder in the Save dialog, and to ALWAYS warn the user if saving something there.
Comment 1 Björn Michaelsen 2011-12-16 10:14:25 UTC
EasyHackify
Comment 2 Nathan P. 2012-02-08 17:33:23 UTC
Could you please provide a code pointer for this?
Comment 3 Björn Michaelsen 2012-02-09 02:08:17 UTC
The file picker code is in http://opengrok.libreoffice.org/xref/core/fpicker/ .
I would suggest to just check the initial path for being /tmp (on unix only) and falling back to $HOME in that case.
Comment 4 Jordan Chin 2012-03-25 11:38:17 UTC
I was not able to reproduce this bug. Has it already been fixed?
Comment 5 Jordan Chin 2012-03-25 11:42:27 UTC
Oops, I did not fully understand the bug, but was able to reproduce it just now. I will take a look into this.  There was a suggestion to warn the user if something is saved in the /tmp directory-- could I please get a code pointer as to how to do that?
Comment 6 Not Assigned 2012-03-27 04:34:41 UTC
Andrzej J. R. Hunt committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd2fe95cce75f1157bd1c75d286a0047b2e4175e

fdo#43895 lp#905355: Never let users save in /tmp by default
Comment 7 Andrzej Hunt 2012-03-30 01:17:05 UTC
The bug is fixed
Comment 8 Andrzej Hunt 2012-03-30 01:20:05 UTC
Sorry, that was incorrect. The bug is fixed under Unix, but still needs to be fixed for Windows which will involve changing one line (which I'll do once I'm finished with what I'm currently working on).
Comment 9 Not Assigned 2012-04-04 06:24:29 UTC
Andrzej J. R. Hunt committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2890ca399dd23abd9b8b507d80f7242fce735278&g=libreoffice-3-5

fdo#43895 lp#905355: Never let users save in /tmp by default


It will be available in LibreOffice 3.5.3.
Comment 10 Not Assigned 2012-04-05 09:16:20 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dc2fe18e95731dcb7c9e2027f45fdaf265490592

fdo#43895 lp#905355: fix the fix so it doesn't crash
Comment 11 Not Assigned 2012-04-06 12:35:01 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cac9cf690bf337a97ede781c38c5e7ddb3f37ca5&g=libreoffice-3-5

fdo#43895 lp#905355: fix the fix so it doesn't crash


It will be available in LibreOffice 3.5.3.
Comment 12 Not Assigned 2012-04-27 08:03:54 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2d0ff6aa5d6951aaa00e2d6cf3878788b025983e

Related fdo#43895: Fixed shortcommings of FileDialogHelper_Impl::verifyPath
Comment 13 Sergey 2012-05-07 09:54:09 UTC
There is FileBase.getTempDirURL() which is better to use than hardcoded "/tmp" path.
Comment 14 Florian Reisinger 2012-05-18 09:32:39 UTC
Deleted "Easyhack" from summary.
Comment 15 Not Assigned 2012-06-09 10:47:43 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=89f45b9fef98650cc3166d9337c96e58f0c57c4f&g=libreoffice-3-5

Related fdo#43895: Fixed shortcommings of FileDialogHelper_Impl::verifyPath


It will be available in LibreOffice 3.5.5.
Comment 16 Sebastian@SSpaeth.de 2012-06-09 10:55:38 UTC
@Sergey, agreed. we should not be hardcoding file://tmp when there are propoer functions to get the tempdir. Can you file a followup bug that can be marked as another EasyHack?
Comment 17 Björn Michaelsen 2012-06-09 18:43:25 UTC
I think it _is_ a good idea to use a hardcoded path here. After all we are evading saving to /tmp, when another app (Firefox) put a file there. As tempdirs in configured in LibreOffice and Firefox might differ, you end up SOL in that case anyway. So keeping the current heuristic and just being caring about the "tmp" case should be the best we can do anyway.
resolving
Comment 18 Andrzej Hunt 2012-09-15 18:09:22 UTC
*** Bug 48053 has been marked as a duplicate of this bug. ***