[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

needrestart broken in stretch-backports



Hi,

The version of needrestart in stretch-backports crashes systematically
on some software. Some charitable soul on GitHub tracked down the
problem (it happens when trying to access the path of a running binary
sandboxed by systemd, that's why it seems to be running fine for most
people; for me, it crashes on all my servers because of munin-node, also
from backports) and suggested a very simple patch [1].

The problem is fixed in glibc 2.28, that's also why it doesn't happen on
Buster. Unfortunately, for that reason, upstream refused the patch (they
consider it a bug in third-party code, which is technically not wrong).

I prepared a DEP-3 compliant patch for the version currently in
stretch-backports, based on Antti Salmela's patch, and checked that it
works (it does, at least for me). It can be imported directly in quilt.

[1] https://github.com/liske/needrestart/pull/125#issuecomment-448111336
[2] https://github.com/liske/needrestart/pull/125#issuecomment-458309578

Regards,

-- 
Raphaël Halimi
Description: Fix "Can't cd to (unreachable)" error
 Some daemons sandboxed by systemd make needrestart crash. This bug is fixed in
 glibc 2.28, but Stretch has 2.24 only, so needrestart in stretch-backports
 needs this patch to work properly.
Author: Antti Salmela
Origin: other, https://github.com/liske/needrestart/pull/125#issuecomment-448111336
Forwarded: not-needed
Last-Update: 2019-05-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/perl/lib/NeedRestart/Interp/Perl.pm
+++ b/perl/lib/NeedRestart/Interp/Perl.pm
@@ -57,7 +57,7 @@
 	return undef;
     }
     my $cwd = getcwd();
-    chdir("/proc/$pid/root/$ptable->{cwd}");
+    chdir(readlink("/proc/$pid/root") . "/$ptable->{cwd}");
 
     # skip the process if the cwd is unreachable (i.e. due to mnt ns)
     unless(getcwd()) {
@@ -111,7 +111,7 @@
 	return ();
     }
     my $cwd = getcwd();
-    chdir("/proc/$pid/root/$ptable->{cwd}");
+    chdir(readlink("/proc/$pid/root") . "/$ptable->{cwd}");
 
     # skip the process if the cwd is unreachable (i.e. due to mnt ns)
     unless(getcwd()) {

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: