Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

needrestart (3.5 Debian package) detect Jenkins as wrong positive (seems related to #39) #267

Open
rdemongeot opened this issue Mar 20, 2023 · 2 comments

Comments

@rdemongeot
Copy link

Hello,

Needrestart detect a deleted file from jenkins as an issue.
[main] #416 uses deleted /var/lib/jenkins/.cache/JNA/temp/jna17335196598942629868.tmp
[main] #416 is not a child
[main] #416 exe => /usr/lib/jvm/java-11-openjdk-amd64/bin/java
[Core] #416 is a NeedRestart::Interp::Java
[Core] #416 source is UNKNOWN
[main] #416 is jenkins.service

Related to #48

Please find bellow my (dirty?) patch in order to configure some path in which deleted files are not "critical".

+++ /usr/sbin/needrestart	2023-03-20 12:14:42.745233546 +0100
@@ -140,6 +140,7 @@
     systemctl_combine => 0,
     blacklist => [],
     blacklist_interp => [],
+    blacklist_deleted_files => [],
     blacklist_rc => [],
     blacklist_mappings => [],
     override_rc => {},
@@ -507,9 +508,13 @@
 		    # removed executable mapped files
 		    if($path =~ s/ \(deleted\)$// ||  # Linux
 		       $path =~ s/^\(deleted\)//) {   # Linux VServer
-			print STDERR "$LOGPREF #$pid uses deleted $path\n" if($nrconf{verbosity} > 1);
-			$restart++;
-			last;
+		        if (scalar grep { $path =~ /$_/; } @{$nrconf{blacklist_deleted_files}}) {
+			    print STDERR "$LOGPREF #$pid uses deleted $path but blacklisted\n" if($nrconf{verbosity} > 1);
+		        } else {
+			    print STDERR "$LOGPREF #$pid uses deleted $path\n" if($nrconf{verbosity} > 1);
+			    $restart++;
+			    last;
+		        }
 		    }
 
 		    # check for outdated lib mappings
@rdemongeot
Copy link
Author

Edit: i can't push it even in new branches.

@liske
Copy link
Owner

liske commented May 26, 2023

There is no need to create a new option. You can add a pattern to the blacklist_mappings option. Maybe any path containing a .cache component should be ignored 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants