Imported Debian version 0.56
Javier Fernandez-Sanguino
12 years ago
0 | 0 | #!/usr/bin/python |
1 | 1 | |
2 | 2 | # Copyright (C) 2001 Matt Zimmerman <mdz@debian.org> |
3 | # Copyright (C) 2007,2010 Javier Fernandez-Sanguino <jfs@debian.org> | |
3 | # Copyright (C) 2007,2011 Javier Fernandez-Sanguino <jfs@debian.org> | |
4 | 4 | # - included patch from Justin Pryzby <justinpryzby_AT_users.sourceforge.net> |
5 | 5 | # to work with the latest Lsof - modify to reduce false positives by not |
6 | 6 | # complaining about deleted inodes/files under /tmp/, /var/log/, |
82 | 82 | allFiles = False |
83 | 83 | |
84 | 84 | for o, a in opts: |
85 | if o == "-v": | |
85 | if o in ("-v", "--verbose"): | |
86 | 86 | verbose = True |
87 | 87 | elif o in ("-h", "--help"): |
88 | 88 | usage() |
179 | 179 | if path.startswith('/etc/init.d/'): |
180 | 180 | if path.endswith('.sh'): |
181 | 181 | continue |
182 | package.initscripts.append(path) | |
182 | package.initscripts.add(path) | |
183 | 183 | # Alternatively, find init.d scripts that match the process name |
184 | 184 | if len(package.initscripts) == 0: |
185 | 185 | for process in package.processes: |
186 | 186 | path = '/etc/init.d/' + os.path.basename(process.program) |
187 | 187 | if os.path.exists(path): |
188 | package.initscripts.append(path) | |
189 | # Remove duplicate inits | |
190 | package.initscripts = [ u for u in package.initscripts if u not in locals()['_[1]'] ] | |
188 | package.initscripts.add(path) | |
191 | 189 | |
192 | 190 | restartable = [] |
193 | 191 | nonrestartable = [] |
272 | 270 | # Or about files under /tmp |
273 | 271 | if f.startswith('/tmp/'): |
274 | 272 | return 0 |
273 | # Or about files under /dev/shm | |
274 | if f.startswith('/dev/shm/'): | |
275 | return 0 | |
275 | 276 | # Or about files under /drm |
276 | 277 | if f.startswith('/drm'): |
277 | 278 | return 0 |
287 | 288 | # Or /usr/lib/locale |
288 | 289 | if f.startswith('/usr/lib/locale/'): |
289 | 290 | return 0 |
291 | # Skip files from the user's home directories | |
292 | # many processes hold temporafy files there | |
293 | if f.startswith('/home/'): | |
294 | return 0 | |
290 | 295 | # Skip automatically generated files |
291 | 296 | if f.endswith('icon-theme.cache'): |
292 | 297 | return 0 |
293 | 298 | # Skip font files |
294 | 299 | if f.startswith('/var/cache/fontconfig/'): |
300 | return 0 | |
301 | # Skip Nagios Spool | |
302 | if f.startswith('/var/lib/nagios3/spool/'): | |
295 | 303 | return 0 |
296 | 304 | # Skip, if asked to, files that do not belong to any package |
297 | 305 | if onlyPackageFiles: |
299 | 307 | dpkgProc = subprocess.Popen(dpkgQuery, stdout=subprocess.PIPE, stderr=None) |
300 | 308 | for line in dpkgProc.stdout.readlines(): |
301 | 309 | if line.endswith(f): |
302 | return 0 | |
310 | file_in_package = True | |
311 | break | |
312 | if not file_in_package: | |
313 | return 0 | |
303 | 314 | |
304 | 315 | # TODO: it should only care about library files (i.e. /lib, /usr/lib and the like) |
305 | 316 | # build that check with a regexp to exclude others |
451 | 462 | class Package: |
452 | 463 | def __init__(self, name): |
453 | 464 | self.name = name |
454 | self.initscripts = [] | |
465 | # use a set, we don't need duplicates | |
466 | self.initscripts = set() | |
455 | 467 | self.processes = [] |
456 | 468 | |
457 | 469 | if __name__ == '__main__': |
67 | 67 | also output some false positives depending on the processes' behaviour since |
68 | 68 | it does not check yet if the (deleted) files in use are really libraries. |
69 | 69 | |
70 | .P | |
71 | If you find a false positive in | |
72 | .B checkrestart | |
73 | please provide the following information when submitting a bug report: | |
74 | ||
75 | .IP \(em | |
76 | The output of \fBcheckrestart\fP using the \fI-v\fP (verbose) option. | |
77 | ||
78 | .IP \(em | |
79 | The output of running the following command as root: | |
80 | .PP | |
81 | lsof | egrep 'delete|DEL|path inode' | |
82 | .PP | |
83 | ||
70 | 84 | .P |
71 | 85 | .B Checkrestart |
72 | 86 | is also sensitive to the kernel version in use. And might fail to work with newer |
87 | 101 | .SH COPYRIGHT AND LICENCE |
88 | 102 | |
89 | 103 | Copyright (C) 2001 Matt Zimmerman <mdz@debian.org> |
104 | Copyright (C) 2007,2010-2011 Javier Fernandez-Sanguino <jfs@debian.org> | |
90 | 105 | |
91 | 106 | This program is free software; you can redistribute it and/or modify |
92 | 107 | it under the terms of the GNU General Public License as published by |
0 | debian-goodies (0.56) unstable; urgency=low | |
1 | ||
2 | * [checkrestart]: | |
3 | - Use patch provided by Jörg Sommer and Piotr Kaczuba that makes the | |
4 | script use a set for the initscripts information, thus making the | |
5 | program work with Python 2.7 (Closes: #64397) | |
6 | - Fix behaviour of -p so that it does not consider files that do | |
7 | not belong to any package, thanks to Peter Eisentraut for the | |
8 | patch. (Closes: #608387) | |
9 | - Fix handling of --verbose option (Closes: #623168) | |
10 | - Exclude /dev/shm from the deleted files check, this prevents | |
11 | a false positive from some programs such as jackd2 (Closes: #595096) | |
12 | - Exclude /home from the deleted files check as these | |
13 | generate a number of false positives. This included: GNOME's mixer | |
14 | applet, dovecot, nautilus, chromium-broswer and evolution-data-server | |
15 | (Closes: #595096, #609454) | |
16 | * [checkrestart.1]: | |
17 | - Update the manpage to indicate what information to provide when | |
18 | reporting a false positive in checkrestart | |
19 | * /debmany/man/debmany.1: | |
20 | - Fix typo in manpage (Closes: #600252) | |
21 | ||
22 | ||
23 | -- Javier Fernandez-Sanguino Pen~a <jfs@debian.org> Sun, 09 Oct 2011 20:51:11 +0200 | |
24 | ||
0 | 25 | debian-goodies (0.55) unstable; urgency=low |
1 | 26 | |
2 | 27 | * [ dglob ] Clean up bashims (Closes: #600156) |
37 | 37 | If a file which must be downloaded exceeds the limit, you are asked if the download should start. Without unit the value is in bytes. You can append K, M, G or T to the value to change the unit. |
38 | 38 | .TP |
39 | 39 | \fB\-l lang1[,...]\fR |
40 | English manpages are displayed always. If you want more languages you can specify them here. Provide a comma separated list of the folder names in the manpgage folders (/usr/share/man) \- e.g. de,fr or "zh*" if you want to see all Chinese manpages (Simplified and Traditional Chinese as well). It is safe always to use "*" at the end of your language. | |
40 | English manpages are displayed always. If you want more languages you can specify them here. Provide a comma separated list of the folder names in the manpage folders (/usr/share/man) \- e.g. de,fr or "zh*" if you want to see all Chinese manpages (Simplified and Traditional Chinese as well). It is safe always to use "*" at the end of your language. | |
41 | 41 | During installation automatic generated character set based versions are not available for selection. |
42 | 42 | .TP |
43 | 43 | \fB\-z\fR |