Ticket #214 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

/etc/{bash.bashrc,csh.cshrc}.debathena should not set environment variables

Reported by: andersk Owned by:
Priority: normal Milestone: Karmic Deploy (Canceled)
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

Right now /etc/profile.debathena and /etc/bash.bashrc.debathena both source the same script /usr/share/debathena-bash-config/bashrc.debathena, which clobbers environment variables like ATHENA_USER. This clobbers an ATHENA_USER set in ~/.profile. bashrc files should never set environment variables, so the fix is to split out a new /usr/share/debathena-bash-config/profile.debathena from bashrc.debathena. Similarly for tcsh.

Change History

comment:1 Changed 15 years ago by andersk

Also, this comment in bashrc.debathena (similarly cshrc.debathena) is wrong.

# If your Athena username differs from your local username,
# you should override this in your own .bashrc or .bashrc.mine.
export ATHENA_USER=$USER

You should not set environment variables in a bashrc, because they won’t take effect for any application not launched from an interactive shell. ~/.profile is the right place to set ATHENA_USER.

comment:2 Changed 15 years ago by xavid

Note that bash does not read .profile if .bash_login or .bash_profile exist.

comment:3 Changed 15 years ago by andersk

Overriding ATHENA_USER is for local users, which only get these files by default:

$ ls -a /etc/skel
.  ..  .bash_logout  .bashrc  examples.desktop  .profile

If you create your own .bash_login or .bash_profile, it is good practice to make it source .profile anyway, because /etc/gdm/Xsession only sources .profile and not .bash_login or .bash_profile.

comment:4 Changed 15 years ago by jdreed

  • Milestone set to IAP 2010

comment:5 Changed 15 years ago by jhamrick

  • Status changed from new to development

In r23995, I changed shell-config to source a directory via run-parts instead of having it source individual files. This allows for more flexibility, so someone wanting to add something to bash.bashrc.debathena or profile.debathena doesn't have to change that file, all they have to do is drop their bash script in the directory that gets sourced. bash.bashrc.debathena and profile.debathena do not have to source the same file and we can set $ATHENA_USER in /usr/share/debathena-bash-config/profile.d/01-set-athena-user. If someone wants to override that, they can change it in their own ~/.profile.

comment:6 Changed 15 years ago by broder

  • Status changed from development to proposed

After some brief testing of r23997 (which sources our customizations after the system defaults), I'm concluding that this appears to work as intended, and I'm moving it into proposed.

Specifically, non-login shells don't set ATHENA_USER, and login shells do.

comment:7 Changed 15 years ago by broder

  • Status changed from proposed to closed
  • Resolution set to fixed

Moved to production today.

Note: See TracTickets for help on using tickets.