[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#852448: x11-common: ssh-agent socket removed from /tmp for long-running sessions



Hi Sam,

On Tue, Jan 24, 2017 at 2:51 PM, Sam Hartman <hartmans@debian.org> wrote:
> I think sticking the agent socket in XDG_RUNTIME_DIR is a better place in the modern world order.
> Here's a patch.
>
> --- 90x11-common_ssh-agent~     2010-10-13 09:29:00.000000000 -0400
> +++ 90x11-common_ssh-agent      2017-01-24 09:36:32.717942114 -0500
> @@ -17,6 +17,11 @@
>    fi
>  fi
>
> +if [ -n "$XDG_RUNTIME_DIR" ]; then
> +    mkdir $XDG_RUNTIME_DIR/ssh-agent
> +    SSHAGENTARGS="-a $XDG_RUNTIME_DIR/ssh-agent/sock $SSHAGENTARGS"
> +fi
> +
>  if [ -n "$STARTSSH" ]; then
>    STARTUP="$SSHAGENT $SSHAGENTARGS ${TMPDIR:+env TMPDIR=$TMPDIR} $STARTUP"
>  fi

Your patch looks good, except that I would quote the expansion of
$XDG_RUNTIME_DIR when invoking mkdir. If $XDG_RUNTIME_DIR contains
whitespace, the shell will tokenize it in a surprising way and create
different directory names than are expected.

$ FOO="foo bar"; test -d "$FOO" || echo "$FOO does not exist"; if [ -n
"$FOO" ]; then mkdir $FOO; cd "$FOO"; fi; ls -dl "$FOO" $FOO
foo bar does not exist
-bash: cd: foo bar: No such file or directory
ls: cannot access 'foo bar': No such file or directory
drwxr-xr-x 1 branden None 0 Jan 24 15:28  bar
drwxr-xr-x 1 branden None 0 Jan 24 15:28  foo

Regards,
Branden


Reply to: