[PATCH] gnu: Add blktrace.

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Marius Bakke
  • Vincent Legoll
Owner
unassigned
Submitted by
Vincent Legoll
Severity
normal
V
V
Vincent Legoll wrote on 15 Mar 2020 21:52
(address . guix-patches@gnu.org)
CAEwRq=r6iuWO-DQcSwBPmfkY4Mm_75DDF8Q0O0XNydR+GA+2Vg@mail.gmail.com
Lightly tested on qemu VM, seems working OK

--
Vincent Legoll
From 016265a4594239a9fa3f98031b0d89397b89cfe3 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <vincent.legoll@gmail.com>
Date: Sun, 15 Mar 2020 21:25:54 +0100
Subject: [PATCH] gnu: Add blktrace.

* gnu/packages/linux.scm (blktrace): New variable.
---
gnu/packages/linux.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index fda7570d89..4d966a2cad 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4013,6 +4013,37 @@ system calls, important for the performance of databases and other advanced
applications.")
(license license:lgpl2.1+)))
+(define-public blktrace
+ (let ((commit "f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc")
+ (revision "0"))
+ (package
+ (name "blktrace")
+ (version (git-version "1.2.0" revision commit))
+ (home-page
+ "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url home-page)
+ (commit commit)))
+ (sha256
+ (base32 "1ihdfimg7mfcgdm6l09xfqx5kdyv42x743dxp3z3w65q5vd7xy89"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags
+ (list "CC=gcc" (string-append "prefix=" %output))
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases (delete 'configure)))) ; no configure script
+ (inputs
+ `(("libaio" ,libaio)))
+ (synopsis "Block layer IO tracing mechanism")
+ (description "Blktrace is a block layer IO tracing mechanism which provides
+detailed information about request queue operations to user space. It extracts
+event traces from the kernel (via the relaying through the debug file system).")
+ (license license:gpl2))))
+
(define-public sbc
(package
(name "sbc")
--
2.25.1
V
V
Vincent Legoll wrote on 15 Mar 2020 22:00
(address . 40083@debbugs.gnu.org)
CAEwRq=rSZJ_hkDXNmQvuxZZmrtsStkm3hgcHD=zjHFkpTYk=jQ@mail.gmail.com
The use of git instead of released tarball is to have the commit for
fixing CVE-2018-10689

--
Vincent Legoll
V
V
Vincent Legoll wrote on 15 Mar 2020 22:47
(address . 40083@debbugs.gnu.org)
CAEwRq=r09C4W_SXWGfEWwJpciz-tsZNB0M8gAB9SOawvqM_OVg@mail.gmail.com
Dunno what to do about the packaged .py scripts, Should I patch the
shebang ? ("#! /usr/bin/env python") after adding python to inputs ?

On Sun, Mar 15, 2020 at 10:00 PM Vincent Legoll
<vincent.legoll@gmail.com> wrote:
Toggle quote (9 lines)
>
> The use of git instead of released tarball is to have the commit for
> fixing CVE-2018-10689
>
> --
> Vincent Legoll



--
Vincent Legoll
L
L
Ludovic Courtès wrote on 19 Mar 2020 15:04
Re: [bug#40083] [PATCH] gnu: Add blktrace.
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)(address . 40083@debbugs.gnu.org)
87a74c5tkk.fsf@gnu.org
Hi!

Vincent Legoll <vincent.legoll@gmail.com> skribis:

Toggle quote (3 lines)
> Dunno what to do about the packaged .py scripts, Should I patch the
> shebang ? ("#! /usr/bin/env python") after adding python to inputs ?

Just do something like this:
Toggle diff (14 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index d19c20d056..0822748968 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4036,7 +4036,8 @@ applications.")
#:phases
(modify-phases %standard-phases (delete 'configure)))) ; no configure script
(inputs
- `(("libaio" ,libaio)))
+ `(("libaio" ,libaio)
+ ("python" ,python-wrapper))) ;for 'bno_plot.py'
(synopsis "Block layer IO tracing mechanism")
(description "Blktrace is a block layer IO tracing mechanism which provides
detailed information about request queue operations to user space. It extracts
and the .py files will be automatically patched.

However, ‘bno_plot.py’ refers to /bin/rm and gnuplot, and these
references should probably be replaced with absolute file names.

Could you take a look and send an updated patch?

Thanks,
Ludo’.
V
V
Vincent Legoll wrote on 19 Mar 2020 16:05
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 40083@debbugs.gnu.org)
CAEwRq=qkjehnTvDyqLw=UPiv6gCPBW2Gh15-zqxn2L9sGYK3-Q@mail.gmail.com
Hello,

On Thu, Mar 19, 2020 at 3:05 PM Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (7 lines)
> Vincent Legoll <vincent.legoll@gmail.com> skribis:
>
> > Dunno what to do about the packaged .py scripts, Should I patch the
> > shebang ? ("#! /usr/bin/env python") after adding python to inputs ?
>
> Just do something like this:

[something's missing here] ;-)

Toggle quote (7 lines)
> and the .py files will be automatically patched.
>
> However, ‘bno_plot.py’ refers to /bin/rm and gnuplot, and these
> references should probably be replaced with absolute file names.
>
> Could you take a look and send an updated patch?

I already have that patched out, replacing that rm call with pure
python code, I'll resubmit a new version correcting all those glitches
later.

Now's time for a bit of sunlight to placebo-help fight covid...

--
Vincent Legoll
M
M
Marius Bakke wrote on 19 Mar 2020 16:48
(address . 40083@debbugs.gnu.org)
87y2rw9whm.fsf@devup.no
Vincent Legoll <vincent.legoll@gmail.com> writes:

Toggle quote (12 lines)
> Hello,
>
> On Thu, Mar 19, 2020 at 3:05 PM Ludovic Courtès <ludo@gnu.org> wrote:
>> Vincent Legoll <vincent.legoll@gmail.com> skribis:
>>
>> > Dunno what to do about the packaged .py scripts, Should I patch the
>> > shebang ? ("#! /usr/bin/env python") after adding python to inputs ?
>>
>> Just do something like this:
>
> [something's missing here] ;-)

Hm? There is an inline patch. It renders nicely in my mail client, as
well as on issues.guix.gnu.org:

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl5zlEUACgkQoqBt8qM6
VPo2EAf/fGPXy8ThnnMP8UfIxGMaw3pBnnvb3qedQ25KLmewoO+MOEN2HpxnCFb5
PONVE13UZ+nXInZcmZG7FE/nUgpAfWSAt7nbBM84SRL4Kis6ANxSI7ZDt6qkPGtb
9m8BvZ/O7xAxVwrmv8YlOHRfECHqjl+H+Qz+xNIC38FCM8HuXfPLtoVr+ZEEI6J/
jgisMUppI8LSLkTOIDJPE/Z7xu9bTkgWfsGE6fJPMAKv51nANOYh1OfjmaLC+qB2
INc+8p5AejjC2NnjYNOY6CfzyJX3vzk+Q753WBzxWpwPEr0nvASasA1IFucREe5E
PFb0YlZ2iZAGsa/zJh098tkF+l2aDQ==
=Z6oS
-----END PGP SIGNATURE-----

V
V
Vincent Legoll wrote on 19 Mar 2020 17:01
(name . Marius Bakke)(address . mbakke@fastmail.com)
CAEwRq=qodCfH7busdV1Vg4W03X+5NtHv7o_ocWcVW8y42uUBuw@mail.gmail.com
On Thu, Mar 19, 2020 at 4:48 PM Marius Bakke <mbakke@fastmail.com> wrote:
Toggle quote (8 lines)
> Vincent Legoll <vincent.legoll@gmail.com> writes:
> > [something's missing here] ;-)
>
> Hm? There is an inline patch. It renders nicely in my mail client, as
> well as on issues.guix.gnu.org:
>
> https://issues.guix.gnu.org/issue/40083#3

Yes, I've seen it on the guix issues site, but gmail is not showing it
properly...

--
Vincent Legoll
V
V
Vincent Legoll wrote on 19 Mar 2020 18:25
(name . Marius Bakke)(address . mbakke@fastmail.com)
CAEwRq=qg9ZzBDAgVLJ64115_eS99eKiosnt622QHcQKM9hFoDA@mail.gmail.com
Is that better ?

I intend to submit the rmtree patch (along a bunch of other cleanups)
to upstream, will update guix packaging when that will happen...

On Thu, Mar 19, 2020 at 5:01 PM Vincent Legoll <vincent.legoll@gmail.com> wrote:
Toggle quote (18 lines)
>
> On Thu, Mar 19, 2020 at 4:48 PM Marius Bakke <mbakke@fastmail.com> wrote:
> > Vincent Legoll <vincent.legoll@gmail.com> writes:
> > > [something's missing here] ;-)
> >
> > Hm? There is an inline patch. It renders nicely in my mail client, as
> > well as on issues.guix.gnu.org:
> >
> > https://issues.guix.gnu.org/issue/40083#3
>
> Yes, I've seen it on the guix issues site, but gmail is not showing it
> properly...
>
> --
> Vincent Legoll



--
Vincent Legoll
From 262d13d62b85bc62dfb2b0aa888d621081b8fa65 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <vincent.legoll@gmail.com>
Date: Sun, 15 Mar 2020 21:25:54 +0100
Subject: [PATCH] gnu: Add blktrace.

* gnu/packages/linux.scm (blktrace): New variable.
* gnu/packages/patches/blktrace-use-rmtree.patch: Add file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
gnu/local.mk | 2 +
gnu/packages/linux.scm | 41 +++++++++++++++++++
.../patches/blktrace-use-rmtree.patch | 32 +++++++++++++++
3 files changed, 75 insertions(+)
create mode 100644 gnu/packages/patches/blktrace-use-rmtree.patch

Toggle diff (112 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ca3f2664aa..28731ecc46 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -27,6 +27,7 @@
# Copyright © 2019 Brett Gilio <brettg@gnu.org>
# Copyright © 2019 Amin Bandali <mab@gnu.org>
# Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+# Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
#
# This file is part of GNU Guix.
#
@@ -766,6 +767,7 @@ dist_patch_DATA = \
%D%/packages/patches/binutils-loongson-workaround.patch \
%D%/packages/patches/blender-2.79-newer-ffmpeg.patch \
%D%/packages/patches/blender-2.79-python-3.7-fix.patch \
+ %D%/packages/patches/blktrace-use-rmtree.patch \
%D%/packages/patches/bluez-CVE-2020-0556.patch \
%D%/packages/patches/byobu-writable-status.patch \
%D%/packages/patches/calibre-no-updates-dialog.patch \
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 0e649d0fe3..719ed7cad9 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4012,6 +4012,47 @@ system calls, important for the performance of databases and other advanced
applications.")
(license license:lgpl2.1+)))
+(define-public blktrace
+ (let ((commit "f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc")
+ (revision "0"))
+ (package
+ (name "blktrace")
+ (version (git-version "1.2.0" revision commit))
+ (home-page
+ "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url home-page)
+ (commit commit)))
+ (sha256
+ (base32 "1ihdfimg7mfcgdm6l09xfqx5kdyv42x743dxp3z3w65q5vd7xy89"))
+ (file-name (git-file-name name version))
+ (patches (search-patches "blktrace-use-rmtree.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags
+ (list "CC=gcc" (string-append "prefix=" %output))
+ #:tests? #f ; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure) ; no configure script
+ (add-after 'unpack 'fix-gnuplot-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gnuplot (assoc-ref inputs "gnuplot")))
+ (substitute* "btt/bno_plot.py"
+ (("gnuplot %s")
+ (string-append gnuplot "/bin/gnuplot %s")))))))))
+ (inputs
+ `(("libaio" ,libaio)
+ ("gnuplot" ,gnuplot)
+ ("python" ,python-wrapper))) ;for 'bno_plot.py'
+ (synopsis "Block layer IO tracing mechanism")
+ (description "Blktrace is a block layer IO tracing mechanism which provides
+detailed information about request queue operations to user space. It extracts
+event traces from the kernel (via the relaying through the debug file system).")
+ (license license:gpl2))))
+
(define-public sbc
(package
(name "sbc")
diff --git a/gnu/packages/patches/blktrace-use-rmtree.patch b/gnu/packages/patches/blktrace-use-rmtree.patch
new file mode 100644
index 0000000000..bb0a10da72
--- /dev/null
+++ b/gnu/packages/patches/blktrace-use-rmtree.patch
@@ -0,0 +1,32 @@
+From 6d1ce4a3a1a561644695a50c00cbd28494728061 Mon Sep 17 00:00:00 2001
+From: Vincent Legoll <vincent.legoll@gmail.com>
+Date: Mon, 16 Mar 2020 11:43:19 +0100
+Subject: [PATCH 02/10] bno_plot.py: Use shutil.rmtree() instead of
+ os.system('/bin/rm')
+
+---
+ btt/bno_plot.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/btt/bno_plot.py b/btt/bno_plot.py
+index f05cfdc..36fc524 100644
+--- a/btt/bno_plot.py
++++ b/btt/bno_plot.py
+@@ -40,7 +40,7 @@ To exit the plotter, enter 'quit' or ^D at the 'gnuplot> ' prompt.
+
+ from __future__ import absolute_import
+ from __future__ import print_function
+-import getopt, glob, os, sys, tempfile
++import getopt, glob, os, sys, tempfile, shutil
+
+ verbose = 0
+ cmds = """
+@@ -125,4 +125,4 @@ if __name__ == '__main__':
+ sys.exit(1)
+
+ os.waitpid(pid, 0)
+- os.system('/bin/rm -rf ' + tmpdir)
++ shutil.rmtree(tmpdir)
+--
+2.20.1
+
--
2.25.1
M
M
Marius Bakke wrote on 20 Mar 2020 18:35
(name . Vincent Legoll)(address . vincent.legoll@gmail.com)
87lfnv7wuh.fsf@devup.no
Vincent Legoll <vincent.legoll@gmail.com> writes:

Toggle quote (2 lines)
> Is that better ?

LGTM.

Toggle quote (3 lines)
> I intend to submit the rmtree patch (along a bunch of other cleanups)
> to upstream, will update guix packaging when that will happen...

Great!

[...]
Toggle quote (4 lines)
> +(define-public blktrace
> + (let ((commit "f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc")
> + (revision "0"))

I added a comment about why we take this commit instead of the latest
tagged version.

[...]

Toggle quote (7 lines)
> + (add-after 'unpack 'fix-gnuplot-path
> + (lambda* (#:key inputs #:allow-other-keys)
> + (let ((gnuplot (assoc-ref inputs "gnuplot")))
> + (substitute* "btt/bno_plot.py"
> + (("gnuplot %s")
> + (string-append gnuplot "/bin/gnuplot %s")))))))))

...and ended this phase on a #t.

Applied!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl50/vYACgkQoqBt8qM6
VPrzOAf/exTVOZ05aqMurI1UzuC11/Gqz1E1eiqAiSMwfiMdEqIq6vbhcdoI2cQr
LoEIWhMdX9x4tGPUVW1cIttBFWuT7ImH8zrc3Mv5ToVJQicETctZHMOQZBlq4kvK
5iMXzM3zAyVRI9gTSS3jeW5cX0LMNXrEAamZeLUqzOHSTmbNxVsnJbRwTNRZv+YR
9Tv2UW8xQ0qnfRiGKwrUMVmC8d6Xr8OyjYlRYTAr3oYHgORK4Y5rdbq3hnAu8nRp
r2Q4EShbiYp6qqrI9e+KiISkkQY+Nro291YnaPue9lRaBW8jD8Kk84LmqgeB1PQn
4av2rja3tWT7+8SHk8WHyYvdoHvGnw==
=7VKc
-----END PGP SIGNATURE-----

Closed
V
V
V
Vincent Legoll wrote on 21 Mar 2020 13:08
[PATCH] gnu: blktrace: Update to db4f634.
CAEwRq=pq-NhgLDbEFjFObVOzqKwTPA3ZR6Nyju_NnS6JMfKfkA@mail.gmail.com
Wow, that was fast !

The cleanup series got applied instantly, in
retrospect, I should have done it before
submitting blktrace for inclusion in guix, it
would have caused less churn...

I incremented revision, is that the right
thing to do ?

--
Vincent Legoll
From d07ad04673f45cbfe8c01721de12667ba65ed9e6 Mon Sep 17 00:00:00 2001
From: Vincent Legoll <vincent.legoll@gmail.com>
Date: Sat, 21 Mar 2020 12:58:33 +0100
Subject: [PATCH] gnu: blktrace: Update to db4f634.

* gnu/packages/linux.scm (blktrace): Update to db4f634.
[revision]: Increment variable.
[patches]: Remove variable.
* gnu/packages/patches/blktrace-use-rmtree.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Remove it.
---
gnu/local.mk | 1 -
gnu/packages/linux.scm | 9 +++---
.../patches/blktrace-use-rmtree.patch | 32 -------------------
3 files changed, 4 insertions(+), 38 deletions(-)
delete mode 100644 gnu/packages/patches/blktrace-use-rmtree.patch

Toggle diff (79 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index f2f096c51c..0f1a694044 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -768,7 +768,6 @@ dist_patch_DATA = \
%D%/packages/patches/binutils-loongson-workaround.patch \
%D%/packages/patches/blender-2.79-newer-ffmpeg.patch \
%D%/packages/patches/blender-2.79-python-3.7-fix.patch \
- %D%/packages/patches/blktrace-use-rmtree.patch \
%D%/packages/patches/bluez-CVE-2020-0556.patch \
%D%/packages/patches/byobu-writable-status.patch \
%D%/packages/patches/calibre-no-updates-dialog.patch \
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 12da3c8f63..a1973c1e60 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4014,8 +4014,8 @@ applications.")
(define-public blktrace
;; Take a newer commit to get the fix for CVE-2018-10689.
- (let ((commit "f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc")
- (revision "0"))
+ (let ((commit "db4f6340e04716285ea56fe26d76381c3adabe58")
+ (revision "1"))
(package
(name "blktrace")
(version (git-version "1.2.0" revision commit))
@@ -4027,9 +4027,8 @@ applications.")
(url home-page)
(commit commit)))
(sha256
- (base32 "1ihdfimg7mfcgdm6l09xfqx5kdyv42x743dxp3z3w65q5vd7xy89"))
- (file-name (git-file-name name version))
- (patches (search-patches "blktrace-use-rmtree.patch"))))
+ (base32 "0ah7xn4qnx09k6bm39p69av7d0c8cl6863drv6a1nf914sq1kpgp"))
+ (file-name (git-file-name name version))))
(build-system gnu-build-system)
(arguments
'(#:make-flags
diff --git a/gnu/packages/patches/blktrace-use-rmtree.patch b/gnu/packages/patches/blktrace-use-rmtree.patch
deleted file mode 100644
index bb0a10da72..0000000000
--- a/gnu/packages/patches/blktrace-use-rmtree.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 6d1ce4a3a1a561644695a50c00cbd28494728061 Mon Sep 17 00:00:00 2001
-From: Vincent Legoll <vincent.legoll@gmail.com>
-Date: Mon, 16 Mar 2020 11:43:19 +0100
-Subject: [PATCH 02/10] bno_plot.py: Use shutil.rmtree() instead of
- os.system('/bin/rm')
-
----
- btt/bno_plot.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/btt/bno_plot.py b/btt/bno_plot.py
-index f05cfdc..36fc524 100644
---- a/btt/bno_plot.py
-+++ b/btt/bno_plot.py
-@@ -40,7 +40,7 @@ To exit the plotter, enter 'quit' or ^D at the 'gnuplot> ' prompt.
-
- from __future__ import absolute_import
- from __future__ import print_function
--import getopt, glob, os, sys, tempfile
-+import getopt, glob, os, sys, tempfile, shutil
-
- verbose = 0
- cmds = """
-@@ -125,4 +125,4 @@ if __name__ == '__main__':
- sys.exit(1)
-
- os.waitpid(pid, 0)
-- os.system('/bin/rm -rf ' + tmpdir)
-+ shutil.rmtree(tmpdir)
---
-2.20.1
-
--
2.25.1
?
Your comment

This issue is archived.

To comment on this conversation send an email to 40083@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 40083
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch