Bug 695373 - xpswrite leaves temp files
Summary: xpswrite leaves temp files
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: XPS writer (show other bugs)
Version: master
Hardware: PC Windows 7
: P4 normal
Assignee: Ray Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-17 14:24 UTC by Ray Johnston
Modified: 2015-01-03 11:23 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Johnston 2014-07-17 14:24:22 UTC
rm -f temp/xps*
gswin32c -sDEVICE=xpswrite -o x.xps examples/tiger.eps
ls temp/xps*

Leaves 5 temp files, output after the above is:
   1 /c/temp/xps5195.tmp     1 /c/temp/xps5196.tmp   1 /c/temp/xps51A6.tmp
   1 /c/temp/xps51A7.tmp   129 /c/temp/xps53EA.tmp

Also it still produces two warning lines, even though the output looks correct:
| .\devices\vector\gdevxps.c:884: xps_put_params(): undefined
| .\devices\vector\gdevxps.c:884: xps_put_params(): undefined
Comment 1 Henry Stiles 2014-07-21 08:49:38 UTC
Yes, xpswrite unlinks the temporary file after closing, which works on POSIX systems.  I can manually track the files and delete them, but that does not fix clean up after crashes.  Paul was going to create a temp file wrapper as other languages have implemented (python, ruby etc.), but I now think the job should go to a gs developer (Ray, Chris or Ken) since Paul is swamped with other work.  Let's talk about it at the Tuesday meeting.
Comment 2 Ray Johnston 2014-07-22 08:39:10 UTC
On Windows, unlink won't work on an open file. The file must be closed FIRST
Comment 3 Henry Stiles 2014-07-22 08:58:02 UTC
orrection to comment #1 the first clause should read: "xpswrite unlinks the temporary file after opening".(In reply to Henry Stiles from comment #1)

> Yes, xpswrite unlinks the temporary file after closing, which works on POSIX
> systems.  I can manually track the files and delete them, but that does not
> fix clean up after crashes.  Paul was going to create a temp file wrapper as
> other languages have implemented (python, ruby etc.), but I now think the
> job should go to a gs developer (Ray, Chris or Ken) since Paul is swamped
> with other work.  Let's talk about it at the Tuesday meeting.
Comment 4 Henry Stiles 2014-07-22 09:02:07 UTC
(In reply to Ray Johnston from comment #2)
> On Windows, unlink won't work on an open file. The file must be closed FIRST

I can change the code but it works on POSIX, I assume if you do delete on close for files on windows the unlink call we have now will just fail on windows and all the platforms should work.  I guess a case could be made that we don't want failing unlink calls in the code, I'm okay with it.
Comment 5 Ray Johnston 2015-01-03 11:23:30 UTC
Fixed by commit f553eec3

This commit also fixes the issue with the extra messages from xps_put_params.