[Libreoffice] [PUSHED] read/write + tempfile cleanup bits ...

Michael Meeks michael.meeks at novell.com
Tue May 3 02:32:54 PDT 2011

Hi Julien,

On Sat, 2011-04-30 at 16:46 -0700, Julien Chaffraix wrote:
> Attached is a patch should solve this.

	Lovely - thanks :-)

> Ouch, good catch! Attached is another patch for this.

	Great stuff. Incidentally - best to remove 'PUSHED' from the Subject -
I nearly forgot this - but I've pushed this pair :-)

> >        Otherwise this is nice :-) It would be sexy to have someone (when this
> > is all fixed), to isolate and unify all the temp file creation code that
> > is used all over the place; not all of it is best practise, and there is
> > a lot of dangerous duplication.
> Sounds like a worthy goal, do you have some pointers to areas that
> duplicate the code?

	Oh ! sure; so - poking about:

	osl_getTempDirURL - should prolly not exist, and be a:
		rtl::OUString osl_createTempDirectory();

	that gets the permissions right inside sal/osl/ itself - I guess
checking the (only) caller from vcl/

	Then I guess I would git grep for anything that looks like a temp impl.

	./g grep '"TEMP' eg. shows:


	doing some duplicate temp file stuff - probably that code should all be
removed, and all uses audited to check they are safe / sane.

	The easy hacks page has:

tools/source/fsys/tempfile.cxx vs.
unotools/source/ucbhelper/tempfile.cxx - cf. CreateTemplName_Impl vs.
filter/source/placeware/tempfile.cxx etc.

	vs. of course the (right place for it) osl/ version.

	I imagine there is more copy/paste fluff of this sort ;-) The only
trick of course is to ~ignore it in the build code: dmake, rsc, etc. and
clean it up in the runtime code.

	Clearly, we want to be safe creating temp-files, particularly for
document data - so they are only user read/write-able and not visible to
the world :-)



 michael.meeks at novell.com  <><, Pseudo Engineer, itinerant idiot

More information about the LibreOffice mailing list