[Bug 1847216] Re: motd-news only works with one URL even though docs say mutiple URLs can be configured

Andreas Hasenack andreas at canonical.com
Tue Oct 8 12:34:10 UTC 2019


** Changed in: base-files (Ubuntu)
       Status: New => Triaged

** Changed in: base-files (Ubuntu)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to base-files in Ubuntu.
https://bugs.launchpad.net/bugs/1847216

Title:
  motd-news only works with one URL even though docs say mutiple URLs
  can be configured

Status in base-files package in Ubuntu:
  Triaged

Bug description:
  The motd-news script etc/update-motd/50-motd-news
  the following section

  ```
  # Loop over any configured URLs
  for u in $URLS; do
          # Ensure https:// protocol, for security reasons
          case $u in
                  https://*)
                          true
                  ;;
                  https://motd.ubuntu.com)
                          u="$u/$codename/$arch"
                  ;;
                  *)
                          continue
                  ;;
          esac
          # If we're forced, set the wait to much higher (1 minute)
          [ "$FORCED" = "1" ] && WAIT=60
          # Fetch and print the news motd
          if curl --connect-timeout "$WAIT" --max-time "$WAIT" -A "$USER_AGENT" -o- "$u" >"$NEWS" 2>"$ERR"; then
                  echo
                  # At most, 10 lines of text, remove control characters, print at most 80 characters per line
                  safe_print "$NEWS"
                  # Try to update the cache
                  safe_print "$NEWS" 2>/dev/null >$CACHE || true
          else
                  : > "$CACHE"
          fi
  done

  ```

  As you can see the $CACHE gets overwritten if multiple URLs are
  configured in /etc/default/motd-news

  /etc/default/motd-news has
  ```
  # Configure the source of dynamic MOTD news
  # White space separated list of 0 to many news services
  # For security reasons, these must be https
  # and have a valid certificate
  # Canonical runs a service at motd.ubuntu.com, and you
  # can easily run one too
  URLS="https://motd.ubuntu.com"

  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/1847216/+subscriptions



More information about the foundations-bugs mailing list