|
|
#1 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Problem with Path /usr/local/bin in xterm
I have set up Apple's x11 on my home and office machines. They are set up almost identically (same ~/.xinitrc files, but the problem one had only the most recent Fink's system-xfree86 added and the other had the prior one as well). On the latter everything works perfectly and on the former I have the following strange problem:
The xterm window which is set to open in my ~/.xinitrc file does not have /usr/local/bin in its path (found via the command echo $path). My ~/.xinitrc file is just copied from the file /user/x11r6/lib/x11/xinit/xinitrc file (it used to be more complicated, but I wanted everything to be as 'stock' as possible for this post). When I applied the original system-xfree86 update available after Apple's x11 v.3 came out, it mentioned something about making some repairs. I did not see that message with the application of the latest system-xfree86 (-11) on the machine which received only this version. This is the same machine exhibiting this problem. Another strange problem which exists on both: Any xterm window opened via xterm -ls opens and then immediately closes. Any ideas? |
|
|
|
|
|
#2 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Not quite...
I just checked now that I got home. The path
/usr/local/bin is not in the path for either xterm. For some reason, the nano I installed manually on each is in /usr/x11r6/bin on one and in /usr/local/bin on the other. How do I add /usr/local/bin to the path for xterm? Thanks. I still have the problem with xterm -ls. |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
i think your problem is two-fold.
if xterm -ls errors, i suspect that your ~/.login does something that causes an exit. in this thread is how to augment your path variable: http://forums.macosxhints.com/showth...threadid=10219
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#4 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Thank you on both counts.
1) I added the path from the information in that link. 2) Taking a line out of my ~/.login file cured the -ls problem. Over time, I'll investigate what problems that line caused. Thanks again. |
|
|
|
|
|
#5 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
yer welcome.
show us the line! so everyone can benefit from your foibles
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#6 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
The only line of the former ~.login file was:
Code:
bin/morning Code:
#!/bin/tsch
cal
date "+Today is %A, %B %d, %Y. It's %I:%M:%S %p.%n"
echo "Calendar:"
calendar -l 7
calendar -l 0 -f bin/calendarother
Typical output was Last login: Fri Mar 21 19:15:47 on ttyp1 Welcome to Darwin! March 2003 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Today is Friday, March 21, 2003. It's 07:16:03 PM. Calendar: 21 * **Pay Murray Electrical bill. 30 * **Pay rent! 3/26 ***Allison's Birthday 3/28 ***Jenni's Birthday 03/21 J.S. Bach born, 1685 03/22 Ten Years After plays their last concert, 1974 It did not cause any problems with the Apple X11 0.1 or 0.2. I thought I'd take out the lines of bin/morning one at a time and see which caused the problem....but if someone sees a problem.... ;-) Ed Last edited by macmath; 03-21-2003 at 08:21 PM. |
|
|
|
|
|
#7 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
well, the reference
bin/morning isn't really a good command where is bin ? i mean, to the shell? please use full, or relative path names to commands. is morning in your home bin dir? then: ~/bin/morning and in your scripts, use full path to the commands... /usr/bin/cal /bin/date /usr/bin/calendar make it unambiguous what you are referencing echo is a shell builtin, so you don't need to reference /bin/echo unless you want to use its features
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#8 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
I did not realize that I was being so sloppy...I'll write in full paths in the future.
However, it still does not work quite right. Even with full paths xterm -ls only works with every other window. Typing /usr/bin/cal directly into the ~/.login file (instead of the ~/bin/morning) has the same problem that xterm -ls results in an xterm window which is created briefly and then disappears. Is it this way for you too? |
|
|
|
|
|
#9 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
hmm, well, i don't have your config, so i won't be able to test.
but break it down into its elements. what does cal do on the command line of an xterm? start with the fundamental elements on the command line. if they work, they should be able to be scripted.
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#10 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
cal
and /usr/bin/cal both result in the appropriate calendar for March each time I tried (4 times in two different xterm windows). Does there have to be anything in ~/.login besides the commands? Like #!/bin/tsch ? |
|
|
|
|
|
#11 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
no, the shell startup files are 'sourced' (read loaded by reading and processing the lines) rather than executed via a subshell.
i would wonder if your .login has some squirrely chars in it. how do you edit it? what does: % cat -vet ~/.login show? lines should end with a $ and anything else is squirrely
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#12 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
I edit it with nano.
The result of cat -vet ~/.login is Code:
/usr/bin/cal$ setenv PATH /usr/local/bin:$PATH$ [Jaguar:~] us% |
|
|
|
|
|
#13 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
keep digging. what about the remaining shell startup files.
.cshrc .tcshrc what do they contain/call?
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#14 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
I don't have a ~/.tcshrc file, but my ~/.cshrc file has about 25 lines, either aliases or things like 'set complete=enhance'. My ~/.Xdefaults file contains about 15 lines or so (giving it color, making the delete key work, getting a scroll bar, and setting a default editor to go with xdvi).
To make matters simpler, I gave these files other names and created empty files with the names ~/.cshrc and ~/.Xdefaults. I also removed my ~/.xinitrc file. Now everything should be basic Apple, except ~/.login has the line /usr/bin/cal in it. When X11 starts, an xterm comes up. A) If customize "Terminal" in the Applications menu for X11 to be 'xterm -ls', then I can open a few more xterm windows through this menu, but most of the subseqent attempts result in xterm windows which immediately close. Moreover, these xterm windows which do stay open give the following response to 'echo $PATH': [lebesgue:~] us% echo $PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/bin with /usr/x11r6/bin is missing, just as it would be in Terminal.app B) If I have an empty ~/.login file, but open an new xterm with xterm -ls, I get the same response to 'echo $PATH' : [lebesgue:~] us% echo $PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/bin with /usr/x11r6/bin is missing, but I can open as many xterm windows as I have the patience to do. C) However, if I leave 'Terminal' in the Applications menu as just 'xterm', I can open as many xterm windows as I have patience to do so. Moreover, the response to 'echo $PATH/ is [lebesgue:~] us% echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/Users/us:/usr/X11R6/bin The same behavior occurs if I go to new user's account that has never run x11 before. So it seems that 1) Calling on /usr/bin/cal in the ~/.login file, causes problems with xterm windows (called via xterm -ls). 2) Obtaining an xterm window via xterm -ls screws up the paths by losing /usr/x11r6/bin. For now, I guess I will avoid using xterm -ls and have any commands I want in ~/.cshrc or in ~/.xinitrc. Questions: I) What files in ~/ does X11 read upon opening besides ~/.cshrc and ~/.tcshrc? 2) Why would one have both a ~/.tcshrc file and a ~/.cshrc file? Thanks for your help. |
|
|
|
|
|
#15 | |||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
At the x11-users mailing lists there have been several reports of problems with xterm since the release of v0.3. For example, xterm crashed for some users when trying to execute a file that wasn't available to them (either in their path in that xterm or just not installed) Other users reported crashes when they did something that requires the screen to scroll, like running "ps -aux" or "setenv". I believe that it's something in the configuration files that are the problem - which cause xterm to load and then crash. When you start Apple's X11, it runs a system-wide script to start a few clients: /etc/X11/xinit/xinitrc By default, this script checks whether you have a .xinitrc in your home directory and executes that if you do. Otherwise, it starts a single xterm with a plain, not login, shell, so it only reads ~/.cshrc, not ~/.login and the quartz-wm window manager. Your changes probably belong in your ~/.cshrc file, rather than your ~/.login. ~/.cshrc is sourced by all shells when they start, but ~/.login is sourced only by login shells. Terminal.app starts login shells, xterm does not, although as you know, it can be made to do so by giving it the -ls option. So, if you call "xterm -ls" it will read your empty ~/.login file and the PATH for /usr/x11r6/bin is not set. Well, I don't believe what I wrote will help much... |
|||||||||||||||||||
|
|
|
|
|
#16 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
It does help:
1) I now know that when forced to read ~/.login, the xterm is now basically a tsch shell as in Terminal.app, rather than an x11 shell. 2) There seems to be support for the idea that xterm under Apple X11 0.3 is a little fragile and the window crashing which I note (when I call xterm -ls and ~/.login has a call to a command in it) has to do with X11 0.3 and not with my settings. 3) And I think I now get the idea that a 'login shell' is just a shell in your default variety (tcsh for me). That is, there are a lot of shells (zsh, bash, tcsh, etc.), and which ever one is your default is called your login shell. I hear a lot of terms over time, and some of them seem (to me) to have no definition (like the word 'the' in the English language), but are learned by me from context when I have enough context to grasp them. This discussion has helped me with shells and paths. Every time after I am involved on this end of a discussion like this, and I go back and read my earlier posts, I realize how naive those original posts were. Fortunately, this forum is populated by teachers like myself who appreciate their students' interest and don't let on the degree to which they are aware of their students' current shortcomings. Luckily, they are also pretty easy-going when the students could have figured the answers out themselves with a little more diligent digging on their own. Thanks mervTormel and sao. [Edited to point out that I was not giving myself credit as a teacher within this forum. I was pointing out that the people who populate this forum are teachers within this board in the same way that I am a teacher in real life. (Not that this forum is not real life.) :-) ] Last edited by macmath; 03-22-2003 at 02:49 PM. |
|
|
|
|
|
#17 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
macmath,
a teacher need only be one lesson ahead of the student. i often don't know a lot of the topics of the help requests, but i know how to find out. and i often do. -- the login shell means that it is a) interactive and b) runs the login script there are several shell profiles: login, subshell, restricted, non-interactive a login shell has a shell level of one: $ echo $SHLVL 1 a subshell has a shell level greater than one: $ sh $ echo $SHLVL 2 a non-interactive shell is akin to a remote login that runs a command via rsh or some other shell process without keyboard input and screen output (think of cron's maint tasks; they are local non-interactive logins) default xterm is a subshell, and doesn't run the shell login process. here's a new xterm and the shlvl is 2 from the get go, which means there is a shlvl 1 represented in the parent process xterm: Code:
merv@gunther:merv (2)$ ps al | colrm 18 56
UID PID PPID TT TIME COMMAND
501 5975 5941 p1 0:01.25 -bash (bash)
501 6095 5941 p2 0:01.60 -bash (bash)
501 6198 6095 p2 0:00.07 sh
501 6283 6282 std 0:00.45 bash
0 6315 6283 std 0:00.00 ps al
501 6316 6283 std 0:00.00 colrm 18 56
merv@gunther:merv (2)$ echo $$
6283
merv@gunther:merv (2)$ ps lp 6282 | colrm 18 56
UID PID PPID TT TIME COMMAND
501 6282 1 ?? 0:00.41 xterm
wrapping your mind around this is key to grokking shell issues like you're experiencing.
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#18 |
|
MVP
Join Date: Mar 2002
Location: Elsewhere
Posts: 1,497
|
Thank you.
That helps set me straight and helps me interpret later issues. Part of helping yourself involves being able to interpret the wording of the man pages, and this will help in that regard. |
|
|
|
![]() |
|
|