/etc/skel/.profile should be strictly sh

Bug #200283 reported by era
2
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: bash

According to the bash manual page, e.g. tilde expansion is a feature which is absent from "Bourne classic" sh.

Since $HOME/.profile is potentially read by other shells than Bash, it should probably only use the strict Bourne features.

Perhaps the comment near the top should include a remark about this, too?

I would suggest at least the following change:

 # set PATH so it includes user's private bin if it exists
-if [ -d ~/bin ] ; then
- PATH=~/bin:"${PATH}"
+if [ -d ${HOME}/bin ] ; then
+ PATH=${HOME}/bin:"${PATH}"
 fi

For consistency, you might want to perform a similar substitution in the preceding stanza where .bashrc is loaded if present, although that is of course technically only ever evaluated by Bash if the logic works correctly.

Especially in mixed environments, where users' home directories may be NFS-mounted on a number of different architectures, avoiding compatibility problems in the default .profile is probably a good idea, and should help lower the threshold for large organizations to accept Ubuntu.

Related branches

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 3.2-0ubuntu16

---------------
bash (3.2-0ubuntu16) hardy; urgency=low

  * Remove /etc/skel/.bash_profile, if it is unmodified; if modified and
    /etc/skel/.profile is unmodifed, move .bash_profile to .profile.
    LP: #211406.
  * /etc/skel/.bashrc: Add an option to blurt a terminal window with a
    colored prompt. LP: #103929.
  * /etc/skel/.bashrc: Add color support for grep and friends (commented out
    by default). LP: #144632.
  * /etc/skel/.profile: Avoid the use of `~'. LP: #200283.
  * Add a shopt option compat31 to falls back to the behaviour of bash-3.1
    and earlier versions, in that quoting the string argument to the [[
    command's =~ +operator does not force string matching. LP: #110407.

 -- Matthias Klose <email address hidden> Tue, 15 Apr 2008 01:24:06 +0200

Changed in bash:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.