LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-25-2010, 05:00 PM   #1
DonnieDarko
LQ Newbie
 
Registered: Jul 2010
Location: Tangent Universe
Distribution: Mac OS 10.6, iTerm, X11, Terminal
Posts: 4

Rep: Reputation: 0
Installed Program Won't Run Because It Can't Find .dat in Share (Is There)


I am going through a Unix tutorial. I am running iTerm under Mac OS 10.6.5 and Darwin 10.0. I installed the program Units 1.7.4 in order to perform an example problem. The difficulty is that when I go to the /bin folder to run the program it says it can't find the .dat file in the /share folder. This can't be true because the .dat file is there. At first I thought the problem was that the .dat file had identified itself as a VLC file, but I went into BBEDIT and without making any changes to the file I saved it as a standard .dat file. Even after doing this, when I try to run the program out of the /bin folder using the command prompt to run the program ./units iTerm tells me it can't find the .dat file in share. I switched from bash shell to zsh shell to do the tutorial because I heard zsh is better, and I don't know if that could be the problem. I doubt it though. The only thing I didn't do for the install was su root before doing the install. Could this be the problem? I am really confused. My hope is that this source code is just outdated like the tutorial, but my worry is that this might happen when I install future source code. I am trying to learn Unix so I can use John the Ripper, and I'd hate to go through all the trouble of learning if none of my source installs work. Any help would be greatly appreciated. Thanks.

The exact error message is this:
units: can't find units file '/units174/share/units.dat'
 
Old 07-25-2010, 05:25 PM   #2
Brains
Member
 
Registered: Apr 2009
Distribution: Debian testing
Posts: 258

Rep: Reputation: 42
Take a look at the permissions of the units script with command: ls -l units.sh using the correct full name of the script as I'm only guessing it ends in .sh. An example of a script that can be run as a user may look similar to: -rwxrwxrwx 1 user ..etc. where the second set of "rwx" tells you the user can read, write and execute the script. If there is no "x" in the second set, a user cannot execute it. You can try changing permissions of the script so a user can execute it with a command similar to: chmod a+x nameofscript as root which will allow anyone to execute it, but if it is designed to be run as root it probably still won't work properly when executed as a user. The first set of "rwx" applies to root, the last applies to other users.

For my Mac OS X 10.5, to switch over to root requires command: sudo -s

Last edited by Brains; 07-25-2010 at 05:29 PM.
 
0 members found this post helpful.
Old 07-25-2010, 05:36 PM   #3
DonnieDarko
LQ Newbie
 
Registered: Jul 2010
Location: Tangent Universe
Distribution: Mac OS 10.6, iTerm, X11, Terminal
Posts: 4

Original Poster
Rep: Reputation: 0
I Did Find A Workaround...

I just learned how to set paths, and when I set a path I could get the program to run, and also I permanently enabled the program by editing the .cshrc file in bbedit with the path to the file. I definitely will try what you said though - because I think there is something wrong with the permissions on my Mac if it can't be run without paths.
 
Old 07-25-2010, 05:45 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
First of all, stay out of the /bin/ or /usr/bin/ directory. Run the program from your home directory. The program should be in your path. If not, add the location of the program to your PATH variable. When referring to a project you are downloading & building, please include a link to the project page. Unit is too general for me to find a Unit project in a google search.

Quote:
units: can't find units file '/units174/share/units.dat'
This doesn't look right. Are you sure it wasn't looking for ".//units174/share/units.dat"? Installing the program shouldn't be creating a new directory on your root filesystem.

For binary programs, if you have the "strace" program, run "strace /bin/units 2>units.strace". It will print out lines such as:
Code:
stat("/usr/local/share/texmf/fonts/opentype", 0x7fff10f8fdd0) = -1 ENOENT (No such file or directory)
The open() or stat commands() will have the path and filename expected.

However, if you have the source code, you could grep for the .dat file.

----

It is common to have more work when just starting to build programs. After a while, the most common dependencies are taken care of from previous project builds. Also, if the mac is configured to use other directories than used by default, you may need to change certain directories when you configure. see "./configure --help" for projects built using "./configure && make && make install".

Sometimes a project will use /usr/local/ for the base of the directory hierarchy. You may need to add /usr/local/bin/ to your PATH variable and /usr/local/lib to your systems library search path. Using /usr/local will prevent overwriting a system program or library and shouldn't be touched on a unix system if upgrading the system.

----
note: I'm assuming that strace is used on a mac. It should be.

Good Luck!

Last edited by jschiwal; 07-25-2010 at 06:02 PM.
 
1 members found this post helpful.
Old 07-25-2010, 05:50 PM   #5
DonnieDarko
LQ Newbie
 
Registered: Jul 2010
Location: Tangent Universe
Distribution: Mac OS 10.6, iTerm, X11, Terminal
Posts: 4

Original Poster
Rep: Reputation: 0
I tried to ls -l the file under the name units.sh and it didn't work, but it did allow me to use ls -l units without the .sh at the end...the print shows the permissions are enabled with the exception of the last two w's:
-rwxr-xr-x
When I did sudo -s to switch to root and tried again typing ./units still didn't find the data file in /share...
Basically the only method I have found so far that works is to create a path.
Also...I don't know if this belongs in a separate post, but when I opened the .cshrc file in BBEDIT to add items like set history = 200 and the units path there was nothing in the text file. Is it supposed to be empty when you first start editing it. I was under the impression that it should contain text...
 
Old 07-25-2010, 05:59 PM   #6
DonnieDarko
LQ Newbie
 
Registered: Jul 2010
Location: Tangent Universe
Distribution: Mac OS 10.6, iTerm, X11, Terminal
Posts: 4

Original Poster
Rep: Reputation: 0
@jschiwal

The README says Units it is a Beta Test of a program to do simple conversion like feet to meters. The link to the website is defunct. It appears to be by a former student at Cornell - maybe a project he worked on for a class? I put it in the user folder because the tutorial had me make a folder in there. I will definitely work out of a different directory in the future - thanks for the heads up. I appreciate the encouragement too...I am having a lot of fun learning this and I'm looking forward to trying out some compiling. I did find this in the README and wonder if it will help:
"If you give no options to configure, it will compile units to look for the units
data file in a standard location (probably /usr/local/share)"
 
Old 07-28-2010, 03:44 AM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
A simple project such as this may be using a Makefile instead of using autoconfig. Read through the makefile. It sounds like files are being saved in places the program can't find. You did mention .cshrc which isn't for the bash shell. If the program is a shell script, then look at the first line. If it says !#/bin/bash or !#/usr/bin/env bash, then it is a bash script. Which shell do you use? Is it csh or bash? The two shells set their variables differently, so setting the PATH variable in one config file, won't change it in the other. This could cause units.sh being found and executed in one shell and not the other.

The first line of a script will contain which interpreter (shell) is used to execute it. So you can use the csh or tcsh by default but still launch sh or bash scripts. If the script doesn't have this line, your current shell is used. If you use bash and the script is written for csh or ksh for example, then there will be a problem. Adding the "swish bang" line to the script will resolve this problem.

A program this simple, you could probably write yourself. It would be a good exercise in learning the getopts command to process the command arguments the same way a C program would.

Last edited by jschiwal; 07-28-2010 at 03:53 AM.
 
1 members found this post helpful.
  


Reply

Tags
sourcecode


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
Cannot find program I installed BigFoot13 Linux - Newbie 10 09-27-2006 05:17 PM
Help to run the PHP program I installed Gins Linux - General 7 09-09-2005 04:01 PM
installed new program but cant find it stumblefingers Linux - Newbie 5 05-11-2004 01:52 AM
how to run installed program ? Viper Slackware 9 10-11-2003 04:19 PM
How to find if a program is installed or not? concoran Linux - Newbie 4 08-22-2002 05:25 PM


All times are GMT -5. The time now is 02:05 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration