[Bug 1847216] [NEW] motd-news only works with one URL even though docs say mutiple URLs can be configured
Prasad
1847216 at bugs.launchpad.net
Tue Oct 8 08:51:28 UTC 2019
Public bug reported:
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"
```
** Affects: base-files (Ubuntu)
Importance: Undecided
Status: New
** Tags: motd
** Description changed:
- The motd-news script etc/update-motd/50-motd-news
+ 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
+ # 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://tprasadtp.github.io/motd/spacex/upcoming https://tprasadtp.github.io/motd/nasa/apod"
+ URLS="https://motd.ubuntu.com"
```
--
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:
New
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