NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: xsrc/54851 (.profile is not read by sh when using xdm or other login managers)



The following reply was made to PR xsrc/54851; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: xsrc/54851 (.profile is not read by sh when using xdm or other
 login managers)
Date: Sun, 21 Aug 2022 23:04:50 +0000

 On Sun, Aug 21, 2022 at 08:10:02PM +0000, Valery Ushakov wrote:
  >  So I did a bit more poking around about the "loginness" of Xsession,
  >  and it's all a mess :)
 
 Everything about xdm is a mess; it's not an accident that every
 desktop provides its own replacement for it.
 
 If we want it to behave itself we're going to have to fix it.
 
  >  Even the xdm(1) man page itself has an csh example that exhibit that
  >  confusion, b/c it emphasizes that the the #!csh line doesn't have `-f`
  >  flag ("fast", i.e. skip reading .cshrc) "so .cshrc gets run to set
  >  $PATH", i.e. it supposes that PATH is set in in .cshrc, while normally
  >  you'd want to do that once in .login
 
 As I posted or said somewhere a couple days ago (can't remember which
 of the many related threads or discussions) it is/was standard
 practice with csh to set the path in .cshrc. You'll notice that our
 skeleton .cshrc file does exactly that.
 
  >  | execl(pwd->pw_shell, "-", "-c", DXSESSION, 0); 
  >  
  >  which I also thought of, but one problem there is that it doesn't work
  >  with csh.  csh's test for "am I a login shell" is argv[0] starts with
  >  '-' and there are no arguments or, otherwise, there's single `-l`
  >  argument.  I.e. you cannot run -csh -c command that executes a command
  >  as a login shell, after reading csh login files.  (ksh, bash and zsh
  >  don't have that limitation and grok -l -c; tmux accepts -l, dunno if
  >  it passes it along with -c emulation).
 
 This could be construed as a bug, so we could always just fix csh.
 It's not like the default session embedded in xdm needs to work with
 anyone else's csh.
 
 However, I think it's reasonable to assume that at this point all csh
 users are oldtimers and know what they're doing and probably already
 have their own .xsession arrangements, and not worry about it.
 
  >  | I suggest that you not modify the /usr/lib/X11/xdm/Xsession script
  >  | in this way but rather suggest that each user create a ~/.xsession
  >  | script to configure his X environment.  A typical .xsession script
  >  | might define various environment variables and then run dxsession.
  >  | One trick I use is to define a script of environment variable
  >  | definitions which is sourced from both my .login and my .xsession.
  >  
  >  Which forces everyone to either have an .xsession file or make their
  >  .cshrc, or .bashrc, or whatever check if the environment was
  >  customized and source their login script if not.
 
 Really, everybody, or at least everybody who ever uses xdm, should
 have an .xsession file. Can we please add one to /etc/skel already?
 This is really the best solution unless we plan on making large-scale
 improvements to xdm.
 
  >  All that shouldn't change the fact that we should fix sh to enable
  >  line editing by default.
 
 Right.
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index