http://www.perlmonks.org?node_id=801698

GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:

Howdy
I rebuilt my main machine recently, leaving my file server in tact. Now, when I run scripts stored on the file server (accessed through NFS) I get the dreaded "bad inerpreter: Permission Denied" error from bash. The shebang line is fine, and they run fine when copied over locally. As such, Perl is installed just fine on the non-file server machine (and the file server for that matter). What blatant error am I missing?

Replies are listed 'Best First'.
Re: bad interpretor error when running scripts off an NFS share
by GrandFather (Saint) on Oct 17, 2009 at 07:55 UTC

    Check for bad line end characters on the shebang line. A new line character (lf) is expected - a carriage return (cr) or cr/lf pair will cause grief of the nature you describe.


    True laziness is hard work
      Yeah, checked that first. I think copying the file to the machine locally and running it without a hitch is also confirmation that that is not the problem.

        Maybe the NFS share is mounted as "noexec"? (I think that would produce the exact error you're getting, whereas some trailing junk char(s) in the shebang line would rather produce "... No such file or directory").

        What does mount show for the share in question?

        Some ideas to try

        • compare the hex dumps (od -x, hd, xxd, ...) of the first few lines. On the file server locally, "copied" version (how did you copy it?) and accessed-via-nfs.
        • implicit conversion might also be part of the mount options. What OS is the server, what is the client?
        • strace -o log -e file SCRIPTNAME # what files are accessed?
        • strace -o log -e file perl ./SCRIPTNAME # (use cat -vet when viewing the log)

        cu
        Peter