Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 344072 Details for
Bug 464198
app-admin/eclean-kernel-0.3.1 removes wrong kernels
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Debugging help patch
0001-Report-real-KV-in-list-kernels.patch (text/plain), 2.50 KB, created by
Michał Górny
on 2013-04-02 14:15:24 UTC
(
hide
)
Description:
Debugging help patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2013-04-02 14:15:24 UTC
Size:
2.50 KB
patch
obsolete
>From 2430b36d5025f4785b98299ae786c011ee1eb6f2 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Tue, 2 Apr 2013 16:12:04 +0200 >Subject: [PATCH] Report real KV in --list-kernels. > >--- > ecleankernel/cli.py | 2 +- > ecleankernel/kernel.py | 32 +++++++++++++++++++------------- > 2 files changed, 20 insertions(+), 14 deletions(-) > >diff --git a/ecleankernel/cli.py b/ecleankernel/cli.py >index c388d8d..f0f1e98 100644 >--- a/ecleankernel/cli.py >+++ b/ecleankernel/cli.py >@@ -126,7 +126,7 @@ def main(argv): > > if opts.listkern: > for k in kernels: >- print('%s:' % k.version) >+ print('%s [%s]:' % (k.version, k.real_kv)) > for key in k.parts: > val = getattr(k, key) > if val is not None: >diff --git a/ecleankernel/kernel.py b/ecleankernel/kernel.py >index 53dc6d6..46b1820 100644 >--- a/ecleankernel/kernel.py >+++ b/ecleankernel/kernel.py >@@ -84,6 +84,24 @@ class Kernel(object): > 'modules', 'build') > > @property >+ def real_kv(self): >+ """ Obtain the KV from the kernel, as used by it. """ >+ vmlinuz = self.vmlinuz >+ if vmlinuz is None: >+ return None >+ >+ f = open(vmlinuz, 'rb') >+ f.seek(0x200) >+ buf = f.read(0x10) >+ if buf[2:6] != b'HdrS': >+ raise NotImplementedError('Invalid magic for kernel file %s (!= HdrS)' >+ % path) >+ offset = struct.unpack_from('H', buf, 0x0e)[0] >+ f.seek(offset - 0x10, 1) >+ buf = f.read(0x100) # XXX >+ return str(buf.split(b' ', 1)[0]) >+ >+ @property > def mtime(self): > # prefer vmlinuz, fallback to anything > # XXX: or maybe max()? min()? >@@ -145,18 +163,6 @@ class KernelDict(defaultdict): > def __repr__(self): > return 'KernelDict(%s)' % ','.join(['\n\t%s' % repr(x) for x in self.values()]) > >-def get_real_kv(path): >- f = open(path, 'rb') >- f.seek(0x200) >- buf = f.read(0x10) >- if buf[2:6] != b'HdrS': >- raise NotImplementedError('Invalid magic for kernel file %s (!= HdrS)' >- % path) >- offset = struct.unpack_from('H', buf, 0x0e)[0] >- f.seek(offset - 0x10, 1) >- buf = f.read(0x100) # XXX >- return str(buf.split(b' ', 1)[0]) >- > def find_kernels(exclusions = ()): > """ Find all files and directories related to installed kernels. """ > >@@ -204,7 +210,7 @@ def find_kernels(exclusions = ()): > if newk.build: > kernels['%s.old' % kv].build = builddir > if cat == 'vmlinuz': >- realkv = get_real_kv(path) >+ realkv = newk.real_kv > moduledir = os.path.join('/lib/modules', realkv) > builddir = paths[os.path.join(moduledir, 'build')] > if 'modules' not in exclusions and os.path.isdir(moduledir): >-- >1.8.1.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 464198
: 344072