Public bug reported:

Jammy Jellyfish 22.04.1 LTS and others. There have been numerous bug
reports and failed fixes for this over several years and releases.

There are a couple of problems in /etc/X11/Xsessions where it fails to
handle options, causing bogus error messages and, doubtless, many
errors.

The first bug is that the entire options file, including comments, is
read into a variable.

Where the variable "OPTIONS" is assigned;

Replacing "cat" with "grep" strips out comments and blank lines;

$ diff Xsession Xsession.orig 
65c65
<     grep -v "^\s*\#\|^\s*$" "$OPTIONFILE"
---
>     cat "$OPTIONFILE"

The second problem is that checking for a non-existent directory inside
a command substitution does not work.  It just appends garbage onto the
output string.

That is probably a bug in BASH, but I defer to your opinion there.

The immediate work around is to create an empty directory so that the
test does not fail.  Better still, force the creation of the directory
and remove the test.


eg. change this;

OPTIONS="$(
  if [ -r "$OPTIONFILE" ]; then
    cat "$OPTIONFILE"
  fi
  if [ -d /etc/X11/Xsession.options.d ]; then
    run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d 
'\n' cat
  fi
)"

to this;

OPTIONSDIR=/etc/X11/Xsession.options.d
mkdir --parents ${OPTIONSDIR}
OPTIONS="$(
  if [ -r "$OPTIONFILE" ]; then
    grep -v "^\s*\#\|^\s*$" "$OPTIONFILE"
  fi
  run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d 
'\n' cat
)"

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: xorg 1:7.7+23ubuntu2
ProcVersionSignature: Ubuntu 5.15.0-52.58-generic 5.15.60
Uname: Linux 5.15.0-52-generic x86_64
.tmp.unity_support_test.0:
 
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
BootLog: Error: [Errno 13] Permission denied: '/var/log/boot.log'
CasperMD5CheckResult: pass
CompositorRunning: None
CurrentDesktop: XFCE
Date: Mon Oct 31 16:33:14 2022
DistUpgraded: Fresh install
DistroCodename: jammy
DistroVariant: ubuntu
DkmsStatus:
 virtualbox/6.1.38, 5.15.0-362206031516-generic, x86_64: installed
 virtualbox/6.1.38, 5.15.0-52-generic, x86_64: installed
ExtraDebuggingInterest: Yes
GraphicsCard:
 Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / 
Radeon Vega Mobile Series] [1002:15dd] (rev c8) (prog-if 00 [VGA controller])
   Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega 
Series / Radeon Vega Mobile Series] [1002:15dd]
InstallationDate: Installed on 2022-10-20 (11 days ago)
InstallationMedia: Kubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 
(20220809.1)
MachineType: Micro-Star International Co., Ltd. MS-7B89
ProcKernelCmdLine: ro root=PARTUUID=1c70e394-574c-46cc-a65e-a402f0e077d4 
fbcon=rotate:2 initrd=\initrd.img
SourcePackage: xorg
Symptom: display
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 02/01/2021
dmi.bios.release: 5.17
dmi.bios.vendor: American Megatrends International, LLC.
dmi.bios.version: 2.C0
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: B450M MORTAR MAX (MS-7B89)
dmi.board.vendor: Micro-Star International Co., Ltd.
dmi.board.version: 1.0
dmi.chassis.asset.tag: To be filled by O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: Micro-Star International Co., Ltd.
dmi.chassis.version: 1.0
dmi.modalias: 
dmi:bvnAmericanMegatrendsInternational,LLC.:bvr2.C0:bd02/01/2021:br5.17:svnMicro-StarInternationalCo.,Ltd.:pnMS-7B89:pvr1.0:rvnMicro-StarInternationalCo.,Ltd.:rnB450MMORTARMAX(MS-7B89):rvr1.0:cvnMicro-StarInternationalCo.,Ltd.:ct3:cvr1.0:skuTobefilledbyO.E.M.:
dmi.product.family: To be filled by O.E.M.
dmi.product.name: MS-7B89
dmi.product.sku: To be filled by O.E.M.
dmi.product.version: 1.0
dmi.sys.vendor: Micro-Star International Co., Ltd.
version.compiz: compiz 1:0.9.14.1+22.04.20220820-0ubuntu1
version.libdrm2: libdrm2 2.4.110-1ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 22.0.5-0ubuntu0.1
version.libgl1-mesa-glx: libgl1-mesa-glx 22.0.5-0ubuntu0.1
version.xserver-xorg-core: xserver-xorg-core 2:21.1.3-2ubuntu2.2
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-2ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 
2:2.99.917+git20210115-1
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.17-2build1

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


** Tags: amd64 apport-bug jammy ubuntu

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to xorg in Ubuntu.
https://bugs.launchpad.net/bugs/1995236

Title:
  Xsessions has_option code error with fix

Status in xorg package in Ubuntu:
  New

Bug description:
  Jammy Jellyfish 22.04.1 LTS and others. There have been numerous bug
  reports and failed fixes for this over several years and releases.

  There are a couple of problems in /etc/X11/Xsessions where it fails to
  handle options, causing bogus error messages and, doubtless, many
  errors.

  The first bug is that the entire options file, including comments, is
  read into a variable.

  Where the variable "OPTIONS" is assigned;

  Replacing "cat" with "grep" strips out comments and blank lines;

  $ diff Xsession Xsession.orig 
  65c65
  <     grep -v "^\s*\#\|^\s*$" "$OPTIONFILE"
  ---
  >     cat "$OPTIONFILE"

  The second problem is that checking for a non-existent directory
  inside a command substitution does not work.  It just appends garbage
  onto the output string.

  That is probably a bug in BASH, but I defer to your opinion there.

  The immediate work around is to create an empty directory so that the
  test does not fail.  Better still, force the creation of the directory
  and remove the test.

  
  eg. change this;

  OPTIONS="$(
    if [ -r "$OPTIONFILE" ]; then
      cat "$OPTIONFILE"
    fi
    if [ -d /etc/X11/Xsession.options.d ]; then
      run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d 
'\n' cat
    fi
  )"

  to this;

  OPTIONSDIR=/etc/X11/Xsession.options.d
  mkdir --parents ${OPTIONSDIR}
  OPTIONS="$(
    if [ -r "$OPTIONFILE" ]; then
      grep -v "^\s*\#\|^\s*$" "$OPTIONFILE"
    fi
    run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d 
'\n' cat
  )"

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: xorg 1:7.7+23ubuntu2
  ProcVersionSignature: Ubuntu 5.15.0-52.58-generic 5.15.60
  Uname: Linux 5.15.0-52-generic x86_64
  .tmp.unity_support_test.0:
   
  ApportVersion: 2.20.11-0ubuntu82.1
  Architecture: amd64
  BootLog: Error: [Errno 13] Permission denied: '/var/log/boot.log'
  CasperMD5CheckResult: pass
  CompositorRunning: None
  CurrentDesktop: XFCE
  Date: Mon Oct 31 16:33:14 2022
  DistUpgraded: Fresh install
  DistroCodename: jammy
  DistroVariant: ubuntu
  DkmsStatus:
   virtualbox/6.1.38, 5.15.0-362206031516-generic, x86_64: installed
   virtualbox/6.1.38, 5.15.0-52-generic, x86_64: installed
  ExtraDebuggingInterest: Yes
  GraphicsCard:
   Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / 
Radeon Vega Mobile Series] [1002:15dd] (rev c8) (prog-if 00 [VGA controller])
     Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega 
Series / Radeon Vega Mobile Series] [1002:15dd]
  InstallationDate: Installed on 2022-10-20 (11 days ago)
  InstallationMedia: Kubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 
(20220809.1)
  MachineType: Micro-Star International Co., Ltd. MS-7B89
  ProcKernelCmdLine: ro root=PARTUUID=1c70e394-574c-46cc-a65e-a402f0e077d4 
fbcon=rotate:2 initrd=\initrd.img
  SourcePackage: xorg
  Symptom: display
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 02/01/2021
  dmi.bios.release: 5.17
  dmi.bios.vendor: American Megatrends International, LLC.
  dmi.bios.version: 2.C0
  dmi.board.asset.tag: To be filled by O.E.M.
  dmi.board.name: B450M MORTAR MAX (MS-7B89)
  dmi.board.vendor: Micro-Star International Co., Ltd.
  dmi.board.version: 1.0
  dmi.chassis.asset.tag: To be filled by O.E.M.
  dmi.chassis.type: 3
  dmi.chassis.vendor: Micro-Star International Co., Ltd.
  dmi.chassis.version: 1.0
  dmi.modalias: 
dmi:bvnAmericanMegatrendsInternational,LLC.:bvr2.C0:bd02/01/2021:br5.17:svnMicro-StarInternationalCo.,Ltd.:pnMS-7B89:pvr1.0:rvnMicro-StarInternationalCo.,Ltd.:rnB450MMORTARMAX(MS-7B89):rvr1.0:cvnMicro-StarInternationalCo.,Ltd.:ct3:cvr1.0:skuTobefilledbyO.E.M.:
  dmi.product.family: To be filled by O.E.M.
  dmi.product.name: MS-7B89
  dmi.product.sku: To be filled by O.E.M.
  dmi.product.version: 1.0
  dmi.sys.vendor: Micro-Star International Co., Ltd.
  version.compiz: compiz 1:0.9.14.1+22.04.20220820-0ubuntu1
  version.libdrm2: libdrm2 2.4.110-1ubuntu1
  version.libgl1-mesa-dri: libgl1-mesa-dri 22.0.5-0ubuntu0.1
  version.libgl1-mesa-glx: libgl1-mesa-glx 22.0.5-0ubuntu0.1
  version.xserver-xorg-core: xserver-xorg-core 2:21.1.3-2ubuntu2.2
  version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
  version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-2ubuntu1
  version.xserver-xorg-video-intel: xserver-xorg-video-intel 
2:2.99.917+git20210115-1
  version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 
1:1.0.17-2build1

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


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to