Merge ~bryce/ubuntu/+source/squid:fix-lp676141-noble into ubuntu/+source/squid:ubuntu/noble-devel

Proposed by Bryce Harrington
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: fecdce8b53d7d071786cef2fae8143a96d85a0ce
Proposed branch: ~bryce/ubuntu/+source/squid:fix-lp676141-noble
Merge into: ubuntu/+source/squid:ubuntu/noble-devel
Diff against target: 90 lines (+65/-0)
3 files modified
debian/changelog (+7/-0)
debian/rules (+4/-0)
debian/source_squid.py (+54/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Utkarsh Gupta (community) Approve
Canonical Server Reporter Pending
Canonical Server Core Reviewers Pending
Review via email: mp+459094@code.launchpad.net

Description of the change

Adds an apport hook for squid, that adds a couple config files and (optionally) some log files.

Bug: https://bugs.launchpad.net/ubuntu/+source/squid/+bug/676141
PPA: https://launchpad.net/~bryce/+archive/ubuntu/squid-fix-lp676141

To test, install this package on noble, and then run:
  $ python3 /usr/share/apport/package-hooks/source_squid.py

This will dump to the console what it would attach to the bug. Unfortunately squid's config file consists of a huge amount of commented out lines, but I don't think it's worth filtering pre-submission and risk losing something important.

To post a comment you must log in.
Revision history for this message
Utkarsh Gupta (utkarsh) :
review: Needs Information
Revision history for this message
Bryce Harrington (bryce) :
Revision history for this message
Utkarsh Gupta (utkarsh) :
review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: bryce, utkarsh
Uploaders: bryce, utkarsh
MP auto-approved

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks Utkarsh, uploaded:

Successfully signed dsc, buildinfo, changes files
Vcs-Git: https://git.launchpad.net/~bryce/ubuntu/+source/squid
Vcs-Git-Commit: fecdce8b53d7d071786cef2fae8143a96d85a0ce
Vcs-Git-Ref: refs/heads/fix-lp676141-noble
$ dput ubuntu ../squid_6.5-1ubuntu2_source.changes
gpg: ../squid_6.5-1ubuntu2_source.changes: Valid signature from E603B2578FB8F0FB
gpg: ../squid_6.5-1ubuntu2.dsc: Valid signature from E603B2578FB8F0FB
D: Setting host argument.
Checking signature on .changes
Checking signature on .dsc
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading squid_6.5-1ubuntu2.dsc: done.
  Uploading squid_6.5-1ubuntu2.debian.tar.xz: done.
  Uploading squid_6.5-1ubuntu2_source.buildinfo: done.
  Uploading squid_6.5-1ubuntu2_source.changes: done.
Successfully uploaded packages.

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 1eb4efa..e279bbd 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+squid (6.5-1ubuntu2) noble; urgency=medium
7+
8+ * d/source_squid.py, d/rules: Add apport hook
9+ (LP: #676141)
10+
11+ -- Bryce Harrington <bryce@canonical.com> Thu, 18 Jan 2024 15:13:36 -0800
12+
13 squid (6.5-1ubuntu1) noble; urgency=medium
14
15 * Merge with Debian unstable (LP: #2040426). Remaining changes:
16diff --git a/debian/rules b/debian/rules
17index df1c1f5..8c6860a 100755
18--- a/debian/rules
19+++ b/debian/rules
20@@ -165,6 +165,10 @@ execute_after_dh_auto_install:
21 dh_apparmor --profile-name=usr.sbin.squid -psquid
22
23 override_dh_install:
24+ # Apport hook
25+ dh_install -psquid-common debian/source_squid.py \
26+ usr/share/apport/package-hooks/
27+
28 dh_install -psquid -psquid-common -psquidclient -psquid-cgi -psquid-purge \
29 --sourcedir=$(INSTALLDIR)
30 dh_install -psquid-openssl \
31diff --git a/debian/source_squid.py b/debian/source_squid.py
32new file mode 100644
33index 0000000..c23e6da
34--- /dev/null
35+++ b/debian/source_squid.py
36@@ -0,0 +1,54 @@
37+#!/usr/bin/python3
38+
39+'''
40+Apport package hook for Squid
41+
42+Copyright (C) 2022 Canonical Ltd.
43+Author: Bryce Harrington <bryce@canonical.com>
44+
45+This program is free software; you can redistribute it and/or modify it
46+under the terms of the GNU General Public License as published by the
47+Free Software Foundation; either version 2 of the License, or (at your
48+option) any later version. See http://www.gnu.org/copyleft/gpl.html for
49+the full text of the license.
50+'''
51+
52+import os.path
53+from apport.hookutils import attach_file_if_exists
54+
55+
56+def add_info(report, ui=None):
57+ '''Attaches squid-specific information to the Apport bug report.'''
58+ def _add_file(report, filepath):
59+ filename = os.path.basename(filepath)
60+ attach_file_if_exists(report, filepath, key=filename)
61+
62+ # Configs
63+ _add_file(report, '/etc/squid/squid.conf')
64+ _add_file(report, '/etc/squid/squid.d/debian.conf')
65+
66+ if ui is None:
67+ return
68+
69+ # Logs
70+ response = ui.yesno(
71+ "The contents of your Squid cache.log and access.log files "
72+ "may help developers diagnose your bug more quickly. "
73+ "However, they may contain sensitive " "information. "
74+ "Do you want to include them in your bug report?"
75+ )
76+ if response is None:
77+ # user cancelled
78+ raise StopIteration
79+ if response is True:
80+ # Attach files
81+ _add_file(report, '/var/log/squid/access.log')
82+ _add_file(report, '/var/log/squid/cache.log')
83+
84+
85+### DEBUGGING ###
86+if __name__ == '__main__':
87+ report = {}
88+ add_info(report, None)
89+ for key in report:
90+ print(f'[{key}]\n{report[key]}')

Subscribers

People subscribed via source and target branches