Bug 687562 - vector devices close output file incorrectly
Summary: vector devices close output file incorrectly
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Graphics Library (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Russell Lang
URL:
Keywords:
Depends on:
Blocks: 687542
  Show dependency tree
 
Reported: 2004-07-06 04:01 UTC by Russell Lang
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Lang 2004-07-06 04:01:18 UTC
The pswrite device uses gdev_vector_open_file_options to open 
the output file, which calls gx_device_open_output_file.  
The allows the use of special output files such as "%pipe%lpr"
or on Windows "%printer%Queue Name".
When pswrite closes, it calls gdev_vector_close_file,
which simply calls fclose.  It should instead close
gx_device_close_output_file.

This means that special closing code is not run.
This is blocking my fix for Bug 687542.

So it appears that gdevvec.c:808 should instead call
gx_device_close_output_file((gx_device *)vdev, vdev->fname, f)
as is done in gdevprn.c.
Is this the correct fix?
Comment 1 Igor Melichev 2004-07-06 05:09:47 UTC
pdfwrite, being a vector device, considers the output file as a positionable 
one. It won't work with a pipe.
Comment 2 Russell Lang 2004-07-06 05:22:46 UTC
It works with pdfwrite for simple files!

The main requirement here is for use with pswrite.
To print PDF files it is common to convert to PS with pswrite
then send to a PS printer.

Apart from the pipe issue, does the proposed change look correct?
Any other unexpected side effects?
Comment 3 Ray Johnston 2004-07-06 15:19:43 UTC
This change looks valid.

Igor's comment about the pdfwrite device requiring a 'seekable' file
is not relevant since this is supposed to be taken into account by
the caller to gdev_vector_open_file_options setting the
VECTOR_OPEN_FILE_SEQUENTIAL in the open_options.
Comment 4 Ray Johnston 2004-07-06 15:28:26 UTC
This change looks valid.

Igor's comment about the pdfwrite device requiring a 'seekable' file
is not relevant since this is supposed to be taken into account by
the caller to gdev_vector_open_file_options setting the
VECTOR_OPEN_FILE_SEQUENTIAL in the open_options.

Since gdevpdf.c uses gdev_vector_open_file which has the default
options all 0, the file will be required to be seekable (since
VECTOR_OPEN_FILE_SEQUENTIAL and VECTOR_OPEN_FILE_SEQUENTIAL_OK are false)