Re: I'm embarassed. (Re: shell not reading login script)

2008-08-23 Thread Joel Rees

On 平成 20/08/22, at 19:21, Philip Guenther wrote:


2008/8/21 Joel Rees [EMAIL PROTECTED]:

On 平成 20/08/21, at 12:12, Philip Guenther wrote:


2008/8/20 Joel Rees [EMAIL PROTECTED]:


export PROFMARKER=.profile


would you believe I put that in .profile, like the marker said?

...etc

Now that you've said it, yes, I do.  If you think it unreasonable to
not assume that from your first message, then you haven't followed
enough QA exchanges on mailing lists.




  People do things that are
completely insane to others and then don't believe it when people say
that was non-obvious.


Yeah, it's been a while since I've been on tech lists, and then I was  
just feeling prickly this last week. Too distracted by the things I'm  
not getting done to post anything but brain-dumps for questions.


Thanks for the discussion.


[...]


If you're wondering why the shotgun approach, I couldn't figure  
out, with my
login shell set to sh, why the shell was behaving like csh. Still  
don't get

it.


sigh  What do you mean by behaving like csh?  The only prominent
reference to csh behavior I see in your previous note is this:


Except, csh picks up one marker, sh and ksh pick up none. So I'm
still puzzled


Meh. Definitely not clear writing on my part.

When I start csh at the command line in xterm, csh sources .cshrc  
like I expect. (That is, the flag shows up in the environment.)


But neither sh nor ksh source .profile when I run them from the  
command line.



[...]
For the the second (parameters to X11), that depends on how you run
X.  xinit, xdm, or something else?  Remote sessions?


xdm. That is, I cleared the flag that prevents xdm running in /etc/ 
rc.conf.local. (Not booted up in openbsd right now, but I think maybe  
you'll recognize that?) Not because I intended it that way, just that  
I haven't loaded anything besides all the X11 sets in the install  
image from the web. (Yeah, I know, I should buy the CDs, but, well,  
my budget for this project is really too tight in the first place.


I'd ask more questions, but I'm out of time for now. Spun my wheels  
too long, couldn't seem to generate useful search phrases or even  
questions. I've forgotten too much stuff. I'll have to pick this back  
up in a month or three. Maybe I'll try this project again with Fedora  
if I can figure out how to do it without yaboot (Don't ask. I don't  
know all the reasons why parted killed my Mac OS 9 drivers when I  
told it to partition a 1MB partition for yaboot.) and over Christmas  
try putting openbsd on the AMD box in the other room so I can  
practice a bit in the environment that has the most support.


Thanks again.

Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)



Re: I'm embarassed. (Re: shell not reading login script)

2008-08-23 Thread Philip Guenther
2008/8/23 Joel Rees [EMAIL PROTECTED]:
 On 平成 20/08/22, at 19:21, Philip Guenther wrote:
 2008/8/21 Joel Rees [EMAIL PROTECTED]:
...
 When I start csh at the command line in xterm, csh sources .cshrc like I
 expect. (That is, the flag shows up in the environment.)

 But neither sh nor ksh source .profile when I run them from the command
 line.

Right, because they only source .profile when run as login shells.
However, if you set the ENV environment variable to the path of a file
to parse before you invoked sh or ksh, then they would parse that
file.  I.e.:

$ cat /home/users/guenther/.env
echo foo
PS1='inner$ '
$ env ENV=$HOME/.env ksh
foo
inner$ exit
$

...
 xdm. That is, I cleared the flag that prevents xdm running in
 /etc/rc.conf.local. (Not booted up in openbsd right now, but I think maybe
 you'll recognize that?)

Gotcha.  In that case my recommendation is:
1) have xterm start login shells by putting this line in $HOME/.Xresources
  XTerm*loginShell: true
and, if you have a $HOME.xsession file, then make sure it has a
line like this:
  test -r $HOME/.Xresources  xrdb -load $HOME/.Xresources
near its top.

2) put all your .profile file the following types of stuff:
   - setting and exporting of environment variables (including CVSROOT)
   - umask
   - export ENV=$HOME/.kshrc  (or whatever file you prefer)

3) put in your $ENV file the following types of stuff:
   - shell functions
   - shell settings that aren't environment variables, such as MAILCHECK,
 set -o emacs, 'bind'
   - stuff that requires a terminal (stty, tset), but wrapped in a
test like this:
if [ -t 0 ]; then
   stty blah blah
fi
 so that it doesn't run if you don't actually have a terminal


Hopefully that'll give you a place to start from when you have a
chance to take another stab at this.


Philip Guenther



Re: I'm embarassed. (Re: shell not reading login script)

2008-08-22 Thread Philip Guenther
2008/8/21 Joel Rees [EMAIL PROTECTED]:
 On 平成 20/08/21, at 12:12, Philip Guenther wrote:

 2008/8/20 Joel Rees [EMAIL PROTECTED]:

 export PROFMARKER=.profile

 would you believe I put that in .profile, like the marker said?
...etc

Now that you've said it, yes, I do.  If you think it unreasonable to
not assume that from your first message, then you haven't followed
enough QA exchanges on mailing lists.  People do things that are
completely insane to others and then don't believe it when people say
that was non-obvious.

Part of writing a good question is providing enough information for
the readers to both eliminate the weirder scenarios and to estimate
how likely you are to miss the vital clue.  If you don't set the
scene sufficiently, then answers have to either
a) be excessively general (60 lines to describe what file might
control xterm's startup?)
b) ask for more detail, or
c) make assumptions, stated or not, and risk being completely wrong or
starting the
chase in the wrong direction.


 If you're wondering why the shotgun approach, I couldn't figure out, with my
 login shell set to sh, why the shell was behaving like csh. Still don't get
 it.

sigh  What do you mean by behaving like csh?  The only prominent
reference to csh behavior I see in your previous note is this:

 Except, csh picks up one marker, sh and ksh pick up none. So I'm
 still puzzled

But that seems to be saying that your shell is *not* behaving like
csh!  If you *really* mean that your shell is behaving like csh, then
perhaps xterm is actually running csh.  What's the output of $SHELL
from inside xterm?  How about $XTERM_SHELL?  What shows up in 'ps'?
Are you passing xterm arguments on its command line?  Does your
~/.xsession or ~/.xinitrc set the SHELL environment variable to
/bin/csh?  (You don't mention whether you use xdm or xinit, or
something completely different, so I can't guarantee that there aren't
other possible rcfiles that could be involved.)  Is the involved
startup script written in csh?


...
 Well, I read it and I thought about it and it sounds like what you're saying
 is that fvwm x11 sessions are giving me interactive shells instead of login
 shells? That .profile is not the same as .bash_profile? That it's probably
 not a good idea to have x11 sessions attempt to process the same script that
 starts up your login session when you login at a character terminal?

Yes, yes, and maybe.  The big no-no is putting stuff that requires a
terminal (stty, etc) in rcfiles that are parsed for non-interactive
shells (e.g., .bashrc or .cshrc).


 I'll have to think about that for a while. I mean it sort of makes sense.
 X11 is going to need parameters set that would be at best superfluous in a
 console shell and could well get in the way.

This all gets usage dependent really quickly.  If you often run X
client programs from other machines using ssh, for example, then you
may very well want to have all your X-related environment variables
(e.g. XUSERFILESEARCHPATH) set in your remote terminal logins.  If you
don't ever do that, then setting and exporting that in your .xsession
only is probably the simpler choice.


 But right now I'm having a bit of a hard time imagining why I would want
 environment settings in a console sh shell that I wouldn't want in an x11 sh
 session shell.

If the old days when people logged into the console as a terminal and
used 'xinit' to start X, there was no need for xterm to start a login
shell, as it would inherit environment variables from your console
login shell via xinit and .xinitrc.  With xdm, you don't have that
initial login shell, so you either need to set and export them in your
.xsession or configure xterm to start login shells.


 Okay, it seems like I would want three separate places to specify startup
 parameters -- one file for login parameters that are independent of the
 shell, one set of files for parameters to X11, and one startup file for the
 specific shell.

The first doesn't exist: csh and sh do not support a common syntax for
setting environment variables.  Most people just pick one shell and
make sure everything uses that.  Do you *really* want to actively use
both csh and sh, or is that just a workaround for xterm starting
something that may be csh despite your shell being /bin/sh in the
passwd file?  If the former, well, you'll need to duplicate stuff:
good luck.  If the latter, then let's figure out why it's acting weird
so you can stick to the shell you prefer.

For the the second (parameters to X11), that depends on how you run
X.  xinit, xdm, or something else?  Remote sessions?

(One of UNIX's traps is that almost everything is configurable...which
means that almost nothing is guaranteed.  Five ways to start X, with a
dozen possible config files, and others that can be indicated via
environment variables that might have been set in half a dozen
rcfiles...  A completely general answer grows in size exponentially as
the moving parts increases.  Thus the 

Re: I'm embarassed. (Re: shell not reading login script)

2008-08-21 Thread Joel Rees

On 平成 20/08/21, at 12:12, Philip Guenther wrote:


2008/8/20 Joel Rees [EMAIL PROTECTED]:

export PROFMARKER=.profile


would you believe I put that in .profile, like the marker said?


setenv CSHMARKER .cshrc


would you believe I put that in .cshrc?


setenv LOGINMARKER .login


would you believe I put that in .login?


(hangs head in shame.)


(Tilts head in puzzlement this time.)

If you're wondering why the shotgun approach, I couldn't figure out,  
with my login shell set to sh, why the shell was behaving like csh.  
Still don't get it.



Except, csh picks up one marker, sh and ksh pick up none. So I'm
still puzzled


I love how don't actually describe where you put those or which
'marker' did get 'picked up'.  No wait, I actually find that really
annoying.  Why do people leave relevant facts out?


I suppose you couldn't be bothered to read my rambling notes if I  
couldn't be bothered to dig into the archives to find your glorious  
contribution that I didn't know was there?


Well, I read it and I thought about it and it sounds like what you're  
saying is that fvwm x11 sessions are giving me interactive shells  
instead of login shells? That .profile is not the same  
as .bash_profile? That it's probably not a good idea to have x11  
sessions attempt to process the same script that starts up your login  
session when you login at a character terminal?


I'll have to think about that for a while. I mean it sort of makes  
sense. X11 is going to need parameters set that would be at best  
superfluous in a console shell and could well get in the way.


But right now I'm having a bit of a hard time imagining why I would  
want environment settings in a console sh shell that I wouldn't want  
in an x11 sh session shell.


Unless I were logging in to the same user to write open office  
documents as I was logging in to start and stop various daemons.  
Which shouldn't really happen, but I suppose it does.


Okay, it seems like I would want three separate places to specify  
startup parameters -- one file for login parameters that are  
independent of the shell, one set of files for parameters to X11, and  
one startup file for the specific shell.


And you're telling me it doesn't work that way?


...

etc. But none of the markers show up in a printenv, whether
I simply start a new xterm, or go to the trouble of logging out
and back in.


Okay, you need to review the sh(1) and csh(1) manpages and read where
they describe when the .profile or .cshrc and .login are read.  Pay
attention to the phrase login shell.  Then go read the xterm(1)
manpage and search for the phrase login shell.


There are lots of things I need to do. (For one thing, I need to  
figure out why X11's keyboard stuff isn't even getting four kind of  
important keys into the keycode matrix at all. You can see my  
attempts at embarrassing myself on that subject in the ppc@ list.)



Anyone willing to tell me what's wrong with my thinking here?


1) Failure to read the manpages


Or the right parts of them in the right frame of mind, at any rate.


2) Failure to search the archives (I posted a long explanation of when
the .profile
is read vs $ENV recently.)


Okay, so now I search at http://marc.info/?l=openbsd-misc for  
profile and I see a post with your name


Re: Can't scp, ssh is slow to authenticate.
http://marc.info/?l=openbsd-miscm=121705461723704w=2

Not sure why I should understand that problems with scp and ssh have  
anything directly to do with not knowing the right place to set shell  
variables, but your post is definitely there.


Yeah, I could have spent yet another several hours or so trying to  
think of more things to look for in the man pages and at marc and  
wandering around in the results of random searches wondering which is  
relevant, and maybe I'd have stumbled onto that post. But I've found  
that spinning my wheels too long just makes the neighborhood smell of  
rubber.


Sorry. I'm slow. Bad memory, too. Comes from my age, I suppose.

But thanks for the pointers. Gives me something to think about, like  
whether I might reconsider whether getting stuck in twisty mazes in  
Fedora 9 is any worse than being stuck in twisty mazes in OpenBSD.  
Not trying to be threatening or insulting, I just don't have a lot of  
time left this summer, and the iBook install exposes more of the  
rough edges either way. All I'm looking for is a way to take some  
open source tools with me to the schools I teach English at without  
breaking my budget and alienating my wife and generating more used  
equipment for the landfill.


Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)



Re: shell not reading login script

2008-08-21 Thread jared r r spiegel
On Thu, Aug 21, 2008 at 10:30:32AM +0900, Joel Rees wrote:

 Added markers to each of .profile, login and .cshrc:

 PROFMARKER=.profile

 etc. But none of the markers show up in a printenv, whether
 I simply start a new xterm, or go to the trouble of logging out
 and back in.

  when i have stuff that i want to always be in my environment
  regardless of what i'm typing at (eg, login console, xterm,
  screen(1), etc), i put it all in a file and then i
  set and export ENV as being set to that file.

  seems to work very well with minimal effort.

  that might not really answer your sh/csh thing, but maybe it
  helps.  fwiw i am using /bin/ksh.

-- 

  jared



shell not reading login script

2008-08-20 Thread Joel Rees

Not sure whether this is better asked on misc or ppc,
but it seems like a general question.

I'm trying to set up an ancient clamshell iBook. It boots,
I've sent in the dmesg, now I'm prepping for updating
to the patch branch via anoncvs.

I was thinking I wanted to set CVSROOT and  PKG_PATH
in my login scripts, but the login scripts seem to be ignored.

$ tail -1 /etc/passwd
admin:*:1000:1000:Big Shot:/home/admin:/bin/sh

(User names changed to protect the guilty.)

Added markers to each of .profile, login and .cshrc:

PROFMARKER=.profile

etc. But none of the markers show up in a printenv, whether
I simply start a new xterm, or go to the trouble of logging out
and back in.

Anyone willing to tell me what's wrong with my thinking here?

Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)



I'm embarassed. (Re: shell not reading login script)

2008-08-20 Thread Joel Rees

export PROFMARKER=.profile
setenv CSHMARKER .cshrc
setenv LOGINMARKER .login

(hangs head in shame.)

Except, csh picks up one marker, sh and ksh pick up none. So I'm
still puzzled

On 平成 20/08/21, at 10:30, Joel Rees wrote:


Not sure whether this is better asked on misc or ppc,
but it seems like a general question.

I'm trying to set up an ancient clamshell iBook. It boots,
I've sent in the dmesg, now I'm prepping for updating
to the patch branch via anoncvs.

I was thinking I wanted to set CVSROOT and  PKG_PATH
in my login scripts, but the login scripts seem to be ignored.

$ tail -1 /etc/passwd
admin:*:1000:1000:Big Shot:/home/admin:/bin/sh

(User names changed to protect the guilty.)

Added markers to each of .profile, login and .cshrc:

PROFMARKER=.profile

etc. But none of the markers show up in a printenv, whether
I simply start a new xterm, or go to the trouble of logging out
and back in.

Anyone willing to tell me what's wrong with my thinking here?

Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)



Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Steve's willingness to switch again.)



Re: shell not reading login script

2008-08-20 Thread Adriaan
On Thu, Aug 21, 2008 at 3:30 AM, Joel Rees [EMAIL PROTECTED] wrote:

 I was thinking I wanted to set CVSROOT and  PKG_PATH
 in my login scripts, but the login scripts seem to be ignored.

 $ tail -1 /etc/passwd
 admin:*:1000:1000:Big Shot:/home/admin:/bin/sh

 (User names changed to protect the guilty.)

 Added markers to each of .profile, login and .cshrc:

 PROFMARKER=.profile
[snip]

 etc. But none of the markers show up in a printenv, whether
 I simply start a new xterm, or go to the trouble of logging out
 and back in.

Read about the -ls' option in the xterm man page.



Re: I'm embarassed. (Re: shell not reading login script)

2008-08-20 Thread Philip Guenther
2008/8/20 Joel Rees [EMAIL PROTECTED]:
 export PROFMARKER=.profile
 setenv CSHMARKER .cshrc
 setenv LOGINMARKER .login

 (hangs head in shame.)

 Except, csh picks up one marker, sh and ksh pick up none. So I'm
 still puzzled

I love how don't actually describe where you put those or which
'marker' did get 'picked up'.  No wait, I actually find that really
annoying.  Why do people leave relevant facts out?

...
 etc. But none of the markers show up in a printenv, whether
 I simply start a new xterm, or go to the trouble of logging out
 and back in.

Okay, you need to review the sh(1) and csh(1) manpages and read where
they describe when the .profile or .cshrc and .login are read.  Pay
attention to the phrase login shell.  Then go read the xterm(1)
manpage and search for the phrase login shell.


 Anyone willing to tell me what's wrong with my thinking here?

1) Failure to read the manpages
2) Failure to search the archives (I posted a long explanation of when
the .profile
is read vs $ENV recently.)


Philip Guenther