/etc/profile runs /etc/profile.d/*.sh twice

Bug #790050 reported by Carl Karsten
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
base-files (Ubuntu)
Fix Released
Medium
Alexander Fougner

Bug Description

Binary package hint: base-files

This block of code occurs two times, so all the scripts get run two times:

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

juser@pc9e:/etc$ grep -n "if.*profile" /etc/profile
4:if [ -d /etc/profile.d ]; then
32:if [ -d /etc/profile.d ]; then

Here is the whole thing:

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: base-files 6.3ubuntu2
ProcVersionSignature: Ubuntu 2.6.39-3.10-generic 2.6.39
Uname: Linux 2.6.39-3-generic x86_64
Architecture: amd64
Date: Sun May 29 22:13:27 2011
ProcEnviron:
 LANGUAGE=en_US:
 PATH=(custom, user)
 LANG=en_US
 SHELL=/bin/bash
SourcePackage: base-files
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Carl Karsten (carlfk) wrote :
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for your report.

Confirmed in Oneiric on a fresh install.

Changed in base-files (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
tags: added: bitesize
Changed in base-files (Ubuntu):
assignee: nobody → Alexander Fougner (fougner)
Revision history for this message
Carl Karsten (carlfk) wrote :

looks like it is fixed. who should close this?

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

This bug was fixed in the package base-files - 6.3ubuntu4

---------------
base-files (6.3ubuntu4) oneiric; urgency=low

  * Removed duplicate code in share/profile, causing /etc/profile.d/*
    scripts to be executed twice (LP: #790050)
 -- Alexander Fougner <email address hidden> Sat, 18 Jun 2011 00:23:05 +0200

Changed in base-files (Ubuntu):
status: Triaged → 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.