Thursday, February 3, 2011

What to do if bash scripts come with an incorrect interpreter path?

I'm trying to install BugZilla on our server. The issue is that perl scripts of BugZilla define the path as /usr/bin/perl, and my perl installation is located at /usr/local/bin/perl.

I've had this issue while installing other applications as well, i had to manually edit the interpreter paths.

How do you handle situations like these?

EDIT: I just noticed we've got two copies of perl on the server, one in the standard location, on in /usr/local/bin/perl, but which perl returns the former path.

Btw, here's the error I get when I run bugzilla's perl script

bash: ./checksetup.pl: /usr/bin/perl: bad interpreter: Permission denied
  • You can create a soft link using ln that links /usr/bin/perl to /usr/local/bin/perl

    ln -s /usr/local/bin/perl /usr/bin/perl
    
    gAMBOOKa : ln: `/usr/bin/perl`: File exists ... what now?! seems like there are two copies of perl, but `which perl` returns /usr/local/bin/perl
    Iain : Check the permissions on `/usr/bin/perl` are 755. If they are not then make them so with `chmod 755 /usr/bin/perl`. To find out whicn of your perl installations is being used check the shebang line at the top of the script.
    Raphink : @gAMBOOKa: the fact that `which perl` returns /usr/local/bin/perl is quite normal if you have a Perl installation there. /usr/local/bin usually overrides /usr/bin in the PATH. However, what matters to launch your scripts is the shebang in the script. Note that if the shebang had been `#!/usr/bin/env perl`, it would have pointed to /usr/local/bin/perl since it would have used your PATH. Now you can check the perms like @lain suggested, to check why /usr/bin/perl won't execute.
    From Iain

0 comments:

Post a Comment