[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    KTempFile wierdness
From:       shaheed <srhaque () iee ! org>
Date:       2001-05-30 21:48:36
[Download RAW message or body]

Drat and double drat. I found a problem with the OLEFilter handling of 
embedded objects. The problem is as follows:

1. koFilterManager creates a KTempFile to receive the output from a "file" 
filter. It uses defaults for the name "KTempFile tempFile;" near line 434.

2. The OLEFilter decides the top level MS Word contains an embedded file, and 
invokes koFilterManager to handle it (near line 156).

3. This is a recursive call back to step 1, and results in a temporary file 
of the same name as step 1 being created.

4. The OLEFilter embeds the returned data from step 3 into the file from step 
1 and tidies up by deleting the file from step 3, and also therefore the file 
for step 1.

Result: /me totally confused for several hours!

Now, this used to work many months ago, so perhaps the behaviour of KTempFile 
been changed? The new code uses the fakes.c vesion of mkstemps: but somehow 
the check for exclusivity seems to be broken.

Any clues? It would be really good to fix this before the next version of 
kdelibs, so that koffice can use it!

Thanks, Shaheed

On Wednesday 30 May 2001 09:55, David Faure wrote:
> On Wednesday 30 May 2001 02:09, shaheed wrote:
> > David,
> >
> > I hate to ask such a dumb question, but is there some magic in ktargz or
> > kostore? Basically, if you run "kword test2object.doc", you will see that
> > the top level file being created by olefilter.cc line 98 has one name,
> > but the resukting filename is something completely different!
> >
> > For example, in one run:
> >
> > $ rm -f /home/srhaque/.kde/tmp-chiswick/kword*
> > $ kword test2object.doc
> > ...
> > ole-lib: OLEFilter::filter(): created
> > /home/srhaque/.kde/tmp-chiswick/kword285a1a.tmp
> > ...
> > $ ls -ltr /home/srhaque/.kde/tmp-chiswick/kword*
> > -rw-------    1 srhaque  srhaque     20620 May 30 01:05
> > /home/srhaque/.kde/tmp-chiswick/kworddhnYZb.tmp
> >
> > and indeed the file that actually results is the right one. Now, this
> > obviously works for normal files...but test2object.doc has embedded ole
> > objects in it. So, perhaps KoStore::embed() is doing something wrong. But
> > for the life of me, I cannot see it. This all used to work months ago...
>
> My guess is that the first temp file is the real one, the one that gets
> read by KWord. Don't forget that koDocument deletes the file after reading
> it, so there's no wonder you don't find it in the temp dir. You need to
> comment out the "unlink" line to prevent that from happening...
>
> Dunno what the other temp file is though.... OLEFilter::slotSavePart seems
> to create one, but also to delete it. Did you check its contents ?

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic