Subject: [alpine-aports] [PATCH] main/openssh: Fix pid dir expectation in confd and initd files.

From: Przemyslaw Pawelczyk <[email-masked]>
Date: Fri, 19 Aug 2016 01:37:11 +0200

Since commit 71eb72d62425082850604f526dbcbfdcf2808c31 (2016-03-13,
pre-v3.4) openssh is build with pid dir explicitly set to /run.
The change was not reflected in sshd.confd or sshd.initd, though,
and sadly not even in the commit message.
(Before it was set implicitly to /var/run.)

/var/run and /run semantics are the same, but AL does not truly
guarantee (at least yet) that the first is symlinked to the latter
(which is a common practice among Linux distributions nowadays, where
/run is tmpfs mounted very early - in AL openrc's init.sh does that).
alpine-baselayout package simply has run and var/run directories and
they are not related in any way from the package point of view.

Unless you create such symlink yourself or it is created via openrc's
boot service bootmisc (performing /var/run -> /run migration and some
other stuff), you cannot use /var/run/ and /run/ paths interchangeably.

The patch should be applied to 3.4-stable branch too (without changing
pkgver used there and with proper pkgrel increment, of course).
I was seeing false crashed state next to sshd in rc-status after
upgrading AL from 3.3 to 3.4 on machine where bootmisc is not used.
(I don't think it's a grave enough lack to warrant patch rejection.)
---
 main/openssh/APKBUILD   | 14 +++++++-------
 main/openssh/sshd.confd |  2 +-
 main/openssh/sshd.initd |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/main/openssh/APKBUILD b/main/openssh/APKBUILD
index 458e5ba5146d..d6a02e0d8943 100644
--- a/main/openssh/APKBUILD
+++ b/main/openssh/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=openssh
 pkgver=7.3_p1
 _myver=${pkgver%_*}${pkgver#*_}
-pkgrel=0
+pkgrel=1
 pkgdesc="Port of OpenBSD's free SSH release"
 url="http://www.openssh.org/portable.html"
 arch="all"
@@ -114,22 +114,22 @@ cd52fe99cb4b7d0d847bf5d710d93564  openssh6.5-peaktput.diff
 6337ad8a38783c8f1285cf4f97fc451f  openssh7.1-dynwindows.diff
 37fbfe9cfb9a5e2454382ea8c79ed2e1  openssh-fix-utmp.diff
 e21243d6ddff1bb929eed3676b4b9a2a  bsd-compatible-realpath.patch
-8590e08286f47a777725655873dd318f  sshd.initd
-b35e9f3829f4cfca07168fcba98749c7  sshd.confd
+8ae02e304db5d42790b7269b03a8985f  sshd.initd
+ccff4ede2075bcdaa070940cb4eadba2  sshd.confd
 2dd7e366607e95f9762273067309fd6e  openssh-sftp-interactive.diff"
 sha256sums="3ffb989a6dcaa69594c3b550d4855a5a2e1718ccdde7f5e36387b424220fbecc  openssh-7.3p1.tar.gz
 bf49212e47a86d10650f739532cea514a310925e6445b4f8011031b6b55f3249  openssh6.5-peaktput.diff
 861132af07c18f5e0ac7b64f389a929e61a051887bf44bda770a97e3afd9bfb6  openssh7.1-dynwindows.diff
 1c85437fd94aa4fc269e6297e4eb790baa98c39949ec0410792c09ee31ba9782  openssh-fix-utmp.diff
 a843cacd7002a68e9d09b5d8ea1466c9980fa35fa3ccd8d9357ac793017de2a6  bsd-compatible-realpath.patch
-c31a116bba900c6c4795b061766169e6455d6e1b7cf9aa2ee5ba4eaa1afa76b0  sshd.initd
-29c6d57ac3ec6018cadc6ba6cd9b90c9ed46e20049b970fdcc68ee2481a2ee41  sshd.confd
+18521d52f5e38d5820732356d210fb45922f7b848b7c9ca0bb3823de9e088e1d  sshd.initd
+3342d2fc9b174f898f887237002f04fa9bc01c31e9a851e063ca7de8825ad0eb  sshd.confd
 4ce1ad5f767c0f4e854a0cfeef0e2e400f333c649e552df1ecc317e6a6557376  openssh-sftp-interactive.diff"
 sha512sums="7ba2d6140f38bd359ebf32ef17626e0ae1c00c3a38c01877b7c6b0317d030f10a8f82a0a51fc3b6273619de9ed73e24b8cf107b1e968f927053a3bedf97ff801  openssh-7.3p1.tar.gz
 e041398e177674f698480e23be037160bd07b751c754956a3ddf1b964da24c85e826fb75e7c23c9826d36761da73d08db9583c047d58a08dc7b2149a949075b1  openssh6.5-peaktput.diff
 72a7dc21d18388c635d14dda762ac50caeefd38f0153d8ea36d18e9d7c982e104f7b7a3af8c18fd479c31201fbdee1639f3a1ec60d035d4ca8721a8563fa11a0  openssh7.1-dynwindows.diff
 f35fffcd26635249ce5d820e7b3e406e586f2d2d7f6a045f221e2f9fb53aebc1ab1dd1e603b3389462296ed77921a1d08456e7aaa3825cbed08f405b381a58e1  openssh-fix-utmp.diff
 f2b8daa537ea3f32754a4485492cc6eb3f40133ed46c0a5a29a89e4bcf8583d82d891d94bf2e5eb1c916fa68ec094abf4e6cd641e9737a6c05053808012b3a73  bsd-compatible-realpath.patch
-7e4378daebd8f5df0cd2f0709af806a0d4a78c948b8fc3baaf3585e5f5ec5d0793f7e4d0a450bc43bbcb92daa09bfab482cbceb396b993c0545adfe56573cd44  sshd.initd
-b9ae816af54a55e134a9307e376f05367b815f1b3fd545c2a2c312d18aedcf907f413e8bad8db980cdd9aad4011a72a79e1e94594f69500939a9cb46287f2f81  sshd.confd
+394a420a36880bb0dd37dfd8727cea91fd9de6534050169e21212a46513ef3aaafe2752c338699b3d4ccd14871b26cf01a152df8060cd37f86ce0665fd53c63f  sshd.initd
+ce0abddbd2004891f88efd8522c4b37a4989290269fab339c0fa9aacc051f7fd3b20813e192e92e0e64315750041cb74012d4321260f4865ff69d7a935b259d4  sshd.confd
 c1d09c65dbc347f0904edc30f91aa9a24b0baee50309536182455b544f1e3f85a8cecfa959e32be8b101d8282ef06dde3febbbc3f315489339dcf04155c859a9  openssh-sftp-interactive.diff"
diff --git a/main/openssh/sshd.confd b/main/openssh/sshd.confd
index 28952b4a285a..dbe01daf5296 100644
--- a/main/openssh/sshd.confd
+++ b/main/openssh/sshd.confd
@@ -13,7 +13,7 @@ SSHD_OPTS=""
 
 # Pid file to use (needs to be absolute path).
 
-#SSHD_PIDFILE="/var/run/sshd.pid"
+#SSHD_PIDFILE="/run/sshd.pid"

 # Path to the sshd binary (needs to be absolute path).
diff --git a/main/openssh/sshd.initd b/main/openssh/sshd.initd
index 8fb94d189d0a..065519174042 100755
--- a/main/openssh/sshd.initd
+++ b/main/openssh/sshd.initd
@@ -12,7 +12,7 @@ extra_started_commands="reload"
 
 : ${SSHD_CONFDIR:=/etc/ssh}
 : ${SSHD_CONFIG:=${SSHD_CONFDIR}/sshd_config}
-: ${SSHD_PIDFILE:=/var/run/${SVCNAME}.pid}
+: ${SSHD_PIDFILE:=/run/${SVCNAME}.pid}
 : ${SSHD_BINARY:=/usr/sbin/sshd}
 
 depend() {
@@ -53,7 +53,7 @@ checkconfig() {
 		ssh-keygen -A || return 1
 	fi
 
-	[ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
+	[ "${SSHD_PIDFILE}" != "/run/sshd.pid" ] \
 		&& SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}"
 	[ "${SSHD_CONFIG}" != "/etc/ssh/sshd_config" ] \
 		&& SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFIG}"
-- 
2.8.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---