Simplifies the regex so it doesn't have as many negations.
Adds an option to pass the `/etc/passwd` values needed for pamparse so
that we can mock them for the tests. Also allows us to only grab those
values once at launch, since they shouldn't change.
This fix will overwrite the XDG variables when creating a shell session
and only if the installation is Snap (as determined by the presence of
the `$SNAP` environment variable). It also will parse the user's PAM
files, if present, to ensure that if the XDG variables were set there,
they're restored. Otherwise, if the variables are set in an RC or
profile file, we'll already pick it up when the shell starts.
closes#1696
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>