Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Links 2.0 Installation Woes (500 ISEs, etc)

Quote Reply
Links 2.0 Installation Woes (500 ISEs, etc)
Greetings all,

I am attempting to install Links 2.0 on a Solaris 8 box running Apache and am having no luck. I have followed all of the instructions in the Readme file, but I'm apparently missing something.

I have changed the shbang line to my local perl instance.
I have changed all the permissions as recommended.

When I attempt to access the CGI, I get the requisite 500 Internal Server Error. My apache logs reveal:

[Thu Jun 14 13:51:53 2001] [error] (2)No such file or directory: exec of /home/meri/html/covert-ops/cgi/links/admin/admin.cgi failed
[Thu Jun 14 13:51:53 2001] [error] [client 207.96.89.34] Premature end of script headers: /home/meri/html/covert-ops/cgi/links/admin/admin.cgi

However, I assure you that the script *is* there:
-rwxr-xr-x 1 meri users 6007 Jun 14 13:51 /home/meri/html/covert-ops/cgi/links/admin/admin.cgi

Also, when I try to run the script from the command line, I get:

[meri@filament ~/html/covert-ops/cgi/links/admin]$ ./admin.cgi
bash: ./admin.cgi: No such file or directory

I'd appreciate any help that folks could offer. I've been beating my head on this for a couple of days, and have stumped myself and a couple of friends. I look forward to your assistance.

Mary

Quote Reply
Re: Links 2.0 Installation Woes (500 ISEs, etc) In reply to
I found what the problem was. admin.cgi. All of the files in the original .zip file contain DOS-style CR/LF, so in UNIX, all the files contains ^Ms at the end of each line.

Before someone jumps on me and tells me I failed to upload the files correctly, I would like to point out that this file never landed on a DOS machine. It was downloaded directly from the download site to the UNIX host. I missed it because the editor I use (vim) was masking the ^Ms.

I hope this helps someone else out. It took me two days of beating my head on my desk to find it. (And in the end, another friend found it.)

Quote Reply
Re: [meri] Links 2.0 Installation Woes (500 ISEs, etc) In reply to
I ran into the same problem, those damned ^Ms in the .zip file. Like meri, I downloaded it straight to Unix (Linux, in this case), so it never touched a dos machine. I was getting the following in my apache error logs:

[Thu Jan 24 17:57:01 2002] [error] (2)No such file or directory: exec of /<path_deleted>/WWW/links2/cgi-bin/admin/admin.cgi failed
[Thu Jan 24 17:57:01 2002] [error] [client <ip deleted>] Premature end of script headers: /<path_deleted>/WWW/links2/cgi-bin/admin/admin.cgi


If you want to remove those control characters, try the following script (but see the notes at the end). I've also included it as an attachment, which may retain the control characters better than a cut-and-paste from a browser.


Code:
#!/bin/bash


if ! test $1; then
echo "Usage: $0 <directory or file>"
exit 1;
fi

DIR=$1
TMP_EXTENSION=_rm_CTRL-M.tmp
TMP_FILENAME=nothing_for_now

for NAME in `find $DIR -print`; do
# Don't process directories or links to files
# This *will not* exclude files in directories
# that have been included
# in the tree by the find command
if ( !(test -d $NAME) && !(test -h $NAME) ); then
echo $NAME
TMP_FILENAME="$NAME""$TMP_EXTENSION"

# remove the ^M's from the file, copying to temp file
sed s/^M// $NAME > $TMP_FILENAME

# make sure we keep the same permissions and owners
chmod --reference=$NAME $TMP_FILENAME
chown --reference=$NAME $TMP_FILENAME

# now overwrite the old one...
mv $TMP_FILENAME $NAME
fi
done;

One caveat: don't run this script on itself, as that will remove the ^M from the sed command, and the next time you run it it will simply erase all of your files! Making it read-only removes this worry...

Also, you may have to edit the script to actually get the ^M in the file, as a copy and paste from a browser may not do the trick. If you *do* need to do this, then edit the file using vi and look for the sed command. replace the ^M with a "real" control-M, by using ^V^M (i.e. control-V then press control-M) to insert the control character ^M. I'm not sure how to do it with other editors, but I'm sure it is similar.

And of course, none of this comes with any warranty or anything else...use at your own risk!!
Quote Reply
Re: [bcgeorge] Links 2.0 Installation Woes (500 ISEs, etc) In reply to
oops, there is a typo in that script, above...the sed line should read:

sed s/^M//g $NAME > $TMP_FILENAME

The only difference is the g at the end of the sed expression.

Also, check out:

http://www.unixreview.com/...2/urm0108e/0108e.htm

They discuss exactly this issue.