Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions system_files/shared/etc/profile.d/ublue-motd.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash

# Guard against double-sourcing: /etc/profile and /etc/bashrc both source
# profile.d on GNOME OS / freedesktop-sdk based images (unlike Fedora which
# guards /etc/bashrc with shopt -q login_shell). Same pattern as BLING_SOURCED.
[ "${UBLUE_MOTD_SHOWN:-0}" -eq 1 ] && return 0
export UBLUE_MOTD_SHOWN=1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The use of export for the UBLUE_MOTD_SHOWN variable will cause the MOTD to be suppressed in all subshells (including nested login shells) because the variable is inherited by child processes. Furthermore, if the desktop environment sources profile.d during session startup, this variable could be exported to the entire graphical session, preventing the MOTD from appearing in any terminal. Since the issue involves double-sourcing within the same shell process initialization, a local shell variable is sufficient and avoids these side effects. This also aligns with the BLING_SOURCED pattern mentioned in the PR description, which does not use export.

Suggested change
export UBLUE_MOTD_SHOWN=1
UBLUE_MOTD_SHOWN=1


[ ! -e "$HOME"/.config/no-show-user-motd ] && ublue-motd
Loading