summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:43:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:43:00 +0000
commit89853c290fd822a88c56150dde50aaa1421c0c8c (patch)
treec88de9d39f187cf339e1add1f768bbda4a61130f /debian/patches
parentAdding upstream version 4.2. (diff)
downloadmdadm-89853c290fd822a88c56150dde50aaa1421c0c8c.tar.xz
mdadm-89853c290fd822a88c56150dde50aaa1421c0c8c.zip
Adding debian version 4.2-5.debian/4.2-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/debian-conffile-location.diff104
-rw-r--r--debian/patches/debian-no-Werror.diff24
-rw-r--r--debian/patches/documentation-keys-in-service-files.patch77
-rw-r--r--debian/patches/exit-gracefully-when-md-device-not-found.patch25
-rw-r--r--debian/patches/fix-command-line-help.patch18
-rw-r--r--debian/patches/fix-manpages.patch200
-rw-r--r--debian/patches/host-name-in-default-mailfrom.patch21
-rw-r--r--debian/patches/mdmonitor-service-simplify.diff20
-rw-r--r--debian/patches/readlink-path.patch21
-rw-r--r--debian/patches/series12
-rw-r--r--debian/patches/sha1-includes.diff40
-rw-r--r--debian/patches/strcat-look-for-md-device-in-dev-md.patch17
-rw-r--r--debian/patches/test-installed.patch32
13 files changed, 611 insertions, 0 deletions
diff --git a/debian/patches/debian-conffile-location.diff b/debian/patches/debian-conffile-location.diff
new file mode 100644
index 0000000..a11a9e0
--- /dev/null
+++ b/debian/patches/debian-conffile-location.diff
@@ -0,0 +1,104 @@
+From: martin f. krafft <madduck@debian.org>
+Subject: Set /etc/mdadm/mdadm.conf as primary config file location
+
+On Debian, the configuration file resides primarily in /etc/mdadm/mdadm.conf,
+/etc/mdadm.conf is only used as a backup.
+
+This is a Debian-specific patch.
+
+Forwarded: not-needed
+Reviewed-by: martin f. krafft <madduck@debian.org>
+
+---
+ Makefile | 4 ++--
+ ReadMe.c | 2 +-
+ mdadm.8.in | 14 ++++++--------
+ mdadm.conf.5 | 2 +-
+ mdassemble.8 | 2 +-
+ 5 files changed, 11 insertions(+), 13 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -74,8 +74,8 @@ CPPFLAGS += -DBINDIR=\"$(BINDIR)\"
+ PKG_CONFIG ?= pkg-config
+
+ SYSCONFDIR = /etc
+-CONFFILE = $(SYSCONFDIR)/mdadm.conf
+-CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf
++CONFFILE = $(SYSCONFDIR)/mdadm/mdadm.conf
++CONFFILE2 = $(SYSCONFDIR)/mdadm.conf
+ MAILCMD =/usr/sbin/sendmail -t
+ CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
+ # Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
+--- a/ReadMe.c
++++ b/ReadMe.c
+@@ -613,7 +613,7 @@ char Help_incr[] =
+ ;
+
+ char Help_config[] =
+-"The /etc/mdadm.conf config file:\n\n"
++"The /etc/mdadm/mdadm.conf config file:\n\n"
+ " The config file contains, apart from blank lines and comment lines that\n"
+ " start with a hash(#), array lines, device lines, and various\n"
+ " configuration lines.\n"
+--- a/mdadm.8.in
++++ b/mdadm.8.in
+@@ -267,13 +267,13 @@ the exact meaning of this option in diff
+ .TP
+ .BR \-c ", " \-\-config=
+ Specify the config file or directory. Default is to use
+-.B /etc/mdadm.conf
++.B /etc/mdadm/mdadm.conf
+ and
+-.BR /etc/mdadm.conf.d ,
++.BR /etc/mdadm/mdadm.conf.d ,
+ or if those are missing then
+-.B /etc/mdadm/mdadm.conf
++.B /etc/mdadm.conf
+ and
+-.BR /etc/mdadm/mdadm.conf.d .
++.BR /etc/mdadm.conf.d .
+ If the config file given is
+ .B "partitions"
+ then nothing will be read, but
+@@ -2009,9 +2009,9 @@ The config file is only used if explicit
+ or requested with (a possibly implicit)
+ .BR \-\-scan .
+ In the later case,
+-.B /etc/mdadm.conf
+-or
+ .B /etc/mdadm/mdadm.conf
++or
++.B /etc/mdadm.conf
+ is used.
+
+ If
+@@ -3340,7 +3340,7 @@ uses this to find arrays when
+ is given in Misc mode, and to monitor array reconstruction
+ on Monitor mode.
+
+-.SS /etc/mdadm.conf
++.SS /etc/mdadm/mdadm.conf (or /etc/mdadm.conf)
+
+ The config file lists which devices may be scanned to see if
+ they contain MD super block, and gives identifying information
+@@ -3348,7 +3348,7 @@ they contain MD super block, and gives i
+ .BR mdadm.conf (5)
+ for more details.
+
+-.SS /etc/mdadm.conf.d
++.SS /etc/mdadm/mdadm.conf.d (or /etc/mdadm.conf.d)
+
+ A directory containing configuration files which are read in lexical
+ order.
+--- a/mdadm.conf.5
++++ b/mdadm.conf.5
+@@ -8,7 +8,7 @@
+ .SH NAME
+ mdadm.conf \- configuration for management of Software RAID with mdadm
+ .SH SYNOPSIS
+-/etc/mdadm.conf
++/etc/mdadm/mdadm.conf
+ .SH DESCRIPTION
+ .PP
+ .I mdadm
diff --git a/debian/patches/debian-no-Werror.diff b/debian/patches/debian-no-Werror.diff
new file mode 100644
index 0000000..371df52
--- /dev/null
+++ b/debian/patches/debian-no-Werror.diff
@@ -0,0 +1,24 @@
+From: martin f. krafft <madduck@debian.org>
+Subject: Remove -Werror from compiler flags
+
+-Werror seems like a bad idea on released/packaged code because a toolchain
+update (introducing new warnings) could break the build. We'll let upstream
+use it to beautify the code, but remove it for out builds.
+
+Signed-off-by: martin f. krafft <madduck@debian.org>
+
+---
+ Makefile | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -50,7 +50,7 @@ ifeq ($(origin CC),default)
+ CC := $(CROSS_COMPILE)gcc
+ endif
+ CXFLAGS ?= -ggdb
+-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
++CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter
+ ifdef WARN_UNUSED
+ CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
+ endif
diff --git a/debian/patches/documentation-keys-in-service-files.patch b/debian/patches/documentation-keys-in-service-files.patch
new file mode 100644
index 0000000..a100208
--- /dev/null
+++ b/debian/patches/documentation-keys-in-service-files.patch
@@ -0,0 +1,77 @@
+Description: Make adjustments to systemd files provided by upstream
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/systemd/mdcheck_continue.service
++++ b/systemd/mdcheck_continue.service
+@@ -7,7 +7,8 @@
+
+ [Unit]
+ Description=MD array scrubbing - continuation
+-ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_*
++ConditionPathExistsGlob=/var/lib/mdcheck/MD_UUID_*
++Documentation=man:mdadm(8)
+
+ [Service]
+ Type=oneshot
+--- a/systemd/mdcheck_start.service
++++ b/systemd/mdcheck_start.service
+@@ -8,6 +8,7 @@
+ [Unit]
+ Description=MD array scrubbing
+ Wants=mdcheck_continue.timer
++Documentation=man:mdadm(8)
+
+ [Service]
+ Type=oneshot
+--- a/systemd/mdmonitor-oneshot.service
++++ b/systemd/mdmonitor-oneshot.service
+@@ -7,6 +7,7 @@
+
+ [Unit]
+ Description=Reminder for degraded MD arrays
++Documentation=man:mdadm(8)
+
+ [Service]
+ Environment=MDADM_MONITOR_ARGS=--scan
+--- a/systemd/mdadm-grow-continue@.service
++++ b/systemd/mdadm-grow-continue@.service
+@@ -8,6 +8,7 @@
+ [Unit]
+ Description=Manage MD Reshape on /dev/%I
+ DefaultDependencies=no
++Documentation=man:mdadm(8)
+
+ [Service]
+ ExecStart=BINDIR/mdadm --grow --continue /dev/%I
+--- a/systemd/mdadm-last-resort@.service
++++ b/systemd/mdadm-last-resort@.service
+@@ -2,6 +2,7 @@
+ Description=Activate md array %I even though degraded
+ DefaultDependencies=no
+ ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
++Documentation=man:mdadm(8)
+
+ [Service]
+ Type=oneshot
+--- a/systemd/mdmon@.service
++++ b/systemd/mdmon@.service
+@@ -9,6 +9,7 @@
+ Description=MD Metadata Monitor on /dev/%I
+ DefaultDependencies=no
+ Before=initrd-switch-root.target
++Documentation=man:mdmon(8)
+
+ [Service]
+ # mdmon should never complain due to lack of a platform,
+--- a/systemd/mdmonitor.service
++++ b/systemd/mdmonitor.service
+@@ -8,6 +8,7 @@
+ [Unit]
+ Description=MD array monitor
+ DefaultDependencies=no
++Documentation=man:mdadm(8)
+
+ [Service]
+ Environment= MDADM_MONITOR_ARGS=--scan
diff --git a/debian/patches/exit-gracefully-when-md-device-not-found.patch b/debian/patches/exit-gracefully-when-md-device-not-found.patch
new file mode 100644
index 0000000..c6a34d5
--- /dev/null
+++ b/debian/patches/exit-gracefully-when-md-device-not-found.patch
@@ -0,0 +1,25 @@
+Description: Exit gracefully when md device not found
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970329
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Monitor.c
++++ b/Monitor.c
+@@ -539,8 +539,14 @@ static int check_array(struct state *st,
+ if (fd < 0)
+ goto disappeared;
+
+- if (st->devnm[0] == 0)
+- strcpy(st->devnm, fd2devnm(fd));
++ if (st->devnm[0] == 0) {
++ char *found = fd2devnm(fd);
++ if (!found) {
++ alert("DeviceDisappeared", dev, NULL, ainfo);
++ goto out;
++ }
++ strcpy(st->devnm, found);
++ }
+
+ for (mse2 = mdstat; mse2; mse2 = mse2->next)
+ if (strcmp(mse2->devnm, st->devnm) == 0) {
diff --git a/debian/patches/fix-command-line-help.patch b/debian/patches/fix-command-line-help.patch
new file mode 100644
index 0000000..dd7ae3d
--- /dev/null
+++ b/debian/patches/fix-command-line-help.patch
@@ -0,0 +1,18 @@
+Description: Make command-line help consistent with manual page.
+ Mode was missing.
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932791
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/ReadMe.c
++++ b/ReadMe.c
+@@ -477,7 +477,7 @@ char Help_assemble[] =
+ ;
+
+ char Help_manage[] =
+-"Usage: mdadm arraydevice options component devices...\n"
++"Usage: mdadm [mode] arraydevice [options] <component devices...>\n"
+ "\n"
+ "This usage is for managing the component devices within an array.\n"
+ "The --manage option is not needed and is assumed if the first argument\n"
diff --git a/debian/patches/fix-manpages.patch b/debian/patches/fix-manpages.patch
new file mode 100644
index 0000000..abe2cc0
--- /dev/null
+++ b/debian/patches/fix-manpages.patch
@@ -0,0 +1,200 @@
+Description: Fix typos and macro issues in manpages
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915182
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916946
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962946
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933773
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/md.4
++++ b/md.4
+@@ -363,9 +363,9 @@ tab(;);
+ ;Device #1;Device #2;Device #3;Device #4
+ 0x00;0;0;1;1
+ 0x01;2;2;3;3
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
+ :;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
+ 0x80;254;254;255;255
+ ;\\---------v---------/;\\---------v---------/
+ ;RAID1;RAID1
+@@ -392,9 +392,9 @@ C.
+ ;Dev #1;Dev #2;Dev #3;Dev #4;Dev #5
+ 0x00;0;0;1;1;2
+ 0x01;2;3;3;4;4
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
+ :;:;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
+ 0x80;317;318;318;319;319
+ ;
+ .TE
+@@ -454,15 +454,15 @@ C.
+ ;
+ 0x00;0;1;2;3;\\
+ 0x01;4;5;6;7;> [#]
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ :;:;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ 0x40;252;253;254;255;/
+ 0x41;3;0;1;2;\\
+ 0x42;7;4;5;6;> [#]~
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ :;:;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ 0x80;255;252;253;254;/
+ ;
+ .TE
+@@ -493,15 +493,15 @@ C.
+ ;
+ 0x00;0;1;2;3;4;\\
+ 0x01;5;6;7;8;9;> [#]
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ :;:;:;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ 0x40;315;316;317;318;319;/
+ 0x41;4;0;1;2;3;\\
+ 0x42;9;5;6;7;8;> [#]~
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ :;:;:;:;:;:;:
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
+ 0x80;319;315;316;317;318;/
+ ;
+ .TE
+@@ -572,9 +572,9 @@ C.
+ 0x01;3;0;1;2;) AA~
+ 0x02;4;5;6;7;) AB
+ 0x03;7;4;5;6;) AB~
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
+ :;:;:;:;:; :
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
+ 0x79;251;252;253;254;) EX
+ 0x80;254;251;252;253;) EX~
+ ;
+@@ -605,9 +605,9 @@ C.
+ 0x01;4;0;1;2;3;) AA~
+ 0x02;5;6;7;8;9;) AB
+ 0x03;9;5;6;7;8;) AB~
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
+ :;:;:;:;:;:; :
+-\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
++;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
+ 0x79;314;315;316;317;318;) EX
+ 0x80;318;314;315;316;317;) EX~
+ ;
+@@ -987,7 +987,7 @@ other device(s).
+ .I md
+ cannot control the timeout that the underlying devices use to
+ determine failure. Any changes desired to that timeout must be set
+-explictly on the underlying device, separately from using
++explicitly on the underlying device, separately from using
+ .IR mdadm .
+
+ If a FAILFAST request does fail, and if it is still safe to mark the
+--- a/mdadm.8.in
++++ b/mdadm.8.in
+@@ -461,11 +461,10 @@ number of spare devices.
+ .BR \-z ", " \-\-size=
+ Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6.
+ This must be a multiple of the chunk size, and must leave about 128Kb
+-of space at the end of the drive for the RAID superblock.
+-If this is not specified
+-(as it normally is not) the smallest drive (or partition) sets the
+-size, though if there is a variance among the drives of greater than 1%, a warning is
+-issued.
++of space at the end of the drive for the RAID superblock. When specified as
++\(acmax\(ac (as it often is) the smallest drive (or partition) sets the size.
++In that case, a warning will follow if the drives, as a group, have sizes that
++differ by more than one percent.
+
+ A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes,
+ Megabytes, Gigabytes or Terabytes respectively.
+@@ -682,7 +681,7 @@ A bug introduced in Linux 3.14 means tha
+ started using a different layout. This could lead to
+ data corruption. Since Linux 5.4 (and various stable releases that received
+ backports), the kernel will not accept such an array unless
+-a layout is explictly set. It can be set to
++a layout is explicitly set. It can be set to
+ .RB ' original '
+ or
+ .RB ' alternate '.
+@@ -924,6 +923,7 @@ the
+ .B name
+ will default to
+ .IR home .
++(Does not work in Grow mode.)
+
+ .TP
+ .BR \-R ", " \-\-run
+@@ -1133,7 +1133,7 @@ out-of-date. If
+ cannot find enough working devices to start the array, but can find
+ some devices that are recorded as having failed, then it will mark
+ those devices as working so that the array can be started. This works only for
+-native. For external metadata it allows to start dirty degraded RAID 4, 5, 6.
++native. For external metadata it allows one to start dirty degraded RAID 4, 5, 6.
+ An array which requires
+ .B \-\-force
+ to be started may contain data corruption. Use it carefully.
+@@ -1446,7 +1446,7 @@ array, and the slot that it used is stil
+ be added back to the array in the same position. This will normally
+ cause the data for that device to be recovered. However based on the
+ event count on the device, the recovery may only require sections that
+-are flagged a write-intent bitmap to be recovered or may not require
++are flagged by a write-intent bitmap to be recovered or may not require
+ any recovery at all.
+
+ When used on an array that has no metadata (i.e. it was built with
+@@ -1821,7 +1821,7 @@ Details of
+ .B check
+ and
+ .B repair
+-can be found it
++can be found in
+ .IR md (4)
+ under
+ .BR "SCRUBBING AND MISMATCHES" .
+@@ -2901,7 +2901,7 @@ long time. A
+ is required. If the array is not simultaneously being grown or
+ shrunk, so that the array size will remain the same - for example,
+ reshaping a 3-drive RAID5 into a 4-drive RAID6 - the backup file will
+-be used not just for a "cricital section" but throughout the reshape
++be used not just for a "critical section" but throughout the reshape
+ operation, as described below under LAYOUT CHANGES.
+
+ .SS CHUNK-SIZE AND LAYOUT CHANGES
+@@ -2939,7 +2939,8 @@ option in Grow mode. Currently this work
+ .B ppl
+ and
+ .B resync
+-policies and allows to enable or disable the RAID5 Partial Parity Log (PPL).
++policies and allows one to enable or disable the RAID5 Partial Parity
++Log (PPL).
+
+ .SH INCREMENTAL MODE
+
+--- a/mdmon.8
++++ b/mdmon.8
+@@ -115,7 +115,7 @@ container. Some array management comman
+ add are now only valid at the container level. Attempts to perform
+ these actions on member arrays are blocked with error messages like:
+ .IP
+-"mdadm: Cannot remove disks from a \'member\' array, perform this
++"mdadm: Cannot remove disks from a \(aqmember\(aq array, perform this
+ operation on the parent container"
+ .P
+ Containers are identified in /proc/mdstat with a metadata version string
diff --git a/debian/patches/host-name-in-default-mailfrom.patch b/debian/patches/host-name-in-default-mailfrom.patch
new file mode 100644
index 0000000..487866a
--- /dev/null
+++ b/debian/patches/host-name-in-default-mailfrom.patch
@@ -0,0 +1,21 @@
+Description: Add host name to default MAILFROM
+ The host on which the error occurred is mentioned in the subject and also in
+ the message body, but some may find it useful in the From address, as well.
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Bug-Debian: https://bugs.debian.org/1006464
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Monitor.c
++++ b/Monitor.c
+@@ -440,8 +440,8 @@ static void alert(char *event, char *dev
+ if (info->mailfrom)
+ fprintf(mp, "From: %s\n", info->mailfrom);
+ else
+- fprintf(mp, "From: %s monitoring <root>\n",
+- Name);
++ fprintf(mp, "From: %s monitoring <root@%s>\n",
++ Name, hname);
+ fprintf(mp, "To: %s\n", info->mailaddr);
+ fprintf(mp, "Subject: %s event on %s:%s\n\n",
+ event, dev, hname);
diff --git a/debian/patches/mdmonitor-service-simplify.diff b/debian/patches/mdmonitor-service-simplify.diff
new file mode 100644
index 0000000..70ddea2
--- /dev/null
+++ b/debian/patches/mdmonitor-service-simplify.diff
@@ -0,0 +1,20 @@
+Subject: simplify mdmonitor.service
+From: Michael Tokarev <mjt@tls.msk.ru>
+Date: Fri, 14 Nov 2014 19:18:05 +0300
+Bug-Debian: http://bugs.debian.org/764647
+Forwarded: no
+
+There isn't much for customization for mdadm --monitor.
+it'll just do what it's supposed to do, so just run it.
+
+--- a/systemd/mdmonitor.service
++++ b/systemd/mdmonitor.service
+@@ -11,7 +11,4 @@ DefaultDependencies=no
+ Documentation=man:mdadm(8)
+
+ [Service]
+-Environment= MDADM_MONITOR_ARGS=--scan
+-EnvironmentFile=-/run/sysconfig/mdadm
+-ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
+-ExecStart=BINDIR/mdadm --monitor $MDADM_MONITOR_ARGS
++ExecStart=BINDIR/mdadm --monitor --scan
diff --git a/debian/patches/readlink-path.patch b/debian/patches/readlink-path.patch
new file mode 100644
index 0000000..0b1ad6c
--- /dev/null
+++ b/debian/patches/readlink-path.patch
@@ -0,0 +1,21 @@
+From: Michael Tokarev <mjt@tls.msk.ru>
+Subject: readlink is in /bin not /usr/bin on debian
+Date: Fri, 14 Nov 2014 19:11:51 +0300
+Bug-Debian: http://bugs.debian.org/766416
+Forwarded: no
+
+This is a debian-specific change, upstream ships
+the rule to use /usr/bin/readlink while on debian
+it is /bin/readlink
+
+--- a/udev-md-raid-arrays.rules
++++ b/udev-md-raid-arrays.rules
+@@ -37,7 +37,7 @@ ENV{ID_FS_USAGE}=="filesystem|other", EN
+ ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service"
+
+ # Tell systemd to run mdmon for our container, if we need it.
+-ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
++ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c"
+ ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service"
+ ENV{RESHAPE_ACTIVE}=="yes", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdadm-grow-continue@%c.service"
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..e6f1bf6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,12 @@
+fix-manpages.patch
+fix-command-line-help.patch
+documentation-keys-in-service-files.patch
+mdmonitor-service-simplify.diff
+host-name-in-default-mailfrom.patch
+exit-gracefully-when-md-device-not-found.patch
+strcat-look-for-md-device-in-dev-md.patch
+sha1-includes.diff
+readlink-path.patch
+debian-no-Werror.diff
+debian-conffile-location.diff
+test-installed.patch
diff --git a/debian/patches/sha1-includes.diff b/debian/patches/sha1-includes.diff
new file mode 100644
index 0000000..0dfd7da
--- /dev/null
+++ b/debian/patches/sha1-includes.diff
@@ -0,0 +1,40 @@
+From: Michael Tokarev <mjt@tls.msk.ru>
+Subject: do not #include ansidecl.h from sha1.h, use system headers
+
+In 3.2.5 version of mdadm, new sha1 implementation has been included
+which tries to include ansidecl.h header which is internal to some
+other project. But this #include isn't really necessary, since this
+implementation does not actually use any defines from ansidecl.h. So
+just remove the #include, instead of adding a new external dependency.
+
+References: http://www.spinics.net/lists/raid/msg38859.html
+
+While at it, unconditionally include system headers like limits.h and
+stdint.h, since on a Linux system these headers are available, and
+these contains definitive information about real system types than
+any guesses.
+
+--- a/sha1.h
++++ b/sha1.h
+@@ -22,7 +22,7 @@
+
+ #include <stdio.h>
+
+-#if defined HAVE_LIMITS_H || _LIBC
++#if 1 /* defined HAVE_LIMITS_H || _LIBC */
+ # include <limits.h>
+ #endif
+
+@@ -33,9 +33,9 @@
+ the resulting executable. Locally running cross-compiled executables
+ is usually not possible. */
+
+-#ifdef _LIBC
+-# include <sys/types.h>
+-typedef u_int32_t sha1_uint32;
++#if 1 /* def _LIBC */
++# include <stdint.h>
++typedef uint32_t sha1_uint32;
+ typedef uintptr_t sha1_uintptr;
+ #else
+ # define INT_MAX_32_BITS 2147483647
diff --git a/debian/patches/strcat-look-for-md-device-in-dev-md.patch b/debian/patches/strcat-look-for-md-device-in-dev-md.patch
new file mode 100644
index 0000000..083fd77
--- /dev/null
+++ b/debian/patches/strcat-look-for-md-device-in-dev-md.patch
@@ -0,0 +1,17 @@
+Description: Look for md device in /dev/md
+Author: Martin Mares <mj@ucw.cz>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958060
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Monitor.c
++++ b/Monitor.c
+@@ -188,7 +188,7 @@ int Monitor(struct mddev_dev *devlist,
+ st->devname = xstrdup(mdlist->devname);
+ else {
+ st->devname = xmalloc(8+strlen(mdlist->devname)+1);
+- strcpy(strcpy(st->devname, "/dev/md/"),
++ strcat(strcpy(st->devname, "/dev/md/"),
+ mdlist->devname);
+ }
+ st->next = statelist;
diff --git a/debian/patches/test-installed.patch b/debian/patches/test-installed.patch
new file mode 100644
index 0000000..0fe678e
--- /dev/null
+++ b/debian/patches/test-installed.patch
@@ -0,0 +1,32 @@
+Description: Test installed files
+ The test suite seems to check the executable bit on the local build product
+ 'mdadm' but runs all programs from the system PATH. This change should test
+ the installed version.
+ .
+ I believe this change tests the installed version, but that hypothesis is not
+ supported by much else. The autopkgtest restriction isolation-machine made it
+ difficult so far to run the test suite anywhere.
+ .
+ The entire setup is untested and may require further modification in order to
+ function.
+ .
+ Incorporates a suggestion from the fdisk maintainer to specify the fdisk
+ prerequisite explicitly.
+Author: Felix Lechner <felix.lechner@lease-up.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872118
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/tests/func.sh
++++ b/tests/func.sh
+@@ -101,10 +101,6 @@ check_env() {
+ echo "test: testing can only be done as 'root'."
+ exit 1
+ }
+- [ \! -x $mdadm ] && {
+- echo "test: please run make everything before perform testing."
+- exit 1
+- }
+ cmds=(mdadm lsblk df udevadm losetup mkfs.ext3 fsck seq)
+ for cmd in ${cmds[@]}
+ do