/etc/motd.tail is silently removed on upgrade of initscripts

Bug #1000298 reported by TAKAHASHI Shuhei
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

/etc/motd.tail is always removed on upgrade of initscripts. I encountered this problem on upgrading my Ubuntu server from 10.04 to 12.04.

This problem is caused by misuse of fgrep in initscripts.postinst:

 ...
        help_text=$(/etc/update-motd.d/10-help-text 2>/dev/null || true)
        if [ -n "$help_text" ] && fgrep -q "$help_text" /etc/motd.tail
        then
                rm -f /etc/motd.tail
 ...

/etc/update-motd.d/10-help-text *outputs a single newline* before the line containing "Documents: https://help.ubuntu.com/". On the other hands, man grep reads:

       -F, --fixed-strings
              Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. (-F is specified by POSIX.)

Then this fgrep call always succeeds and /etc/motd.tail is removed.

I attached a patch to solve this issue.

Tags: patch
Revision history for this message
TAKAHASHI Shuhei (nya3jp) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "save-etc-motd-tail.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sysvinit (Ubuntu):
status: New → Confirmed
Revision history for this message
Steve Langasek (vorlon) wrote :

It happens that this will be fixed in the next upload to saucy because Debian's motd handling has changed altogether and we are following suit, so those commands are no longer present in the maintainer script at all; but we should backport this fix to precise.

Changed in sysvinit (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.