aMule Forum

English => Compilation problems => Topic started by: Nodsu on December 20, 2007, 08:32:57 PM

Title: Unportable perl invocation
Post by: Nodsu on December 20, 2007, 08:32:57 PM
file_generator.pl uses a hashbang line that assumes perl executable in /usr/bin. This is not very portable.
A nicer approach would be to use "#!/usr/bin/env perl"
Title: Re: Unportable perl invocation
Post by: lfroen on December 23, 2007, 03:38:46 PM
And why is that better, can you tell?
Title: Re: Unportable perl invocation
Post by: skolnick on December 23, 2007, 07:35:40 PM
Nodsu, could you please tell us which platform does /usr/bin/perl not work? I have only access to linux and solaris, and both approaches would work equally well on both, so I fail to see the difference,just like lfroen pointed. Is there some standard saying that env will always be in /usr/bin?

Regards.
Title: Re: Unportable perl invocation
Post by: Nodsu on December 25, 2007, 05:37:51 PM
FreeBSD and NetBSD for example put their packages in /usr/local and /usr/pkg. Also, it will be /usr/local/bin/perl in any unix OS where you have to build Perl manually. And we can imagine a system where a user wants to use her own Perl installation (in /home or wherever) opposed to the systemwide perl (in /usr/bin).

As for why the env command is better, it executes perl according to the PATH variable instead of a hardcoded path. Env is POSIX, so it shold be present in every decent unix OS.
Title: Re: Unportable perl invocation
Post by: Vollstrecker on December 25, 2007, 05:52:33 PM
Beside the fact that you can't state that env will always be found in /usr/bin (at least after your statement about the users own perl) there would be the only way to use an option in configure and invoke the script with ${perl-location} script.pl. If that is what you want, what's next? sed, awk or one the many other tools amule's configure-script  uses to work?
Title: Re: Unportable perl invocation
Post by: Nodsu on December 26, 2007, 01:48:22 PM
Yes indeed, a proper configure script should check for all dependencies and caution the user when they are not found.

This perl thing is a real world issue I ran into. sed and awk are a bit far fetched. sed and env are POSIX and already included in every decent unix and located in /usr/bin. Configure already checks for awk location (your fault if you are not using the configure-provided location).
Title: Re: Unportable perl invocation
Post by: skolnick on December 27, 2007, 12:59:32 AM
Yes indeed, a proper configure script should check for all dependencies and caution the user when they are not found.

This perl thing is a real world issue I ran into. sed and awk are a bit far fetched. sed and env are POSIX and already included in every decent unix and located in /usr/bin. Configure already checks for awk location (your fault if you are not using the configure-provided location).
sed is an issue in solaris (for example) because aMule requires GNU sed to compile properly, the POSIX one included with solaris will not work. It's the same for the shell in soe scripts, where bash is required, and the /bin/sh in solaris will not work.

Regards.