-dLastPage=1 for multple page pxl segfault. r10348 The result pdf is also unfinished. pspcl6 -dNOPAUSE -dLastPage=1 -sDEVICE=pdfwrite -sOutputFile=/tmp/a.pdf /tmp/a.pxl -dLastPage=1 for other device (e.g. png16m) seems to work alright. tried two different /tmp/a.pxl from two multi-page pdf's. here is the backtrace: Program received signal SIGSEGV, Segmentation fault. 0x000000000051128b in ialloc_validate_object (ptr=0x27ff6c9b58, cp=0x0, gcst=0x7fffffffc480) at ../gs/psi/ilocate.c:523 523 ulong size = pre_obj_contents_size(pre); Missing separate debuginfos, use: debuginfo-install e2fsprogs-libs-1.41.4-12.fc11.x86_64 glibc-2.10.1-5.x86_64 libICE-1.0.4-7.fc11.x86_64 libSM-1.1.0-4.fc11.x86_64 libX11-1.2.2-1.fc11.x86_64 libXau-1.0.4-5.fc11.x86_64 libXext-1.0.99.1-3.fc11.x86_64 libXt-1.0.5-2.fc11.x86_64 libxcb-1.2-4.fc11.x86_64 (gdb) bt #0 0x000000000051128b in ialloc_validate_object (ptr=0x27ff6c9b58, cp=0x0, gcst=0x7fffffffc480) at ../gs/psi/ilocate.c:523 #1 0x0000000000510be7 in ialloc_validate_chunk (cp=0x196c7b0, gcst=0x7fffffffc480) at ../gs/psi/ilocate.c:335 #2 0x00000000005107d3 in ialloc_validate_memory (mem=0x192a3c8, gcst=0x7fffffffc480) at ../gs/psi/ilocate.c:248 #3 0x0000000000509cb6 in gc_validate_spaces (spaces=0x7fffffffc5e0, max_space=5, gcst=0x7fffffffc480) at ../gs/psi/igc.c:145 #4 0x000000000050b32a in gs_gc_reclaim (pspaces=0x1966ee0, global=1) at ../gs/psi/igc.c:547 #5 0x00000000005b1190 in context_reclaim (pspaces=0x1966ee0, global=1) at ../gs/psi/zcontext.c:283 #6 0x00000000004c123b in gs_vmreclaim (dmem=0x1966ed8, global=1) at ../gs/psi/ireclaim.c:153 #7 0x00000000004c0f9a in ireclaim (dmem=0x1966ed8, space=8) at ../gs/psi/ireclaim.c:75 #8 0x00000000004ba6b0 in interp_reclaim (pi_ctx_p=0x1928208, space=8) at ../gs/psi/interp.c:427 #9 0x00000000004afa64 in gs_main_finit (minst=0x1928170, exit_status=0, code=0) at ../gs/psi/imain.c:749 #10 0x00000000004afc4b in gs_to_exit_with_code (mem=0x18ff010, exit_status=0, code=0) at ../gs/psi/imain.c:827 #11 0x00000000004afc72 in gs_to_exit (mem=0x18ff010, exit_status=0) at ../gs/psi/imain.c:832 #12 0x00000000004b3b9f in gsapi_exit (lib=0x1928170) at ../gs/psi/iapi.c:262 #13 0x0000000000404b90 in ps_impl_deallocate_interp_instance (instance=0x1904270) at ../psi/psitop.c:542 #14 0x00000000007cfcb3 in pl_deallocate_interp_instance (instance=0x1904270) at ../pl/pltop.c:211 #15 0x000000000081c9dc in pl_main_universe_dnit (universe=0x7fffffffcd50, err_str=0x7fffffffd3d0 "0\325\377\377\377\177") at ../pl/plmain.c:566 #16 0x000000000081bfc1 in pl_main (argc=6, argv=0x7fffffffe078) at ../pl/plmain.c:448 #17 0x000000000081e2df in main (argc=6, argv=0x7fffffffe078) at ../pl/plmain.c:1280 (gdb) q
I don't deny that a crash is undesirable, but is -dLastPage meant to do anything useful for PXL files ? Its documented in use.htm for PDF files, I didn't know it worked for PXL files as well.
Tried this with the current HEAD revision, on Windows, and the test file 5148.pxl without problem. Hin-Tak can you point me to a file which fails please ? Even if it only fails on Linux I need to be able to see the problem.
It has gone worse - running any file (e.g tools/pattern.pxl) without -dLastPage=1 give this: ---------------------------------- #0 0x00000000004046d6 in ps_impl_get_minst (mem=0x31e6c38) at ../psi/psitop.c:324 324 return psi->minst; (gdb) bt #0 0x00000000004046d6 in ps_impl_get_minst (mem=0x31e6c38) at ../psi/psitop.c:324 #1 0x00000000004ae984 in get_minst_from_memory (mem=0x31e6c38) at ../gs/psi/imain.c:63 #2 0x00000000004aea0f in get_op_array (mem=0x31e6c38, size=1712) at ../gs/psi/imain.c:96 #3 0x00000000004c8cf9 in op_index_ref (mem=0x31e6c38, index=1712, pref=0x320cdc8) at ../gs/psi/iutil.c:640 #4 0x00000000004e255c in zmakeoperator (i_ctx_p=0x3223f60) at ../gs/psi/zmisc.c:307 #5 0x00000000004bab9b in call_operator (op_proc=0x4e232b <zmakeoperator>, i_ctx_p=0x3223f60) at ../gs/psi/interp.c:118 #6 0x00000000004bddea in interp (pi_ctx_p=0x31e5198, pref=0x7fffb09030f0, perror_object=0x7fffb0903140) at ../gs/psi/interp.c:1550 #7 0x00000000004bb2e9 in gs_call_interp (pi_ctx_p=0x31e5198, pref=0x7fffb09030f0, user_errors=1, pexit_code=0x7fffb090315c, perror_object=0x7fffb0903140) at ../gs/psi/interp.c:508 #8 0x00000000004bb0fc in gs_interpret (pi_ctx_p=0x31e5198, pref=0x7fffb09030f0, user_errors=1, pexit_code=0x7fffb090315c, perror_object=0x7fffb0903140) at ../gs/psi/interp.c:466 #9 0x00000000004aee7c in gs_main_interpret (minst=0x31e5100, pref=0x7fffb09030f0, user_errors=1, pexit_code=0x7fffb090315c, perror_object=0x7fffb0903140) at ../gs/psi/imain.c:240 #10 0x00000000004af7a8 in gs_run_init_file (minst=0x31e5100, pexit_code=0x7fffb090315c, perror_object=0x7fffb0903140) at ../gs/psi/imain.c:483 #11 0x00000000004aef78 in gs_main_init2 (minst=0x31e5100) at ../gs/psi/imain.c:275 #12 0x00000000004b0a79 in gs_main_init_with_args (minst=0x31e5100, argc=4, argv=0x7fffb0903bf0) at ../gs/psi/imainarg.c:223 #13 0x0000000000404509 in ps_impl_allocate_interp_instance (instance=0x7fffb0903fc0, interp=0x1941978, mem=0x31b73d8) at ../psi/psitop.c:225 #14 0x0000000000866a5d in pl_allocate_interp_instance (instance=0x7fffb0903fc0, interp=0x1941978, mem=0x31b73d8) at ../pl/pltop.c:61 #15 0x00000000008b4708 in pl_main_universe_init (universe=0x7fffb0903fa0, err_str=0x7fffb0904620 "\"", mem=0x31b73d8, pdl_implementation=0xa2eb20, pjl_instance=0x31b8130, inst=0x7fffb09050f0, pl_pre_finish_page=0x8b5ea9 <pl_pre_finish_page>, pl_post_finish_page=0x8b604c <pl_post_finish_page>) at ../pl/plmain.c:546 #16 0x00000000008b3ba0 in pl_main (argc=2, argv=0x7fffb09052d8) at ../pl/plmain.c:280 #17 0x00000000008b624c in main (argc=2, argv=0x7fffb09052d8) at ../pl/plmain.c:1311 (gdb) ------------ That has to mean psi isn't filled with the right stuff. When I run the switch as reported, I forgot that -dLastPage/-dFirstPage are for the interpreter, not for the writer - I mistakenly thought -dLastPage=1 would just write the first page out. (and it probably should work that way, if it is implemented).
Hin-Tak, are you using a language switch build ? I can't see why you would get to 'ps_impl_allocate_interp_instance' in the PCL interpreter, since that is (I think) the PostScript interpreter. OK, forget that, I see you are indeed using the language switch build (pspcl6), I was testing using pcl6, I've never tried the language switch build.
OK, I don't believe at the moment that this has anything to do with pdfwrite, the language switch build seems to be broken completely. Although this is happening in the PostScript interpreter, it seems to be caused because the pl_main_universe_t->curr_instance is NULL. That gets cast to a PostScript interpreter instance, and then dereferenced, causing the segment fault. This happens on Windows as well as Linux. For me this happens without using the pdfwrite device, and occurs during initialisation of the PostScript world. This isn't an area I know anything about, but I'll spend some time poking it, until someone more qualified comes along.
I *think* that the language_switch build got broken in revision 11146 where, as part of the globals elimination, a new function was added for getting the array of deined operators. This function uses get_minst_from_memory which assumes a current instance of an interpreter, but I don't think the language_switch build has a current instance, until an interpreter is selected (or something like that). So I've backed out may language_switch code to revision 11141 and am looking again at -dLastPage.
For me the revision 11141 code fails with pdfwrite, its trying to do some vm cleanup and appears to be font-related. I get a GPF in igc_reloc_struct, called from font_reloc_ptrs. I guess the language_switch build must run the garbage collector ?
r11366 relevant? Just a note here to re-check.
This appears to be fixed. The file tools/pattern.pxl with -dLastPage=1 now works correctly with the pdfwrite device and the Windows display device.