← Back to team overview

debcrafters-packages team mailing list archive

[Bug 2120948] [NEW] Error in save-to-pam-env script

 

Public bug reported:

When the .pam_environment file of an user is created for the first time
the format will be wrong:

cat .pam_environment
LANGUAGE\tDEFAULT=de_DE:en
LANG\tDEFAULT=de_DE.UTF-8
LC_NUMERIC\tDEFAULT=en_US.UTF-8
LC_TIME\tDEFAULT=en_US.UTF-8
LC_MONETARY\tDEFAULT=en_US.UTF-8
LC_PAPER\tDEFAULT=en_US.UTF-8
LC_NAME\tDEFAULT=en_US.UTF-8
LC_ADDRESS\tDEFAULT=en_US.UTF-8
LC_TELEPHONE\tDEFAULT=en_US.UTF-8
LC_MEASUREMENT\tDEFAULT=en_US.UTF-8
LC_IDENTIFICATION\tDEFAULT=en_US.UTF-8
PAPERSIZE\tDEFAULT=letter
LANGUAGE\tDEFAULT=en_US:en
LANG\tDEFAULT=en_US.UTF-8
LANGUAGE\tDEFAULT=de_DE:en
LANG\tDEFAULT=de_DE.UTF-8
LANGUAGE\tDEFAULT=en_US:en
LANG\tDEFAULT=en_US.UTF-8
LANGUAGE\tDEFAULT=de_DE:en
LANG\tDEFAULT=de_DE.UTF-8

Because of a missing command parameter in the script
/usr/share/language-tools/save-to-pam-env the tabulators will not be
generated but insert as normal characters. Therefore the pam_environment
file will not work.

The error is in the function save_to_pam_env(), there is an -e missing
at the echo command:

save_to_pam_env() {
    var=$1; value=$2
    if [ "$( grep -E "^$var(\s+DEFAULT|=)" .pam_environment )" ]; then
        sed -r -i "s/^$var(\s+DEFAULT|=).*/$var\tDEFAULT=$value/" .pam_environment
    else
        echo "$var\tDEFAULT=$value" >> .pam_environment
    fi
}

But it must be
      echo -e "$var\tDEFAULT=$value" >> .pam_environment

With this fix the syntax of the pam_environment is correct and will be
working.

I see this error in the packages for jammy and noble.

** Affects: accountsservice (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of
Debcrafters packages, which is subscribed to accountsservice in Ubuntu.
https://bugs.launchpad.net/bugs/2120948

Title:
  Error in save-to-pam-env script

Status in accountsservice package in Ubuntu:
  New

Bug description:
  When the .pam_environment file of an user is created for the first
  time the format will be wrong:

  cat .pam_environment
  LANGUAGE\tDEFAULT=de_DE:en
  LANG\tDEFAULT=de_DE.UTF-8
  LC_NUMERIC\tDEFAULT=en_US.UTF-8
  LC_TIME\tDEFAULT=en_US.UTF-8
  LC_MONETARY\tDEFAULT=en_US.UTF-8
  LC_PAPER\tDEFAULT=en_US.UTF-8
  LC_NAME\tDEFAULT=en_US.UTF-8
  LC_ADDRESS\tDEFAULT=en_US.UTF-8
  LC_TELEPHONE\tDEFAULT=en_US.UTF-8
  LC_MEASUREMENT\tDEFAULT=en_US.UTF-8
  LC_IDENTIFICATION\tDEFAULT=en_US.UTF-8
  PAPERSIZE\tDEFAULT=letter
  LANGUAGE\tDEFAULT=en_US:en
  LANG\tDEFAULT=en_US.UTF-8
  LANGUAGE\tDEFAULT=de_DE:en
  LANG\tDEFAULT=de_DE.UTF-8
  LANGUAGE\tDEFAULT=en_US:en
  LANG\tDEFAULT=en_US.UTF-8
  LANGUAGE\tDEFAULT=de_DE:en
  LANG\tDEFAULT=de_DE.UTF-8

  Because of a missing command parameter in the script
  /usr/share/language-tools/save-to-pam-env the tabulators will not be
  generated but insert as normal characters. Therefore the
  pam_environment file will not work.

  The error is in the function save_to_pam_env(), there is an -e missing
  at the echo command:

  save_to_pam_env() {
      var=$1; value=$2
      if [ "$( grep -E "^$var(\s+DEFAULT|=)" .pam_environment )" ]; then
          sed -r -i "s/^$var(\s+DEFAULT|=).*/$var\tDEFAULT=$value/" .pam_environment
      else
          echo "$var\tDEFAULT=$value" >> .pam_environment
      fi
  }

  But it must be
        echo -e "$var\tDEFAULT=$value" >> .pam_environment

  With this fix the syntax of the pam_environment is correct and will be
  working.

  I see this error in the packages for jammy and noble.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/2120948/+subscriptions



Follow ups