Skip to content

Commit

Permalink
Specify expected shell in su calls
Browse files Browse the repository at this point in the history
When calling su with a specific script, specify /bin/sh shell to be sure
to use posix compliant shell. User shell may not be a one (like fish).

Fixes QubesOS/qubes-issues#5135

(cherry picked from commit ec32be7)
  • Loading branch information
marmarek committed Sep 7, 2019
1 parent 1f8cba9 commit 7de3c52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions qubes-rpc/qubes.InstallUpdatesGUI
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ elif [ -e /etc/arch-release ]; then
else
update_cmd='echo Unsupported distribution, install updates manually; bash -i'
fi
xterm -title update -e su -l -c "$update_cmd; echo Done.; test -f /var/run/qubes/this-is-templatevm && { echo Press Enter to shutdown the template, or Ctrl-C to just close this window; read x && poweroff; } ;"
xterm -title update -e su -s /bin/sh -l -c "$update_cmd; echo Done.; test -f /var/run/qubes/this-is-templatevm && { echo Press Enter to shutdown the template, or Ctrl-C to just close this window; read x && poweroff; } ;"

# Notify dom0 about installed updates
su -c 'service qubes-update-check start'
su -s /bin/sh -c 'service qubes-update-check start'
2 changes: 1 addition & 1 deletion qubes-rpc/qubes.WaitForSession
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && ex
if [ "$(id -un)" = "$USERNAME" ]; then
sh -c "$cmd" 2>/dev/null
else
su -c "$cmd" - "$USERNAME" 2> /dev/null
su -s /bin/sh -c "$cmd" - "$USERNAME" 2> /dev/null
fi
# the above line is _expected_ to be terminated by a signal, don't treat this as a failure
exit 0

0 comments on commit 7de3c52

Please sign in to comment.