LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2011, 01:48 PM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Scripts need full path on shebang line; affects urxvt


Hello

A frequently used custom perl script used with urxvt stopped working. There is no logged change to the system shortly before it started happening.

The as-distributed urxvt perl scripts have #! perl; the long-working custom script had the same for consistency. Investigation showed test scripts now need a full path on the shebang line despite PATH including the interpreter's directory:
Code:
c@CW8:~/d/bin/try$ cat hello_world.pl 
#! perl
print "Hello World\n";
c@CW8:~/d/bin/try$ ./hello_world.pl.org 
bash: ./hello_world.pl.org: perl: bad interpreter: No such file or directory
c@CW8:~/d/bin/try$ cat hello_world.pl
#! /usr/bin/perl
print "Hello World\n";
c@CW8:~/d/bin/try$ ./hello_world.pl     
Hello World
c@CW8:~/d/bin/try$ type perl 
perl is /usr/bin/perl
c@CW8:~/d/bin/try$ ls -l /usr/bin/perl
lrwxrwxrwx 1 root root 10 Apr 30 22:48 /usr/bin/perl -> perl5.10.1
c@CW8:~/d/bin/try$ ls -l /usr/bin/perl5.10.1 
-rwxr-xr-x 1 root root 1402248 Oct  3  2009 /usr/bin/perl5.10.1
c@CW8:~/d/bin/try$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/lib64/java/bin
A bash hello_world.sh script behaved similarly. IDK if that is normal (I always use full paths in shebang lines); the execve (2) man page says "#! interpreter [arg] ... the interpreter must be a valid pathname".

As part of the investigation I had added logging to the custom urxvt perl script; no logs appeared. After changing its shebang line to a full path, logs appeared but paste from X-CLIPBOARD by Super+V still did not work or log. I changed all the perl scripts in /usr/lib64/urxvt/perl to full path shebang lines but Super+V still did not work



Best

Charles

Last edited by catkin; 04-30-2011 at 01:54 PM. Reason: clarity
 
Old 04-30-2011, 04:48 PM   #2
javpra
Member
 
Registered: Nov 2003
Distribution: FreeBSD/Gentoo/Debian
Posts: 52

Rep: Reputation: 19
Scripts need full path on shebang line; affects urxvt

Hello catkin,

It doesn't look like an issue with the first line of the script, but simply a typo. Your first line runs `cat` on a file called `hello_world.pl` and it returns the file. However, when you are trying to run the file you are using `./hello_world.pl.org` which doesn't look like it exists. Do an `ls` and make sure that `hello_world.pl.org` is there. So long as `perl` is in $PATH it should work. If that was not it let me know and we'll keep looking.
 
1 members found this post helpful.
Old 04-30-2011, 11:09 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks javpra

That was a typo in the post; I actually had hello_world.pl.org (org = original) with #! perl and hello_world.pl with #! /usr/bin/perl. For simplicity (ha! ) I posted as if the file had been modified. The behaviour was as described.

A Debian 6.0 Squeeze system shows the same behaviour (and this is verbatim!):
Code:
docmgt@CW8vDS:~/bin$ cat hello_world.sh 
#! bash
echo 'Hello World'
docmgt@CW8vDS:~/bin$ ./hello_world.sh 
-bash: ./hello_world.sh: bash: bad interpreter: No such file or directory
docmgt@CW8vDS:~/bin$ sed -i 's|bash|/bin/bash|' hello_world.sh 
docmgt@CW8vDS:~/bin$ cat hello_world.sh 
#! /bin/bash
echo 'Hello World'
docmgt@CW8vDS:~/bin$ ./hello_world.sh 
Hello World
So the behaviour is normal. Sorry for the red herring.

Presumably the full path to perl is not necessary in the urxvt perl scripts because urxvt does not rely on the shebang line.

I re-installed urxvt (and perl, for good measure) but urxvt Super+V (paste) functionality is still broken

Now this looks like a urxvt problem, I'll post in the urxvt mailing list.

Last edited by catkin; 04-30-2011 at 11:23 PM. Reason: too verbatim!
 
Old 05-02-2011, 11:48 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Solution posted in this LQ thread.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change the Urxvt to be full screen? corewar Linux - General 1 02-26-2011 11:30 AM
Init scripts shebang lincoln.runwal Linux - Newbie 1 03-25-2009 05:22 AM
Shell: tr can only be used when given full path (despite being in $PATH) chochem Programming 2 06-27-2008 08:37 AM
Where are the start up scripts for FC4? This affects mplayer moxieman99 Linux - Desktop 1 10-30-2006 05:00 AM
Linux won't recognize shebang line tjanzer Linux - General 2 03-15-2003 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration