Postgresql service unit name wrongly cutted

Bug #1746871 reported by Robert Sander
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
needrestart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Whenever needrestart detects that Postgresql needs a restart, it wrongly cuts the service unit name to "5-main.service" and is therefor not able to restart it.

The full service unit name is "postgresql@9.5-main.service".

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: needrestart 2.6-1
ProcVersionSignature: Ubuntu 4.13.0-32.35~16.04.1-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.15
Architecture: amd64
CurrentDesktop: XFCE
Date: Fri Feb 2 08:04:39 2018
PackageArchitecture: all
SourcePackage: needrestart
UpgradeStatus: Upgraded to xenial on 2016-08-19 (531 days ago)

Revision history for this message
Robert Sander (gurubert) wrote :
Revision history for this message
Lienhart Woitok (lienhart-woitok) wrote :

This also affects other services containing a dot in the name, like php7.0-fpm.service, which gets truncated to "0-fpm.service" which obviously can't be found.

This has been fixed in needrestart 2.7, see https://github.com/liske/needrestart/pull/19.

As the fix seems trivial to me maybe this can be fixed in ubuntu Xenial version of needrestart, as I'm sure many people face this bug.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in needrestart (Ubuntu):
status: New → Confirmed
Revision history for this message
Jérôme (jerome-auge) wrote :

I gave a quick look at the `/usr/sbin/needrestart` and the problem seems to be with one (or two) erroneous `if()` statements that performs an affectation to the `$value` instead of doing a regexp match test.

After applying the attached patch, the `postgresql@9.6-main.service` service is correctly detected :

--8<--
# needrestart -r l
Scanning processes...
Scanning candidates...
Scanning linux images...
Running kernel seems to be up-to-date.
Services to be restarted:
systemctl restart postgresql@9.6-main.service
No containers need to be restarted.
-->8--

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "needrestart-2.6-fix-erroneous-assignation-in-if-statements.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.