Re: "Invalid argument" when exec'ing and/or ktrace'ing a file?

2019-05-24 Thread Stuart Henderson
There might be something else wrong with the build as well, but you're at
least likely to bump into this:

Webkit needs memory mappings which are both writable and executable.
OpenBSD denies these by default. Your wkhtmltopdf binary will need to be
linked using the -z wxneeded flag, and it will need to be placed on a
filesystem that has been mounted with the wxallowed flag.

It maybe simpler to adapt the perl code to the newer wkhtmltopdf, rather
than to figure out how to build their wkhtmltopdf the right way.


On 2019-05-24, Adam Thompson  wrote:
> I have a binary - built on this 6.5-STABLE amd64 system by an automatic 
> build process as part of a CPAN module installation, that will not 
> execute:
>
>> rt@rt$ /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf
>> ksh: /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf: 
>> Invalid argument
>
> or even allow itself to be ktrace'd:
>
>> rt@rt$ ktrace 
>> /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf
>> ktrace: exec of 
>> '/var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf' 
>> failed: Invalid argument
>
> At least ktrace(8) told me it was an exec(3) problem.  So off I go to 
> exec(3) which leads me to execve(2), wherein I see:
>
>> [EINVAL] argv did not contain at least one element.
>
> errno(2) confirms the english expansion of "Illegal argument"
>
> file(1) gives me a clue, but I don't know what to do with it:
>
>> rt@rt$ file `locate bin/wkhtmltopdf`
>> /usr/local/bin/wkhtmltopdf:   ELF 
>> 64-bit LSB shared object, x86-64, version 1
>> /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf: ELF 
>> 64-bit LSB executable, x86-64, version 1
>
> where the version in /usr/local/bin is from ports.
>
> the RT::Extension::TicketPDF version is significantly larger, ~4x, which 
> led me to:
>
>> rt@rt$ ldd `locate bin/wkhtmltopdf`
>> /usr/local/bin/wkhtmltopdf:
>> StartEnd  Type  Open Ref GrpRef Name
>> 041737f61000 04173ac77000 exe   20   0  
>> /usr/local/bin/wkhtmltopdf
>> 0419ee50 0419ee599000 rlib  01   0  
>> /usr/local/lib/libjpeg.so.70.0
>> [...elided...]
>> /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf:
>> not a dynamic executable
>
> So... how do I figure out why a static binary (whose build process is 
> pretty opaque) won't/can't run?
>
> Clueless at this level, my detailed knowledge of how exec worked under 
> OpenBSD ended in the a.out era.
>
> (oh, the reason I don't use the version from ports?  It's too new for 
> the TicketPDF code. *sigh*)
>
> Thanks for any pointers,
> -Adam
>
>



"Invalid argument" when exec'ing and/or ktrace'ing a file?

2019-05-24 Thread Adam Thompson
I have a binary - built on this 6.5-STABLE amd64 system by an automatic 
build process as part of a CPAN module installation, that will not 
execute:



rt@rt$ /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf
ksh: /var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf: 
Invalid argument


or even allow itself to be ktrace'd:

rt@rt$ ktrace 
/var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf
ktrace: exec of 
'/var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf' 
failed: Invalid argument


At least ktrace(8) told me it was an exec(3) problem.  So off I go to 
exec(3) which leads me to execve(2), wherein I see:



[EINVAL] argv did not contain at least one element.


errno(2) confirms the english expansion of "Illegal argument"

file(1) gives me a clue, but I don't know what to do with it:


rt@rt$ file `locate bin/wkhtmltopdf`
/usr/local/bin/wkhtmltopdf:   ELF 
64-bit LSB shared object, x86-64, version 1
/var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf: ELF 
64-bit LSB executable, x86-64, version 1


where the version in /usr/local/bin is from ports.

the RT::Extension::TicketPDF version is significantly larger, ~4x, which 
led me to:



rt@rt$ ldd `locate bin/wkhtmltopdf`
/usr/local/bin/wkhtmltopdf:
StartEnd  Type  Open Ref GrpRef Name
041737f61000 04173ac77000 exe   20   0  
/usr/local/bin/wkhtmltopdf
0419ee50 0419ee599000 rlib  01   0  
/usr/local/lib/libjpeg.so.70.0

[...elided...]
/var/www/rt/local/plugins/RT-Extension-TicketPDF/bin/wkhtmltopdf:
not a dynamic executable


So... how do I figure out why a static binary (whose build process is 
pretty opaque) won't/can't run?


Clueless at this level, my detailed knowledge of how exec worked under 
OpenBSD ended in the a.out era.


(oh, the reason I don't use the version from ports?  It's too new for 
the TicketPDF code. *sigh*)


Thanks for any pointers,
-Adam