indigo-dc / oidc-agent

oidc-agent for managing OpenID Connect tokens on the command line
MIT License
115 stars 30 forks source link

v5.2.0 contains bug that prevents oidc-agent starting via oidc-agent-service script #596

Closed paulmillar closed 3 months ago

paulmillar commented 3 months ago

With v5.2.0, oidc-agent file /etc/oidc-agent/oidc-agent-service.options contains this line:

OIDC_AGENT_OPTS="--restart-on-update ${OIDC_AGENT_OPTS}"

Note that, if $OIDC_AGENT_OPTS expands to the empty string then this variable with the value --restart-on-update. Importantly, this value includes a trailing space.

In the start function, the script /usr/bin/oidc-agent-service makes use of this variable:

function start() {
  json=$(${OIDC_AGENT} -a "${SOCK}" "${OIDC_AGENT_OPTS}" --pid-file="${PID_FILE}" --json)
  OIDCD_PID=$(${ECHO} "${json}" | "${JQ}" -r ".dpid")
  echo_vars
}

Note that the string expansion of $OIDC_AGENT_OPTS is placed within double-quotes. This makes the string value a single argument to the oidc-agent command.

The result is that, running the command yields the following error:

paul@monkeywrench:~$ /usr/bin/oidc-agent-service start-from-x
/usr/bin/oidc-agent: unrecognized option '--restart-on-update '
Try `oidc-agent --help' or `oidc-agent --usage' for more information.
paul@monkeywrench:~$ 

The problem was triggered by commit 277677e69b; however, the underlying problem (the double-quotes) was introduced with commit 392a8e4b0. Both changes are only present with v5.2.0

zachmann commented 3 months ago

Duplicate of #593 Patch is already merged, will be released as 5.2.1 soon.