Re: faxq child processes closing stdin, stdout, and stderr
Aidan Van Dyk <[email protected]> Mon, 17 Dec 2012 22:50:40 -0500
| Newsgroups | gmane.comp.telephony.fax.hylafax.devel |
|---|---|
| Message-ID | <CAC_2qU-Qa6=7qDNn1C3PVRgV+Hvid+x+gfaxYjJiBcf+HZPRKA@mail.gmail.com> |
--e89a8f2354f9c23df504d1186651 Content-Type: text/plain; charset=UTF-8 Well, it all depends on what environment you want your child process to get before the exec(). sendStart() is meant to exec faxsend, which needs no normal stdio handles. runConverter() goes to the trouble to make sure it creates valid stdin/stdout/stderr handles, but gathers all output from stdout/stderr together into possible "error output". Job control scripts are intened to be "user scripts", and thus I believe the intent was to make them as "normal" as possible for the user script. But faxq doesn't parse, or care about stderr or stdin for them. So it has 2 choices. make new ones (like runConverter), or re-use the old ones. But it needs to make sure that stdin, stdout, and stderr are all valid file handles before exec()'ing. Many programs will crash and burn if stderr isn't a writable file handle. But we certainly don't want that going to the same place as stdout, which is read and processed by faxq as config options. a. On Sat, Dec 15, 2012 at 6:17 PM, Lee Howard <[email protected]> wrote: > Aidan, > > Regarding... > > http://git.hylafax.org/**HylaFAX?a=commitdiff;h=** > 551d959e1ef27a232182940e249a33**64e439d275<http://git.hylafax.org/HylaFAX?a=commitdiff;h=551d959e1ef27a232182940e249a3364e439d275> > > Can you please explain these two statements? ... > > + * We set up our file handles carefully here because > + * we want to have STDIN/STDOUT/STDERR all appearing > + * normally. We rely on knowing that faxq has a "good" > STDIN > + * STDERR at all times. > > Is there a problem in closing stdin and stderr within a faxq child > process? And, if those statements are correct aren't they contradicted by > operations (closing of stdin and stderr) within faxQueueApp::sendStart and > perhaps for a microsecond within faxQueueApp::runConverter? > > Thanks, > > Lee. > > > ____________________ HylaFAX(tm) Developers Mailing List > ____________________ > To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-** > bin/lsg2.cgi <http://lists.hylafax.org/cgi-bin/lsg2.cgi> > On UNIX: mail -s unsubscribe hylafax-devel-request@hylafax.**org<[email protected]>< /dev/null > > --e89a8f2354f9c23df504d1186651 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Well, it all depends on what=C2=A0environment=C2=A0you wan= t your child process to get before the exec().<div><br></div><div>sendStart= () is meant to exec faxsend, which needs no normal stdio handles.<br></div>= <div style> <br></div><div style>runConverter() goes to the trouble to make sure it cre= ates valid stdin/stdout/stderr handles, but gathers all output from stdout/= stderr together into possible "error output".</div><div style> <br></div><div style>Job control scripts are intened to be "user scrip= ts", and thus I believe the intent was to make them as "normal&qu= ot; as possible for the user script. =C2=A0But faxq doesn't parse, or c= are about stderr or stdin for them. =C2=A0So it has 2 choices. =C2=A0make n= ew ones (like runConverter), or re-use the old ones. =C2=A0But it needs to = make sure that stdin, stdout, and stderr are all valid file handles before = exec()'ing.</div> <div style><br></div><div style>Many programs will crash and burn if stderr= isn't a writable file handle. =C2=A0But we certainly don't want th= at going to the same place as stdout, which is read and processed by faxq a= s config options.</div> <div style><br></div><div style>a.</div></div><div class=3D"gmail_extra"><b= r><br><div class=3D"gmail_quote">On Sat, Dec 15, 2012 at 6:17 PM, Lee Howar= d <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">Aidan,<br> <br> Regarding...<br> <br> <a href=3D"http://git.hylafax.org/HylaFAX?a=3Dcommitdiff;h=3D551d959e1ef27a= 232182940e249a3364e439d275" target=3D"_blank">http://git.hylafax.org/<u></u= >HylaFAX?a=3Dcommitdiff;h=3D<u></u>551d959e1ef27a232182940e249a33<u></u>64e= 439d275</a><br> <br> Can you please explain these two statements? ...<br> <br> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* We set up our fi= le handles carefully here because<br> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* we want to have = STDIN/STDOUT/STDERR all appearing<br> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* normally. =C2=A0= We rely on knowing that faxq has a "good" STDIN<br> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* STDERR at all ti= mes.<br> <br> Is there a problem in closing stdin and stderr within a faxq child process?= =C2=A0And, if those statements are correct aren't they contradicted by= operations (closing of stdin and stderr) within faxQueueApp::sendStart and= perhaps for a microsecond within faxQueueApp::runConverter?<br> <br> Thanks,<br> <br> Lee.<br> <br> <br> ____________________ HylaFAX(tm) Developers Mailing List __________________= __<br> =C2=A0To subscribe/unsubscribe, click <a href=3D"http://lists.hylafax.org/c= gi-bin/lsg2.cgi" target=3D"_blank">http://lists.hylafax.org/cgi-<u></u>bin/= lsg2.cgi</a><br> On UNIX: mail -s unsubscribe <a href=3D"mailto:hylafax-devel-request@hylafa= x.org" target=3D"_blank">hylafax-devel-request@hylafax.<u></u>org</a> < = /dev/null<br> <br> </blockquote></div><br> </div> --e89a8f2354f9c23df504d1186651-- ____________________ HylaFAX(tm) Developers Mailing List ____________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe [email protected] < /dev/null