byobu-shell motd issue

Bug #1458941 reported by Paul Tansom on 2015-05-26
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
byobu
Medium
Dustin Kirkland 

Bug Description

Having just installed a Ubuntu 14.04 LTS machine and enabled byobu I noticed that the motd doesn't display when you log in. On investigation this looks to be an out of date line in the byobu-shell script.

Line 27 reads:

[ -r /etc/motd ] && cat /etc/motd

to check if you can read the motd file and display it if you can. With current versions of Ubuntu this file is no longer used. Looking at my 14.04 install /run/motd.dynamic is the relevant file, and on my 12.04 server it looks to be /run/motd. I've not looked at what it may be on other versions of Linux that use byobu.

On the basis of these 3 potential locations a fix along the lines of:

if [ -f /run/motd.dynamic ]
  then
    [ -r /run/motd.dynamic ] && cat /run/motd.dynamic
elif [ -f /run/motd ]
  then
    [ -r /run/motd] && cat /run/motd
elif [ -f /etc/motd]
  then
    [ -r /etc/motd] && cat /etc/motd
fi

should do the trick in a reasonably generic fashion, although there may be a tidier way. I did experiment with:

[ -r /run/motd.dynamic ] && cat /run/motd.dynamic
[ -r /run/motd] && cat /run/motd
[ -r /etc/motd] && cat /etc/motd

but got the following lines printed as well as the motd:

/usr/bin/byobu-shell: 28: [: missing ]
/usr/bin/byobu-shell: 29: [: missing ]

I'm not entirely sure why there is no similar error with the default script when there is no /etc/motd file, I'm assuming it is suppressed/hidden since there is noting cat'd to the display.

Related branches

Changed in byobu:
importance: Undecided → Medium
status: New → Triaged
status: Triaged → In Progress
assignee: nobody → Dustin Kirkland  (kirkland)
Dustin Kirkland  (kirkland) wrote :

bzr commit -m '* usr/bin/byobu-shell.in: LP: #1458941
  - find the motd' --fixes 'lp:1458941'
Committing to: /local/media/src/byobu/byobu/
modified debian/changelog
modified usr/bin/byobu-shell.in
Committed revision 2422.

Changed in byobu:
status: In Progress → Fix Committed
Changed in byobu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers