** Description changed:

  Reported by a partner:
  
  In our Ubuntu containers (with our own minimal container runtime), we
  are often hitting an issue like this when installing packages:
  
  Setting up install-info (7.1-3build2) ...
  /usr/sbin/update-info-dir: 3: /etc/environment: cannot open 536: No such file
  dpkg: error processing package install-info (--configure):
-  installed install-info package post-installation script subprocess returned 
error exit status 2
+  installed install-info package post-installation script subprocess returned 
error exit status 2
  Errors were encountered while processing:
-  install-info
+  install-info
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  
  The reason is that our container runtime enroot writes the environment 
variables from the docker image to /etc/environment, and it uses the simple 
format KEY=VAL, without any quoting of any kind.
  But "update-info-dir" does the following:
  
  set -e
  
  #
  # since user's environment is taken over into root account when sudo-ing
  # we don't want that one's user LANGUAGE setting changes the messages in
  # the dir file. Unset LANGUAGE and reload /etc/environment to get
  # the system wide settings. See bug #536476
  unset LANGUAGE
  unset LANG
  if [ -r /etc/environment ] ; then
-   . /etc/environment
+   . /etc/environment
  fi
  if [ -r /etc/default/locale ] ; then
-   . /etc/default/locale
+   . /etc/default/locale
  fi
  
  It's hard to be 100% sure given that /etc/environment is not
  standardized, but overall it does not seem like this file was designed
  to be interpreted by a shell.
  
  From man 8 pam_env:
  
  Second a file (/etc/environment by default) with simple KEY=VAL pairs on
  separate lines will be read.
  
  From the IBM AIX documentation (trying to find a reference that likely
  hasn't changed in a while):
  https://www.ibm.com/docs/en/aix/7.1.0?topic=files-environment-file
  
  Ensure that the information in the environment file is in the Name=Value
  format. Unlike profile scripts, the environment file is not a shell
  script and does not accept data in any format other than the Name=Value
  format.
  
  Thus I think that sourcing /etc/environment is incorrect in package
  install-info.
  
  You can find a few other Ubuntu users that stumbled into the same bug:
  
https://askubuntu.com/questions/920055/errors-were-encountered-while-processing-install-info
+ 
+ 
+ To reproduce:
+ 1. Add a line like this to your /etc/environment
+ MYVAR=1;2;3
+ 2. `sudo apt install <any package>`

** Description changed:

+ [Impact]
+ 
+ apt install will error out if /etc/environment contains KEY=VAL pairs
+ with unquoted semicolons, despite the fact that /etc/environment is not
+ intended to be parsed as a shell script.
+ 
+ [Fix]
+ 
+ One proposed approach is https://bugs.debian.org/cgi-
+ bin/bugreport.cgi?bug=1114610#5
+ 
+ 
+ [Test case]
+ 
+ To reproduce:
+ 1. Add a line like this to your /etc/environment
+ MYVAR=1;2;3
+ 2. `sudo apt install <any package>`
+ 
+ [Regression potential]
+ 
+ Since any number of applications could be assuming that update-info-dir
+ is sourcing /etc/environment, there would be notable regression
+ potential for such end-user applications if we remove the sourcing from
+ this script.
+ 
+ [Other info]
+ 
  Reported by a partner:
  
  In our Ubuntu containers (with our own minimal container runtime), we
  are often hitting an issue like this when installing packages:
  
  Setting up install-info (7.1-3build2) ...
  /usr/sbin/update-info-dir: 3: /etc/environment: cannot open 536: No such file
  dpkg: error processing package install-info (--configure):
   installed install-info package post-installation script subprocess returned 
error exit status 2
  Errors were encountered while processing:
   install-info
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  
  The reason is that our container runtime enroot writes the environment 
variables from the docker image to /etc/environment, and it uses the simple 
format KEY=VAL, without any quoting of any kind.
  But "update-info-dir" does the following:
  
  set -e
  
  #
  # since user's environment is taken over into root account when sudo-ing
  # we don't want that one's user LANGUAGE setting changes the messages in
  # the dir file. Unset LANGUAGE and reload /etc/environment to get
  # the system wide settings. See bug #536476
  unset LANGUAGE
  unset LANG
  if [ -r /etc/environment ] ; then
    . /etc/environment
  fi
  if [ -r /etc/default/locale ] ; then
    . /etc/default/locale
  fi
  
  It's hard to be 100% sure given that /etc/environment is not
  standardized, but overall it does not seem like this file was designed
  to be interpreted by a shell.
  
  From man 8 pam_env:
  
  Second a file (/etc/environment by default) with simple KEY=VAL pairs on
  separate lines will be read.
  
  From the IBM AIX documentation (trying to find a reference that likely
  hasn't changed in a while):
  https://www.ibm.com/docs/en/aix/7.1.0?topic=files-environment-file
  
  Ensure that the information in the environment file is in the Name=Value
  format. Unlike profile scripts, the environment file is not a shell
  script and does not accept data in any format other than the Name=Value
  format.
  
  Thus I think that sourcing /etc/environment is incorrect in package
  install-info.
  
  You can find a few other Ubuntu users that stumbled into the same bug:
  
https://askubuntu.com/questions/920055/errors-were-encountered-while-processing-install-info
- 
- 
- To reproduce:
- 1. Add a line like this to your /etc/environment
- MYVAR=1;2;3
- 2. `sudo apt install <any package>`

** Description changed:

  [Impact]
  
  apt install will error out if /etc/environment contains KEY=VAL pairs
- with unquoted semicolons, despite the fact that /etc/environment is not
- intended to be parsed as a shell script.
+ with unquoted semicolons, despite the fact that /etc/environment is
+ (evidently) not intended to be parsed as a shell script.
  
  [Fix]
  
  One proposed approach is https://bugs.debian.org/cgi-
  bin/bugreport.cgi?bug=1114610#5
- 
  
  [Test case]
  
  To reproduce:
  1. Add a line like this to your /etc/environment
  MYVAR=1;2;3
  2. `sudo apt install <any package>`
  
  [Regression potential]
  
  Since any number of applications could be assuming that update-info-dir
  is sourcing /etc/environment, there would be notable regression
  potential for such end-user applications if we remove the sourcing from
  this script.
  
  [Other info]
  
  Reported by a partner:
  
  In our Ubuntu containers (with our own minimal container runtime), we
  are often hitting an issue like this when installing packages:
  
  Setting up install-info (7.1-3build2) ...
  /usr/sbin/update-info-dir: 3: /etc/environment: cannot open 536: No such file
  dpkg: error processing package install-info (--configure):
   installed install-info package post-installation script subprocess returned 
error exit status 2
  Errors were encountered while processing:
   install-info
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  
  The reason is that our container runtime enroot writes the environment 
variables from the docker image to /etc/environment, and it uses the simple 
format KEY=VAL, without any quoting of any kind.
  But "update-info-dir" does the following:
  
  set -e
  
  #
  # since user's environment is taken over into root account when sudo-ing
  # we don't want that one's user LANGUAGE setting changes the messages in
  # the dir file. Unset LANGUAGE and reload /etc/environment to get
  # the system wide settings. See bug #536476
  unset LANGUAGE
  unset LANG
  if [ -r /etc/environment ] ; then
    . /etc/environment
  fi
  if [ -r /etc/default/locale ] ; then
    . /etc/default/locale
  fi
  
  It's hard to be 100% sure given that /etc/environment is not
  standardized, but overall it does not seem like this file was designed
  to be interpreted by a shell.
  
  From man 8 pam_env:
  
  Second a file (/etc/environment by default) with simple KEY=VAL pairs on
  separate lines will be read.
  
  From the IBM AIX documentation (trying to find a reference that likely
  hasn't changed in a while):
  https://www.ibm.com/docs/en/aix/7.1.0?topic=files-environment-file
  
  Ensure that the information in the environment file is in the Name=Value
  format. Unlike profile scripts, the environment file is not a shell
  script and does not accept data in any format other than the Name=Value
  format.
  
  Thus I think that sourcing /etc/environment is incorrect in package
  install-info.
  
  You can find a few other Ubuntu users that stumbled into the same bug:
  
https://askubuntu.com/questions/920055/errors-were-encountered-while-processing-install-info

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2125808

Title:
  /usr/sbin/update-info-dir from ubuntu package "install-info" sources
  /etc/environment, which is not a shell script

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to