unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#74183] [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page.
@ 2024-11-03  9:13 Artyom V. Poptsov
  2024-11-03  9:14 ` [bug#74183] [PATCH 1/2] gnu: btop: Generate and install the " Artyom V. Poptsov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Artyom V. Poptsov @ 2024-11-03  9:13 UTC (permalink / raw)
  To: 74183; +Cc: Artyom V. Poptsov

This patchset improves btop package in two ways: firstly it fixes a SEGFAULT
error that occurs on Intel GPUs; secondly it allows btop to generate its man
page so it gets installed along with the tool.

Artyom V. Poptsov (2):
  gnu: btop: Generate and install the man page.
  gnu: btop: Fix SEGFAULT error on Intel GPUs.

 gnu/local.mk                                  |  1 +
 gnu/packages/admin.scm                        |  6 ++-
 .../btop-fix-segfault-on-intel-gpus.patch     | 47 +++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch


base-commit: 653121e1abe7e5400d39b326522ea327d90c9e58
-- 
2.46.0





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#74183] [PATCH 1/2] gnu: btop: Generate and install the man page.
  2024-11-03  9:13 [bug#74183] [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
@ 2024-11-03  9:14 ` Artyom V. Poptsov
  2024-11-03  9:14 ` [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs Artyom V. Poptsov
  2024-11-03 10:15 ` bug#74183: [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
  2 siblings, 0 replies; 5+ messages in thread
From: Artyom V. Poptsov @ 2024-11-03  9:14 UTC (permalink / raw)
  To: 74183; +Cc: Artyom V. Poptsov

* gnu/packages/admin.scm (btop)[native-inputs]: Add lowdown to allow
generation and installation of the program man page.

Change-Id: I1eb0c9491d89f21ef408cbcb4fb10f99be46690e
---
 gnu/packages/admin.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 86f35d49ad..bc8f0efdef 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -159,6 +159,7 @@ (define-module (gnu packages admin)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages mail)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages mcrypt)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages ncurses)
@@ -774,6 +775,7 @@ (define-public btop
                (base32
                 "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603"))))
     (build-system gnu-build-system)
+    (native-inputs (list lowdown))
     (arguments
      (list #:tests? #f ;no test suite
            #:make-flags #~(list (string-append "PREFIX=" #$output)
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs.
  2024-11-03  9:13 [bug#74183] [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
  2024-11-03  9:14 ` [bug#74183] [PATCH 1/2] gnu: btop: Generate and install the " Artyom V. Poptsov
@ 2024-11-03  9:14 ` Artyom V. Poptsov
  2024-11-03  9:48   ` Z572
  2024-11-03 10:15 ` bug#74183: [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
  2 siblings, 1 reply; 5+ messages in thread
From: Artyom V. Poptsov @ 2024-11-03  9:14 UTC (permalink / raw)
  To: 74183; +Cc: Artyom V. Poptsov

btop would fail on built-in Intel GPUs, this patch fixes that (see
<https://github.com/aristocratos/btop/pull/958>.)

* gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/admin.scm (btop): Use it.

Change-Id: Ic2bbf55a5f892a37bde17db6fb15025733b9bad6
---
 gnu/local.mk                                  |  1 +
 gnu/packages/admin.scm                        |  4 +-
 .../btop-fix-segfault-on-intel-gpus.patch     | 47 +++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1040b3927b..6f96cf5794 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1018,6 +1018,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/bsd-games-number.c-and-test.patch	\
   %D%/packages/patches/bsd-games-prevent-name-collisions.patch	\
   %D%/packages/patches/bsd-games-stdio.h.patch			\
+  %D%/packages/patches/btop-fix-segfault-on-intel-gpus.patch	\
   %D%/packages/patches/beancount-disable-googleapis-fonts.patch	\
   %D%/packages/patches/beignet-correct-file-names.patch		\
   %D%/packages/patches/bidiv-update-fribidi.patch		\
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index bc8f0efdef..4ae4db641f 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -773,7 +773,9 @@ (define-public btop
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603"))))
+                "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603"))
+              (patches
+               (search-patches "btop-fix-segfault-on-intel-gpus.patch"))))
     (build-system gnu-build-system)
     (native-inputs (list lowdown))
     (arguments
diff --git a/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch
new file mode 100644
index 0000000000..d3618a374a
--- /dev/null
+++ b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch
@@ -0,0 +1,47 @@
+From 0ed4e9e907b3a3f1c2ae209b1dab384b1fa7a490 Mon Sep 17 00:00:00 2001
+From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
+Date: Sun, 3 Nov 2024 09:02:45 +0300
+Subject: [PATCH] intel_name_lookup_shim.c (get_intel_device_name): Fix
+ SEGFAULT
+
+btop would always fail with "Segmentation fault" when used on machines where the
+GPU does not have a codename (e.g. on embedded Intel graphics on Intel(R)
+Atom(TM) CPU D2500.)  The reason for this behavior is that when a GPU does not
+have codename (it is NULL) the call to "strcpy" segfaults as the procedure
+effectively tries to access a NULL pointer.
+
+* src/linux/intel_gpu_top/intel_name_lookup_shim.c (get_intel_device_name): Add
+a check if "info->codename" is null; if it is, set the device name to
+"(unknown)" to prevent the SEGFAULT error.
+---
+ src/linux/intel_gpu_top/intel_name_lookup_shim.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/linux/intel_gpu_top/intel_name_lookup_shim.c b/src/linux/intel_gpu_top/intel_name_lookup_shim.c
+index e714f80..38f87fa 100644
+--- a/src/linux/intel_gpu_top/intel_name_lookup_shim.c
++++ b/src/linux/intel_gpu_top/intel_name_lookup_shim.c
+@@ -84,10 +84,14 @@ char *get_intel_device_name(const char *device_id) {
+     char full_name[256];
+     const struct intel_device_info *info = intel_get_device_info(devid);
+     if (info) {
+-        strcpy(dev_name, info->codename);
+-        dev_name[0] = toupper(dev_name[0]);
++        if (info->codename == NULL) {
++            strcpy(dev_name, "(unknown)");
++        } else {
++            strcpy(dev_name, info->codename);
++            dev_name[0] = toupper(dev_name[0]);
++        }
+         snprintf(full_name, sizeof(full_name), "Intel %s (Gen%u)", dev_name, info->graphics_ver);
+         return strdup(full_name);
+     }
+     return NULL;
+-}
+\ No newline at end of file
++}
+
+base-commit: 2e7208d59c54515080027a5ecbb89d2054047985
+-- 
+2.46.0
+
-- 
2.46.0





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs.
  2024-11-03  9:14 ` [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs Artyom V. Poptsov
@ 2024-11-03  9:48   ` Z572
  0 siblings, 0 replies; 5+ messages in thread
From: Z572 @ 2024-11-03  9:48 UTC (permalink / raw)
  To: Artyom V. Poptsov; +Cc: 74183

[-- Attachment #1: Type: text/plain, Size: 4621 bytes --]

"Artyom V. Poptsov" <poptsov.artyom@gmail.com> writes:

> btop would fail on built-in Intel GPUs, this patch fixes that (see
> <https://github.com/aristocratos/btop/pull/958>.)
>
> * gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/admin.scm (btop): Use it.
>
> Change-Id: Ic2bbf55a5f892a37bde17db6fb15025733b9bad6
> ---
>  gnu/local.mk                                  |  1 +
>  gnu/packages/admin.scm                        |  4 +-
>  .../btop-fix-segfault-on-intel-gpus.patch     | 47 +++++++++++++++++++
>  3 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 1040b3927b..6f96cf5794 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1018,6 +1018,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/bsd-games-number.c-and-test.patch	\
>    %D%/packages/patches/bsd-games-prevent-name-collisions.patch	\
>    %D%/packages/patches/bsd-games-stdio.h.patch			\
> +  %D%/packages/patches/btop-fix-segfault-on-intel-gpus.patch	\
>    %D%/packages/patches/beancount-disable-googleapis-fonts.patch	\
>    %D%/packages/patches/beignet-correct-file-names.patch		\
>    %D%/packages/patches/bidiv-update-fribidi.patch		\
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index bc8f0efdef..4ae4db641f 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -773,7 +773,9 @@ (define-public btop
>                (file-name (git-file-name name version))
>                (sha256
>                 (base32
> -                "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603"))))
> +                "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603"))
> +              (patches
> +               (search-patches "btop-fix-segfault-on-intel-gpus.patch"))))
>      (build-system gnu-build-system)
>      (native-inputs (list lowdown))
>      (arguments
> diff --git a/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch
> new file mode 100644
> index 0000000000..d3618a374a
> --- /dev/null
> +++ b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch
> @@ -0,0 +1,47 @@

please add "https://github.com/aristocratos/btop/pull/958" on
btop-fix-segfault-on-intel-gpus.patch, Let others know the source
without having to look it up. other LGTM.

> +From 0ed4e9e907b3a3f1c2ae209b1dab384b1fa7a490 Mon Sep 17 00:00:00 2001
> +From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
> +Date: Sun, 3 Nov 2024 09:02:45 +0300
> +Subject: [PATCH] intel_name_lookup_shim.c (get_intel_device_name): Fix
> + SEGFAULT
> +
> +btop would always fail with "Segmentation fault" when used on machines where the
> +GPU does not have a codename (e.g. on embedded Intel graphics on Intel(R)
> +Atom(TM) CPU D2500.)  The reason for this behavior is that when a GPU does not
> +have codename (it is NULL) the call to "strcpy" segfaults as the procedure
> +effectively tries to access a NULL pointer.
> +
> +* src/linux/intel_gpu_top/intel_name_lookup_shim.c (get_intel_device_name): Add
> +a check if "info->codename" is null; if it is, set the device name to
> +"(unknown)" to prevent the SEGFAULT error.
> +---
> + src/linux/intel_gpu_top/intel_name_lookup_shim.c | 10 +++++++---
> + 1 file changed, 7 insertions(+), 3 deletions(-)
> +
> +diff --git a/src/linux/intel_gpu_top/intel_name_lookup_shim.c b/src/linux/intel_gpu_top/intel_name_lookup_shim.c
> +index e714f80..38f87fa 100644
> +--- a/src/linux/intel_gpu_top/intel_name_lookup_shim.c
> ++++ b/src/linux/intel_gpu_top/intel_name_lookup_shim.c
> +@@ -84,10 +84,14 @@ char *get_intel_device_name(const char *device_id) {
> +     char full_name[256];
> +     const struct intel_device_info *info = intel_get_device_info(devid);
> +     if (info) {
> +-        strcpy(dev_name, info->codename);
> +-        dev_name[0] = toupper(dev_name[0]);
> ++        if (info->codename == NULL) {
> ++            strcpy(dev_name, "(unknown)");
> ++        } else {
> ++            strcpy(dev_name, info->codename);
> ++            dev_name[0] = toupper(dev_name[0]);
> ++        }
> +         snprintf(full_name, sizeof(full_name), "Intel %s (Gen%u)", dev_name, info->graphics_ver);
> +         return strdup(full_name);
> +     }
> +     return NULL;
> +-}
> +\ No newline at end of file
> ++}
> +
> +base-commit: 2e7208d59c54515080027a5ecbb89d2054047985
> +-- 
> +2.46.0
> +

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#74183: [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page.
  2024-11-03  9:13 [bug#74183] [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
  2024-11-03  9:14 ` [bug#74183] [PATCH 1/2] gnu: btop: Generate and install the " Artyom V. Poptsov
  2024-11-03  9:14 ` [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs Artyom V. Poptsov
@ 2024-11-03 10:15 ` Artyom V. Poptsov
  2 siblings, 0 replies; 5+ messages in thread
From: Artyom V. Poptsov @ 2024-11-03 10:15 UTC (permalink / raw)
  To: 74183-done

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Reviewed by Z572 <zhengjunjie@iscas.ac.cn>.

Merged to the "master" branch as:
- 0d7115b867424240425e5eef20efcf6abf6b7e92
- da70c25a3b6e722a16e15e758373b08d1099ded1

- avp

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-03 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-03  9:13 [bug#74183] [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov
2024-11-03  9:14 ` [bug#74183] [PATCH 1/2] gnu: btop: Generate and install the " Artyom V. Poptsov
2024-11-03  9:14 ` [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs Artyom V. Poptsov
2024-11-03  9:48   ` Z572
2024-11-03 10:15 ` bug#74183: [PATCH 0/2] gnu: btop: Fix SEGFAULT error on Intel GPUs; install man page Artyom V. Poptsov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).