Merge ~athos-ribeiro/ubuntu/+source/tmux:tmux-fix-lp1890406-utempter-focal into ubuntu/+source/tmux:ubuntu/focal-devel

Proposed by Athos Ribeiro
Status: Merged
Approved by: Sergio Durigan Junior
Approved revision: 41477e3953c418b638c0049fd1ee65331b99c026
Merged at revision: 41477e3953c418b638c0049fd1ee65331b99c026
Proposed branch: ~athos-ribeiro/ubuntu/+source/tmux:tmux-fix-lp1890406-utempter-focal
Merge into: ubuntu/+source/tmux:ubuntu/focal-devel
Diff against target: 64 lines (+42/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/add-utempter-code.patch (+32/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior (community) Approve
Canonical Server Pending
Review via email: mp+401482@code.launchpad.net

Description of the change

This fixes a regression that gets tmux not to record logins through utmp for its sessions (https://github.com/tmux/tmux/issues/2022). The bug was fixed upstream in https://github.com/tmux/tmux/commit/54efe337993b5571728a09b247c7f39d493659a8
by reintroducing the code that calls utempter to register the tmux session in utmp.

This patch cherry-picks commit 54efe33 from upstream to add back utempter code to avoid users in tmux sessions not being accounted by the system.

I built and manually tested the package to confirm that the bug has been fixed.

A PPA with the proposed fix is available at https://launchpad.net/~athos-ribeiro/+archive/ubuntu/tmux-lp1890406/+packages

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I'll review this one.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the MP, Athos.

It's looking good! I'm leaving a few very minor comments, but it's almost ready to be sponsored.

Just a few comments about the MP itself:

- I try to include as much information as possible in the description. It helps the reviewer to understand the whole picture. For example, explain the problem, the investigation, mention that the build was fine, provide a direct link to the PPA, mention whether the package has dep8 tests and whether they've succeeded, etc.

- Since this is an SRU, we usually file MPs after we've written the SRU template. I don't know if you've had the opportunity to read more about it (we can talk about this later), but the SRU template is needed to explain to the SRU team why this update is important. We usually review the MP *and* the SRU template, and provide any pertinent comments.

I will mark this MP as "Needs Information" because of the SRU template. Once that is done and reviewed, I can approve it and sponsor the upload.

Thanks!

review: Needs Information
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Also, yay for the first (right!?) patch & upload! *party dance*

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks for the input!

I updated the description and also updated the original but to include the SRU template.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the updates, Athos.

A couple of comments:

- In the MP description, it's easier if you include the direct link to the PPA :-). Also, I like to mention whether the package has dep8 tests or not, and if it does, I also paste the summary of a test run. In tmux's case, given that it doesn't have dep8 tests, I'd just mention something like "I built and manually tested the package to confirm that the bug has been fixed". No need to update the current description, though; this is an advice for your next MPs.

- In the SRU template, please move the "Original Description" section to the end of it. We want to make sure the the important sections (Impact, Test Case and Where problems could occur) are at the top. Otherwise, I liked the template you wrote, good job! Just a small comment: it seems you wrote the template in another editor and copied it into Launchpad. I think this messed up the line breaks, which makes the template format seem strange.

- Since you've discovered the upstream issue related to this bug, then you should also add a "Bug:" header to the patch and link the GitHub issue. Also, the "Author:" header should be written in the "Name <email>" format (see the inline comment I left).

Let me know once you've addressed the comments above, and I can upload the package. Thanks again!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks for the input, Sergio!

I have addressed your comments. I also changed the PPA and triggered a build for all the needed arches. LP is taking a while to process the x86_64 build though (there is a long queue there).

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks a lot, Athos! This is looking great now :-). I built the package locally on amd64 and know that it works, so I went ahead and uploaded it. Good job.

$ git push pkg upload/3.0a-2ubuntu0.3
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 8 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.99 KiB | 291.00 KiB/s, done.
Total 11 (delta 7), reused 0 (delta 0)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/tmux
 * [new tag] upload/3.0a-2ubuntu0.3 -> upload/3.0a-2ubuntu0.3

$ dput tmux_3.0a-2ubuntu0.3_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/tmux/tmux_3.0a-2ubuntu0.3_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/tmux/tmux_3.0a-2ubuntu0.3.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading tmux_3.0a-2ubuntu0.3.dsc: done.
  Uploading tmux_3.0a-2ubuntu0.3.debian.tar.xz: done.
  Uploading tmux_3.0a-2ubuntu0.3_source.buildinfo: done.
  Uploading tmux_3.0a-2ubuntu0.3_source.changes: done.
Successfully uploaded packages.

review: Approve
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks Sergio!

I added ubuntu-sru to the Bug.

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 8d4d73c..467c322 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+tmux (3.0a-2ubuntu0.3) focal; urgency=medium
7+
8+ * Fix "tmux sessions do not show up with who, users, etc" (LP: #1890406)
9+ - d/p/add-utempter-code.patch:
10+ Cherry-pick commit 54efe33 from upstream to add back utempter code to
11+ avoid users in tmux sessions not being accounted by the system.
12+
13+ -- Athos Ribeiro <athos.ribeiro@canonical.com> Thu, 22 Apr 2021 16:39:18 -0300
14+
15 tmux (3.0a-2ubuntu0.2) focal-security; urgency=medium
16
17 * SECURITY UPDATE: Stack buffer overflow
18diff --git a/debian/patches/add-utempter-code.patch b/debian/patches/add-utempter-code.patch
19new file mode 100644
20index 0000000..1b5dbf2
21--- /dev/null
22+++ b/debian/patches/add-utempter-code.patch
23@@ -0,0 +1,32 @@
24+From: Nicholas Marriott <nicholas.marriott@gmail.com>
25+Date: Wed, 18 Dec 2019 15:58:06 +0000
26+Subject: Add back utempter code, reported by Peter Schellenbach.
27+
28+Origin: upstream, https://github.com/tmux/tmux/commit/54efe337993b5571728a09b247c7f39d493659a8
29+Bug: https://github.com/tmux/tmux/issues/2022
30+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/tmux/+bug/1890406
31+Last-Update: 2021-04-22
32+---
33+ spawn.c | 9 +++++++++
34+ 1 file changed, 9 insertions(+)
35+
36+diff --git a/spawn.c b/spawn.c
37+index 348a4e5..43ae64b 100644
38+--- a/spawn.c
39++++ b/spawn.c
40+@@ -424,6 +424,15 @@ spawn_pane(struct spawn_context *sc, char **cause)
41+ _exit(1);
42+
43+ complete:
44++#ifdef HAVE_UTEMPTER
45++ if (~new_wp->flags & PANE_EMPTY) {
46++ xasprintf(&cp, "tmux(%lu).%%%u", (long)getpid(), new_wp->id);
47++ utempter_add_record(new_wp->fd, cp);
48++ kill(getpid(), SIGCHLD);
49++ free(cp);
50++ }
51++#endif
52++
53+ new_wp->pipe_off = 0;
54+ new_wp->flags &= ~PANE_EXITED;
55+
56diff --git a/debian/patches/series b/debian/patches/series
57index 11e22dc..8ba0015 100644
58--- a/debian/patches/series
59+++ b/debian/patches/series
60@@ -1,3 +1,4 @@
61 platform-quirks.diff
62 limit-lazy-resize-to-panes-in-attached-sessions-only.patch
63 CVE-2020-27347.patch
64+add-utempter-code.patch

Subscribers

People subscribed via source and target branches