Comment 29 for bug 1922414

Revision history for this message
Arjan (iafilius) wrote : Re: ssh-agent fails to start (has_option: command not found)

Hi,

a 'meetoo' for ubuntu 22.10, using sddm/plasma-x11

Can sddm please be added to the 'Affects'?

Did notice the has_option not found in .xsession-errors
and applied workaround as suggested by Boris Steiner above, but had to make a small fixup to the script:

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
)"

#check if has_option is already defined; if not, define

has_option 2>&1 > /dev/null || has_option() {
  # Ensure that a later no-foo overrides an earlier foo
  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
    return 0
  else
    return 1
  fi
}

Notice the
has_option 2>&1
instead of
has_option 2>1

original proposed version will create file '1' in your home folder