Index: [thread] [date] [author] [stats]
  From: Sebastian M. Alvarez <sebastianmalvarez@gmail.com>
  To  : markus schnalke <meillo@marmaro.de>
  Date: Wed, 22 Feb 2012 16:34:16 -0300

Re: [masqmail] Debugging pipe calls

> You can wrap some script around, that redirects the output to a file.
> Something of this kind:
> 
> 	#!/bin/sh
> 	php Hermes.php >>/tmp/foo 2>&1
> 
> Now invoke this script from masqmail.
> 
> 
> I also took a look into the code. Masqmail does *not* give the pipe
> command line directly to `sh -c', but splits it at whitespace and does
> an execve() then. For your pipe command:
> 
> 	pipe="/usr/bin/php /home/ubuntu/Olapic/olapic/Hermes.php
> 			--execute EmailUploader &> /tmp/emailjob"
> 
> This means, that the stdout/stderr redirection `&>' will not be
> carried out, but is given as 4th argument to php.
> 
> Solution: Put that command line into a small script and execute that
> one. That should work.

That worked :)

Also, FYI, it seems important that the script (hermes.php in this case) returns 0 when done. 
exit(0); in my case.. If you dont do that, masqmail understands as the pipe didnt work (which is a feature, not a bug)

> The reason, why masqmail does not execute the command line with `sh
> -c' seems to be security related. Oliver (oku) had added this command
> line splitting later into the peopen snippet he'd found on
> sourceforge. The original code's still there. See src/peopen.c for
> details.
> 
> I'm not convinced that this is the right choice. If the user want's
> this command executed this way, why not do exactly that. If quoting is
> used to conceil whitespace within an argument, it would be broken up.
> Hmm...
> 
> (btw: Although not relevant here, some general advice: Such commands
> are often executed by /bin/sh, be sure your /bin/sh does recognize
> constructs like `&>'. I think dash does not, and Ubuntu for instance
> has dash as /bin/sh.)

That's true.. If your running piped, I guess you know what you are doing, so why not just pipe to what I'm saying? :P

Anyway, my problem is solved.. Thanks!

> meillo
> 
> 
>>> P.S.
>>>> Córdoba, Argentina
>>> 
>>> Saludos a Argentina. :-) Cuanto calor tienen en Cordoba hoy? Y sabes
>>> lo de Santiago del Estero tambien?
>> 
>> Hey! Hablas español!?
> 
> Si, un poco. :-)
> 
>> Vinimos con unos dias de mucho calor, pero ahora esta lindo :)
>> En córdoba esta lindo, 26º C...
>> Santiago del estero 27
> 
> Que lindo. Tenemos -10 C en las noches aqui en Alemania.

Daría lo que fuera por un poco de invierno. El invierno de aca, lo pasé en New York (Verano) y cuando volví a Argentina, el verano empezó de vuelta. 2 Summers in a row :( (prefiero el invierno)

> 
>> Sos de Santiago?
> 
> No, pero fue en Santiago por tres meses, un ano pasado, entre Octubre
> y Deciembre 2010. Se han dicho, que hay *mucho* calor en Enero y
> Febrero en Santiago: mas de 50 C en 2009.


Que buenisimo!! Which are the odds?

If you come back you have a couch and free beer in Córdoba :)

---
Sebastian M. Alvarez
Córdoba, Argentina
http://aseba.com.ar


Index: [thread] [date] [author] [stats]