… | |
… | |
196 | package Urlader; |
196 | package Urlader; |
197 | |
197 | |
198 | use common::sense; |
198 | use common::sense; |
199 | |
199 | |
200 | BEGIN { |
200 | BEGIN { |
201 | our $VERSION = '0.2'; |
201 | our $VERSION = '1.0'; |
202 | |
202 | |
203 | use XSLoader; |
203 | use XSLoader; |
204 | XSLoader::load __PACKAGE__, $VERSION; |
204 | XSLoader::load __PACKAGE__, $VERSION; |
205 | } |
205 | } |
206 | |
206 | |
… | |
… | |
254 | will be created if necessary). If C<$exclusive> is true, then it tries to |
254 | will be created if necessary). If C<$exclusive> is true, then it tries to |
255 | acquire an exclusive lock, otherwise the lock will be shared. If C<$wait> |
255 | acquire an exclusive lock, otherwise the lock will be shared. If C<$wait> |
256 | is true, then it will wait until the lock can be acquired, otherwise it |
256 | is true, then it will wait until the lock can be acquired, otherwise it |
257 | only attempts to acquire it and returns immediately if it can't. |
257 | only attempts to acquire it and returns immediately if it can't. |
258 | |
258 | |
259 | If successful it returns a lock object - the lock will be given up |
259 | If successful it returns a lock object - the lock will be given up when |
260 | when the lock object is destroyed. |
260 | the lock object is destroyed or when the process exits (even on a crash) |
|
|
261 | and has a good chance of working on network drives as well. |
261 | |
262 | |
262 | If the lock could not be acquired, C<undef> is returned. |
263 | If the lock could not be acquired, C<undef> is returned. |
263 | |
264 | |
264 | This function will probably go awway in the future, but is provided to |
265 | This function is provided to assist applications that want to clean up old |
265 | assist applications that want to clean up old versions, see "TIPS AND |
266 | versions, see "TIPS AND TRICKS", below. |
266 | TRICKS", below. |
|
|
267 | |
267 | |
268 | =cut |
268 | =cut |
269 | |
269 | |
270 | 1; |
270 | 1; |
271 | |
271 | |
… | |
… | |
346 | |
346 | |
347 | These can be found at |
347 | These can be found at |
348 | L<http://cvs.schmorp.de/deliantra/Deliantra-Client/util/>, but looking at |
348 | L<http://cvs.schmorp.de/deliantra/Deliantra-Client/util/>, but looking at |
349 | them can lead to premature blindless. |
349 | them can lead to premature blindless. |
350 | |
350 | |
|
|
351 | =item Shared Libraries |
|
|
352 | |
|
|
353 | It is often desirable to package shared libraries - for example the |
|
|
354 | Deliantra client packages SD>, Berkely DB, Pango and amny other libraries |
|
|
355 | that are unlikely to be available on the target system. |
|
|
356 | |
|
|
357 | This usually requires some fiddling (see below), and additionally some |
|
|
358 | environment variables to be set. |
|
|
359 | |
|
|
360 | For example, on ELF systems you usually want F<LD_LIBRARY_PATH=.> and on |
|
|
361 | OS X, you want F<DYLD_LIBRARY_PATH=.> (these are effectively the default |
|
|
362 | on windows). |
|
|
363 | |
|
|
364 | These can most easily be specified when building the packfile: |
|
|
365 | |
|
|
366 | urlader-util ... LD_LIBRARY_PATH=. ./perl run |
|
|
367 | |
|
|
368 | =item Portability: RPATH |
|
|
369 | |
|
|
370 | Often F<perl> is linked against a shared F<libperl.so> - and might be so |
|
|
371 | using an rpath. Perl extensikns likewise might use an rpath, which means |
|
|
372 | the binary will mostly ignore LD_LIBRARY_PATH, which leads to trouble. |
|
|
373 | |
|
|
374 | There is an utility called F<chrpath>, whose F<-d> option can remove the |
|
|
375 | rpath from binaries, shared library and shared objects. |
|
|
376 | |
|
|
377 | =item Portability: OS X DLL HELL |
|
|
378 | |
|
|
379 | OS X has the most severe form of DLL hell I have seen - if you link |
|
|
380 | against system libraries, which is practically unavoidable, you get |
|
|
381 | libraries of well-known names (e.g. libjpeg) that have nothing to do with |
|
|
382 | what you normally expect libjpeg to be, and there is no way to get your |
|
|
383 | version of libjpeg into your program. |
|
|
384 | |
|
|
385 | Moreover, even if apple ships well-known libraries (e.g. libiconv), they |
|
|
386 | often ship patched versions which have a different ABI or even API then |
|
|
387 | the real releases. |
|
|
388 | |
|
|
389 | The only way aorund this I found was to change all library names |
|
|
390 | in my releases (libjpeg.dylib becomes libdeliantra-jpeg.dylin and |
|
|
391 | so on), by patching the paths in the share dlibraries and shared |
|
|
392 | objects. F<install-name-tool> (with F<-id> and F<-change>) works in many |
|
|
393 | cases, but often paths are embedded indirectly, so you might have to use a |
|
|
394 | I<dirty> string replacement. |
|
|
395 | |
351 | =back |
396 | =back |
|
|
397 | |
|
|
398 | =head1 SECURITY CONSIDERATIONS |
|
|
399 | |
|
|
400 | The urlader executable itself does not support setuig/setgid operation, or |
|
|
401 | running with elevated privileges - it does no input sanitisation, and is |
|
|
402 | trivially exploitable. |
352 | |
403 | |
353 | =head1 AUTHOR |
404 | =head1 AUTHOR |
354 | |
405 | |
355 | Marc Lehmann <schmorp@schmorp.de> |
406 | Marc Lehmann <schmorp@schmorp.de> |
356 | http://home.schmorp.de/ |
407 | http://home.schmorp.de/ |