Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2017/10/09)20171010 
rnissl Hi kens, I'd like to talk about http://bugs.ghostscript.com/show_bug.cgi?id=69865209:43.49 
kens OK09:43.54 
rnissl I think this is an incompatbile change as ghostscript yields an error09:44.30 
kens Yes, but it also tells you why and what to do about it09:44.42 
chrisl rnissl: To be fair, I *should* have included it in the release notes, but it slipped - I apologise for that.09:47.27 
rnissl chrisl, that's what I would have expected. Yesterday I read news.htm, upgraded ghostscript and then got complaints from my users that PDFMail is nolonger working.09:49.26 
  sure, I should have run a test either, but it didn't look like there will be a problem.09:50.06 
chrisl rnissl: Frankly, using options with such *massive* security implications in a "production" environment is just a really bad idea09:50.45 
rnissl I agree09:51.11 
  I've removed DELAYBIND and tested most of PDFMail's functionality and it looks like I don't need it at all09:52.15 
  looks like I was inspired by pstotxt, which used it.09:53.43 
chrisl If you find cases where you do "need" it, we discuss it - there may be a more secure alternative solution, or we can consider reinstating the option. But we'd *really* like to get rid of it because of the aforementioned security implications.09:53.52 
  s/we discuss it/we can discuss it09:54.20 
kens I'm pretty sure we removed pstotxt as well :-)09:54.23 
chrisl Well, we have txtwrite now09:54.34 
rnissl would you please be so kind an have a look at https://pastebin.com/Qxiy4UiL09:59.00 
  at the end of the file, I redefine some postscript operators to that I can analyse the printed text09:59.40 
  I wonder if any of these could require DELAYBIND10:00.37 
kens Only if you then run PostScript which uses //show or similar I think10:01.08 
rnissl what does that // mean?10:01.58 
kens Which you could get around by definiing the procedures in gs_init.ps10:02.02 
  immediatley evaluated name10:02.47 
chrisl I don't think it'll affect //show10:03.23 
kens But as long as your dictionary is on the stack at the time you should be OK10:03.25 
rnissl looks like I put my definitions in userdict10:04.10 
chrisl The case that won't cover, with or without DELAYBIND is Postscript that does "systemdict /show get exec"10:04.10 
kens That's just nasty10:04.22 
  You would have to alter gs_init.ps to get around that10:04.37 
chrisl It's pretty rare, but does happen10:04.40 
kens Define the procedures while systemdict is still writeable10:04.47 
rnissl writeable systemdict -- I came to that conclusion too10:05.52 
chrisl On, the lack of DELAYBIND will affect the results if your input is PDF10:06.48 
  s/On/Oh10:06.59 
kens Hmm yes true10:07.04 
  Because hte PDF itnerpreter will have the existing definitions bound in10:07.17 
chrisl Yeh :-(10:07.25 
kens Not the redefinitions10:07.25 
rnissl That's not a problem for now. Input is PS.10:08.00 
  where do I find gs_init.ps?10:08.20 
kens In ghostpdl/Resource/Init10:08.30 
rnissl so it is compiled into ghostscript?10:09.03 
kens If you are using the ROM file system, yes10:09.14 
  Which I shold note, is the default10:09.35 
rnissl well, so far I didn't touch any files of a ghostscript installation on win3210:10.31 
kens On Windows its always built in, and we don't currently supply the files in the installer.10:10.53 
  You can pick up the files from our Git reposotiry, and then use the -I switch to tell Ghostscript to use files from disk in preference to the ones built into the ROM file system10:11.25 
chrisl IIRC, you can also define a GS_LIB environment variable with the search path, rather than add -I to every invocation10:13.10 
kens Yes I think you are correct10:13.19 
rnissl I've used -I anyway to specify the path to mailFilterText.ps for example10:14.51 
  so if I put that file (gs_init.ps) into that directory, it will replace the compiled in one?10:15.39 
kens Hmmmmm10:15.51 
chrisl You need the entire content of Resource/ IIRC10:16.28 
kens Without checking I can't be certain, but I think its 'possible'you may need the entire resource structure. I'm not certain though, its not a configuration I generally deal with10:16.34 
chrisl Or at *least* Resource/Init10:16.39 
rnissl what do you think about using -dWRITESYSTEMDICT?10:16.49 
kens Horrible security ciolation10:17.01 
chrisl That's an even bigger security hole than DELAYBIND10:17.07 
rnissl so I could put my implementations into systemdict10:17.14 
kens Yes but any program could then write to systemdict, which really opens you up to malicious code if it becomes known10:18.28 
rnissl agreed10:18.44 
  thanks for the talk so far -- I'll be off for lunch now10:19.25 
kens I've a feeling we only preserved WRITESYSTEMDICT for some horribly hacky tool10:19.30 
rnissl chrisl, if I feed my mailFilterText.ps as command line argument to ghostscript I assume, my operator redefinitions went into userdict11:01.24 
kens If you do not specify a dicitonary they go into whatever dictionary is currently on top of the dictionary stack. When Ghostscript starst up, in common with all PostScritp interpreters, the current dictionary is userdict.11:02.15 
rnissl so with or without DELAYBIND, "systemdict /show get" for example would never have returned my implementation11:02.39 
kens Yes, correct11:02.48 
  That's what I meant when I said that was nasty :-)11:03.02 
rnissl kens, you mean with nasty, that I didn't use my own dict?11:06.25 
chrisl No, kens means "systemdict /show get" is nasty11:07.04 
kens No sorry, I meant that the PostScript program in that case would be nasty. Its really not a good idea to deliberately pull definitions from systemdict.11:07.07 
chrisl It's *very* much not in the spirit of how Postscript is intended to be used11:07.23 
rnissl dict stack is the way to walk to resolve names, isn't it?11:08.09 
kens You shuldn't need to resolve names yourself, the interpreter does that. It does it, as you imply, by searching the dictionaries on the dict stack.11:08.44 
rnissl yeah, that's what I ment.11:09.07 
kens But you *can* pull key/value pairs form a specific dictionary, without it being on the dictionary stack11:09.14 
chrisl As I said, it's a rare construct, but not unheard of - and it can be useful for very specific debugging cases if you know what you are doing11:09.14 
  Actually, the main place I've seen it used is for showpage11:10.12 
rnissl just to prove my understanding of DELAYBIND, all binds where delayed to .bindnow and at that time, all resolving used the dict stack at that point in time11:10.53 
kens I'm not certain about how the names are resolved because, obviously, there's the possibility of binding being deferred for objects whose dictionary is removed from the dictionary stack before .bindnow11:12.29 
  I don't know if DELAYBIND copes with that, by deferring the removal of the dictionary, or throws an error.11:13.01 
  All of this confusion is one of the reasons we removed DELAYBIND11:13.14 
chrisl Also, the *vast* majority of people who use DELAYBIND on the command line never actually call .bindnow - which makes it an even more horrific security nightmare11:14.27 
rnissl for PDFMail, I feed ghostscript a couple of input files like mailFilterText.ps then -c .bindnow followed by -f input.ps11:15.03 
  the latter is the content of what the printer driver provided11:15.21 
kens If you must use DLEYBIND then that is a reasonable way to proceed11:15.40 
rnissl so in my case, DELAYBIND would have only an influence on the files given before .bindnow and not for input.ps11:17.55 
kens Yes11:18.08 
rnissl as I have full control about these files, then I don't need DELAYBIND11:18.39 
  I think, my understanding several years ago of DELAYBIND was, that I could poke that nasty construct to use my for example /showpage implementation11:20.10 
  but this never worked11:20.19 
  then11:20.28 
  so I conclude now, I don't need DELAYBIND ;-)11:21.25 
kens Very likely, we couldn't think of many good resons for it11:21.50 
rnissl another thing I'd like to talk about is -dSAFER11:22.10 
kens That's *much* more complicated11:22.21 
rnissl at the moment I rely on an implicit -dNOSAFER but docs tell me to explicitly specify -dNOSAFER or make the code work with -dSAFER11:23.42 
kens Currently the default is still -dNOSAFER, despite the documentation, I don't think that's likely to change11:24.19 
chrisl NOSAFER is the default, and will probably remain so11:24.20 
rnissl I think -dSAFER wouldn't work for me, as I need to write some excerpt of the document processed by hooking the show operators into files11:26.13 
kens Then you cannot run with SAFER11:26.31 
  Umm.11:26.36 
rnissl but on the other hand, I'd like to run input.ps in a safe environment11:26.44 
kens You can't realistically have it both wyas. PostScript allowed to write files, and at the same teim, not allowed to write files.11:27.16 
  chrisl I have a vague memory of the CWD being valid to write files when SAFER is true, but I am not certain ?11:28.01 
chrisl Um, not sure.... it's a while since I looked into the rules. There's less flexibility with writing than reading, though11:28.43 
rnissl I'd like to try -dNOSAFER combinded with save, .setsafe and .runandhide11:28.57 
kens runandhide is gone11:29.13 
  You would have to edit gs_init.ps to briong it back11:29.24 
rnissl kens, did you fix the link referencing it in Use.htm as well?11:30.38 
kens I removed it from both HTML files11:30.49 
chrisl We only check the SAFER permissions when opening the file, so if you opened the output file in your mailFilterText.ps file, then called .setsafe at the end of mailFilterText.ps, that *should* work11:31.49 
rnissl thought about that too11:34.24 
  at the moment, the file is opened written and closed while processing input.ps whenever a hooked command is executed11:35.07 
  writing it after input.ps would require .runandhide to prevent input.ps to maliciously get access to the unsafe state11:37.10 
kens Only if you do a save before you do .setsafe, all .runandhide does is make that save state inaccesible11:37.56 
rnissl sure, as documented for 9.2111:38.23 
kens And as Chris says, if you open the file before calling .setsafe, then you can write to it as much as you like, provided you don't close it until you are done11:38.29 
rnissl ahh, ok, after .setsafe, I cannot open new files in filesystem for writing11:40.46 
kens Exactly11:40.54 
rnissl opening the files early shouldn't be to complicated to change11:42.55 
  so thanks for the talk, I'll now try to implement what we discussed.11:45.18 
kens No problem11:45.25 
chrisl rnissl: Um, what license is PDFMail under?11:45.41 
rnissl AGPL11:46.00 
chrisl Oh, cool11:46.15 
  Sorry, there appears to be a commercial product of the same name11:46.38 
rnissl it's a loose collection of script files so there is actually nothing to hide11:46.41 
kens Yes we had this discussion a few bug reports back :-)11:46.52 
chrisl Ah, sorry - sometimes get paranoid11:47.05 
kens Well I wouldn't have remembered, but I happened to run across the old report11:47.28 
rnissl yeah, I've googled for PDFMail when we discussed that several months ago11:48.05 
  there is actually a product with the same name11:48.24 
kens lunches11:48.29 
chrisl rnissl: The other thing I've considered is adding a writable directory list to the SAFER code (there's already a readable list). But so far, there's been no compelling reason11:48.40 
rnissl chrisl, in the morning I was about filing a feature request for that11:49.29 
chrisl rnissl: In every case, so far, there's been an alternative solution11:50.34 
rnissl but it might get misused, if one can create arbitrary files in that location11:51.08 
chrisl which is why I'd only implement it with a solid, compelling reason11:51.55 
rnissl for me there is no need at the moment11:52.35 
  I've just again gooled for PDFmail11:52.44 
  my PDFmail behaves like their 'Search & Send' functionality11:53.43 
  that's the reason for mailFilterText.ps11:54.39 
  and storing the extracted text for sending an email after conversion to pdf11:55.19 
  I've started that kind of ps processing around 199811:56.59 
  I remember emails to l peter deutsch -- didn't it found ghostscript?11:57.33 
  s/it/he/11:57.45 
kens Peter originally wrote Ghostscript12:19.34 
devios Hi13:35.24 
ghostbot Welcome to #ghostscript, the channel for Ghostscript and MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line.13:35.24 
devios Are there any MuPDF developers out here?13:35.39 
kens You would do better in the #mupdf channel13:35.51 
devios Ok will try there13:36.05 
asd a22:26.07 
 Forward 1 day (to 2017/10/11)>>> 
ghostscript.com #mupdf
Search: