1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
The Debian packaging of debug-me is maintained in git, using the
merging workflow described in dgit-maint-merge(7). There isn't a
patch queue that can be represented as a quilt series.
A detailed breakdown of the changes is available from their canonical
representation - git commits in the packaging repository. For
example, to see the changes made by the Debian maintainer in the first
upload of upstream version 1.2.3, you could use:
% git clone https://git.dgit.debian.org/debug-me
% cd debug-me
% git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian'
(If you have dgit, use `dgit clone debug-me`, rather than plain `git
clone`.)
A single combined diff, containing all the changes, follows.
--- debug-me-1.20170505.orig/CHANGELOG
+++ debug-me-1.20170505/CHANGELOG
@@ -1,3 +1,15 @@
+debug-me (1.20170506) UNRELEASED; urgency=medium
+
+ * Server: Use "postmaster" as default --from-email address
+ rather than "unknown@server".
+ * Server: DEBUG_ME_FROM_EMAIL can be used to specify the --from-email.
+ This is used in debug-me.default to encourage configuring it.
+ Thanks, Sean Whitton.
+ * Avoid crash when --use-server is given an url that does not
+ include a path.
+
+ -- Joey Hess <id@joeyh.name> Tue, 09 May 2017 11:45:41 -0400
+
debug-me (1.20170505) unstable; urgency=medium
* First release of debug-me.
--- debug-me-1.20170505.orig/Server.hs
+++ debug-me-1.20170505/Server.hs
@@ -33,6 +33,7 @@ import System.IO
import System.Directory
import System.Mem.Weak
import Network.Mail.Mime
+import System.Environment
type ServerState = M.Map SessionID Session
@@ -95,7 +96,9 @@ closeSession :: Session -> STM ()
closeSession (Session bchan _ _) = closeTMChan bchan
server :: ServerOpts -> IO ()
-server o = runSettings settings . app o =<< newServerState
+server o = do
+ o' <- checkEnv o
+ runSettings settings . app o' =<< newServerState
where
settings =
-- Prefer IPv6 but allow IPv4 as well
@@ -105,6 +108,12 @@ server o = runSettings settings . app o
setPort (serverPort o) $
defaultSettings
+checkEnv :: ServerOpts -> IO ServerOpts
+checkEnv o = go <$> lookupEnv "DEBUG_ME_FROM_EMAIL"
+ where
+ go Nothing = o
+ go (Just email) = o { serverEmail = Just (T.pack email) }
+
app :: ServerOpts -> TVar ServerState -> Application
app o ssv = websocketsOr connectionOptions (websocketApp o ssv) webapp
where
@@ -262,7 +271,7 @@ emailSessionLog email o logfile
| otherwise = return ()
where
to = Address Nothing email
- from = Address Nothing $ fromMaybe "unknown@server" (serverEmail o)
+ from = Address Nothing $ fromMaybe "postmaster" (serverEmail o)
subject = "Your recent debug-me session"
body = "Attached is the log from your recent debug-me session."
isemail = "@" `T.isInfixOf` email
--- debug-me-1.20170505.orig/WebSockets.hs
+++ debug-me-1.20170505/WebSockets.hs
@@ -144,7 +144,9 @@ runClientApp serverurl app = do
port = case uriPort serverauth of
(':':s) -> fromMaybe 80 (readMaybe s)
_ -> 80
- endpoint = uriPath serverurl
+ endpoint = case uriPath serverurl of
+ [] -> "/"
+ p -> p
catchconnclosed ConnectionClosed = Just ()
catchconnclosed _ = Nothing
--- debug-me-1.20170505.orig/debug-me.1
+++ debug-me-1.20170505/debug-me.1
@@ -88,6 +88,8 @@ Specify a port for the debug-me server t
.IP "--from-email address"
The server will email session logs to users. It's a good idea to
provide a real email address, otherwise a dummy one will be used.
+You can also set the enviroment variable DEBUG_ME_FROM_EMAIL to configure
+this.
.IP "--delete-old-logs"
Normally the server will retain old log files so that users and developers
can refer to them. This option makes it delete the log file once the
--- debug-me-1.20170505.orig/debug-me.default
+++ debug-me-1.20170505/debug-me.default
@@ -1,2 +1,6 @@
+# Configure the email address that debug-me uses when emailing logs to
+# users.
+DEBUG_ME_FROM_EMAIL=postmaster
+
# Parameters to pass to debug-me when it's started as a daemon.
DAEMON_PARAMS="--server /var/log/debug-me/ --delete-old-logs"
--- debug-me-1.20170505.orig/debug-me.init
+++ debug-me-1.20170505/debug-me.init
@@ -33,7 +33,7 @@ case "$1" in
start-stop-daemon --start --quiet --oknodo \
--background --no-close \
--pidfile "$PIDFILE" --make-pidfile \
- --chuid debug-me:debug-me \
+ --chuid _debug-me:_debug-me \
--exec "$DAEMON" -- $DAEMON_PARAMS \
> /var/log/debug-me.log
log_end_msg $?
--- debug-me-1.20170505.orig/debug-me.service
+++ debug-me-1.20170505/debug-me.service
@@ -8,8 +8,8 @@ EnvironmentFile=-/etc/default/debug-me
ExecStart=/usr/bin/debug-me $DAEMON_PARAMS
InaccessiblePaths=/home /etc
ReadWritePaths=/var/log/debug-me
-User=debug-me
-Group=debug-me
+User=_debug-me
+Group=_debug-me
StandardInput=null
StandardOutput=journal
StandardError=journal
|