Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/bin/page hangs #124

Closed
jibanes opened this issue Nov 15, 2017 · 2 comments · Fixed by #295
Closed

/bin/page hangs #124

jibanes opened this issue Nov 15, 2017 · 2 comments · Fixed by #295

Comments

@jibanes
Copy link

jibanes commented Nov 15, 2017

/bin/page hangs on this simple file (within the zip attached).
file.zip

@fhs
Copy link
Contributor

fhs commented Nov 12, 2019

It doesn't hang, but simply fails for me:

$ gs --version
9.50
$ unzip file.zip 
Archive:  file.zip
  inflating: vp90251.ps              
$ page -v vp90251.ps 
reading through postscript...
ps %%BoundingBox: 0 0 600 600
[0 0 600 600] -> [0 0 612 792]
document bbox [0 0 612 792]
don't know where pages are
cmd: /PAGEDIDSHOWPAGE false def
cmd: /showpage { /PAGEDIDSHOWPAGE true def showpage } bind def
cmd: /PAGEFLUSH { PAGEDIDSHOWPAGE not {showpage} if /PAGEDIDSHOWPAGE false def } def
cmd: /PAGEOUT (/dev/fd/4) (w) file def
cmd: .setsafe
cmd: /PAGE== { PAGEOUT exch write==only PAGEOUT (\n) writestring PAGEOUT flushfile } def
cmd: (\n//GO.SYSIN DD\n) PAGE==
p: (\n//GO.SYSIN DD\n)
setdim: bbox=[0 0] [612 792]
cmd: mark
cmd: /HWResolution [100 100]
cmd: /PageSize [612 792]
cmd: /Margins [0 0]
cmd: currentdevice putdeviceprops pop
cmd: /#copies 1 store
cmd: (\n//GO.SYSIN DD\n) PAGE==
p: (\n//GO.SYSIN DD\n)
Ghostscript Error:
Error: /invalidfileaccess in --run--
Operand stack:
   (vp90251.ps)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   run   %loop_continue   run   run   false   1   %stopped_push   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   1990   1   3   %oparray_pop   run
Dictionary stack:
   --dict:745/1123(ro)(G)--   --dict:0/20(G)--   --dict:80/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 17
cache load 0
using "bmp -t9 " to convert "gs pipe"...
spawning(bmp -t9 )...bmp: bad magic number, not a BMP file
warning: couldn't read image: Success
remove /tmp/gs_16939a...

However, I can successfully produce the BMP file with this ghostscript command:

$ gs \
      -dNOPAUSE \
      -dNOPROMPT \
      -dDELAYSAFER \
      -dQUIET \
      -sDEVICE=bmp16m \
      -r100 \
      -dTextAlphaBits=4 \
      -dGraphicsAlphaBits=4 \
      -o output.bmp \
     vp90251.ps

@fhs
Copy link
Contributor

fhs commented Nov 13, 2019

I was getting the invalidfileaccess error because I was passing a relative path to the ps file. It displays the ps file and hangs as originally reported if I pass an absolute path:
page $(pwd)/vp90251.ps instead of page vp90251.ps. This is due to to the run operator not liking a relative path (security risk?). See https://www.ghostscript.com/doc/current/Use.htm#Finding_files

fhs added a commit to fhs/plan9port that referenced this issue Nov 14, 2019
Page was hanging because ghostscript never closes the fd from which
we're reading BMP data. We close our end of the pipe so that ghostscript
will close its end.

Tested with ghostscript version 9.50.

Fixes 9fans#124
fhs added a commit to fhs/plan9port that referenced this issue Nov 14, 2019
Page was hanging because ghostscript never closes the fd from which
we're reading BMP data. We close our end of the pipe so that ghostscript
will close its end.

Tested with ghostscript version 9.50.

Fixes 9fans#124
dancrossnyc pushed a commit that referenced this issue Nov 14, 2019
Page was hanging because ghostscript never closes the fd from which
we're reading BMP data. We close our end of the pipe so that ghostscript
will close its end.

Tested with ghostscript version 9.50.

Fixes #124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants