Bug 688198 - ghostscript can't handle files with long names/paths
Summary: ghostscript can't handle files with long names/paths
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Graphics Library (show other bugs)
Version: 8.51
Hardware: PC Windows 2000
: P3 normal
Assignee: Stefan Kemper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-08 08:17 UTC by Uwe Stöhr
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
postscript test file (12.27 KB, application/postscript)
2005-07-08 08:18 UTC, Uwe Stöhr
Details
test graphic (79.43 KB, application/postscript)
2005-07-08 08:19 UTC, Uwe Stöhr
Details
patch (809 bytes, patch)
2005-07-11 04:18 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Stöhr 2005-07-08 08:17:39 UTC
Ghostscript can't handle graphics with the longest filename allowed by Windows.
To reproduce this I attached such a graphic file and an postscript-file where it
is embedded.
If you open the postscript file with gsview you can see that the image isn't
displayed.
To check if it is really ghostscript 8.51, I tried to convert the graphic to pdf
using Imagemagic's convert.exe as this uses the ghostscript libraries for the
conversion of eps and pdf files. I get the following error:

-----------------------------------------------------------

F:\lyxdokumente>convert 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaatiger.eps testtiger.pdf
Error: /undefinedfilename in 
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval-- 
--nostringval-
-   2   %stopped_push   --nostringval--   --nostringval-- 
--nostringval--   fa
lse   1   %stopped_push
Dictionary stack:
   --dict:1126/1686(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--
Current allocation mode is local
AFPL Ghostscript 8.51: Unrecoverable error, exit code 1
Error: /undefinedfilename in 
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval-- 
--nostringval-
-   2   %stopped_push   --nostringval--   --nostringval-- 
--nostringval--   fa
lse   1   %stopped_push
Dictionary stack:
   --dict:1126/1686(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--
Current allocation mode is local
AFPL Ghostscript 8.51: Unrecoverable error, exit code 1
convert: no decode delegate for this image format 
`aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaatiger.eps'.

----------------------------------------
Comment 1 Uwe Stöhr 2005-07-08 08:18:29 UTC
Created attachment 1515 [details]
postscript test file
Comment 2 Uwe Stöhr 2005-07-08 08:19:26 UTC
Created attachment 1516 [details]
test graphic
Comment 3 Uwe Stöhr 2005-07-08 08:22:16 UTC
This bug affects also gsview as you can't open attachment 1516 [details] with gsview 4.7.
Comment 4 Dan Coby 2005-07-08 11:33:01 UTC
On my copy of WinXP Pro, I am unable to create a file called:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaatige
r.eps

I can create file whose name is three characters shorter.

The longest file name that I am able to handle with Ghostcript (CVS head) from 
the command line seems to be 202 characters.

Note: gp_file_name_sizeof is defined as 260.  I do not know why we cannot 
handle file names between 202 and 260 characters.
Comment 5 Dan Coby 2005-07-10 17:40:41 UTC
>This bug affects also gsview as you can't open attachment 1516 [details] with gsview 
4.7.

I can open attachment 1516 [details] without problem with 8.51 from the command line.
Comment 6 Russell Lang 2005-07-10 18:32:30 UTC
> This bug affects also gsview as you can't open attachment 1516 [details] with gsview 4.7.

GSview 4.7 can open files with names up to 255 characters long.
Note that the file name length includes the path.

Comment 7 Alex Cherepanov 2005-07-11 04:18:50 UTC
Created attachment 1517 [details]
patch

Increade the limit on the .libfile operand length from 200 to the full
gp_file_name_sizeof . 

The file system also limits the length of the file name. I used the following
simple program to test the file systems and run time libraries.

#include <stdio.h>
#include <stdlib.h>

int main()
{ int i;
  char buf[1024];
  for(i=200; i < sizeof(buf); i++)
    { FILE *f;
      printf("%d\n",i);
      memset(buf, 'a', i);
      buf[i] = 0;
      f = fopen(buf, "wb");
      if(!f)
	  break;
      fclose(f);
    }
  return 0;
}

The results:

WindowsNT, NTFS, GCC  = 243
WindowsNT, NTFS, MSVC = 252
WindowsNT, Samba, GCC = 236, last 5 files cannot be opened on Windows
WindowsNT, Samba, MSVC= 232, last 3 files cannot be opened on Windows
GNU+Linux, ext2, GCC  = 255
Comment 8 Alex Cherepanov 2005-07-14 08:19:44 UTC
The patch is committed to the HEAD branch.