Merge ~smoser/ubuntu/+source/grub-legacy-ec2:fix/1786244-fix-read-from-stderr-upgrade-fail into ubuntu/+source/grub-legacy-ec2:ubuntu/devel

Proposed by Scott Moser
Status: Merged
Merged at revision: 552cf6beafab0ec4b6ffe7b3c0a0c96af5083d6f
Proposed branch: ~smoser/ubuntu/+source/grub-legacy-ec2:fix/1786244-fix-read-from-stderr-upgrade-fail
Merge into: ubuntu/+source/grub-legacy-ec2:ubuntu/devel
Diff against target: 35 lines (+12/-2)
2 files modified
debian/changelog (+7/-0)
debian/update-grub-legacy-ec2 (+5/-2)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Review via email: mp+360897@code.launchpad.net

Commit message

Do not attempt to read from stderr, only from stdin and if it is a terminal.

Previously, if /boot/grub/menu.lst did not exist, then
the a postinst would attempt read from stderr, which is not likely
opened for reading. This does two things:
 a.) reads from stdin (which makes more sense)
 b.) only attempts to do so if input is a terminal.

If not 'a' and 'b' then write /boot/grub/menu.lst from template
rather than exiting fail.

LP: #1786244

Description of the change

see commit message

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The Change itself LGTM, thanks for working that out.

The changelog is currently not directed at anything, please remember to update that according to what you want to upload to.

Revision history for this message
Christian Ehrhardt  (paelzer) :
review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

Ack in the release in changelog. Thanks.

On Sat, Dec 15, 2018, 3:41 AM Christian Ehrhardt  <
<email address hidden> wrote:

> Review: Approve
>
>
> --
>
> https://code.launchpad.net/~smoser/ubuntu/+source/grub-legacy-ec2/+git/grub-legacy-ec2/+merge/360897
> You are the owner of
> ~smoser/ubuntu/+source/grub-legacy-ec2:fix/1786244-fix-read-from-stderr-upgrade-fail.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 2385875..e537936 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+grub-legacy-ec2 (1:1ubuntu1) UNRELEASED; urgency=medium
7+
8+ * Fix a bug occuring from postinst if /boot/grub/menu.lst did
9+ not exist (LP: #1786244).
10+
11+ -- Scott Moser <smoser@ubuntu.com> Thu, 13 Dec 2018 17:12:28 -0500
12+
13 grub-legacy-ec2 (1:1) bionic; urgency=medium
14
15 * Split package out of cloud-init source. (LP: #1758420)
16diff --git a/debian/update-grub-legacy-ec2 b/debian/update-grub-legacy-ec2
17index c1c9dc7..937170d 100755
18--- a/debian/update-grub-legacy-ec2
19+++ b/debian/update-grub-legacy-ec2
20@@ -1095,10 +1095,13 @@ else
21 echo >&2
22 echo "Generating $menu_file" >&2
23 answer=y
24- else
25+ elif [ -t 0 ]; then
26 echo -n "Would you like $menu_file generated for you? " >&2
27 echo -n "(y/N) " >&2
28- read answer <&2
29+ read answer
30+ else
31+ echo "Input is not from a terminal. Creating new $menu_file." >&2
32+ answer=y
33 fi
34
35 case "$answer" in

Subscribers

People subscribed via source and target branches