[arch-commits] Commit in nvtop/trunk (PKGBUILD format-security.patch)

Felix Yan felixonmars at gemini.archlinux.org
Fri Aug 26 18:02:44 UTC 2022


    Date: Friday, August 26, 2022 @ 18:02:43
  Author: felixonmars
Revision: 1283485

upgpkg: nvtop 2.0.3-1

Added:
  nvtop/trunk/format-security.patch
Modified:
  nvtop/trunk/PKGBUILD

-----------------------+
 PKGBUILD              |   12 ++++--
 format-security.patch |   90 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-08-26 17:49:50 UTC (rev 1283484)
+++ PKGBUILD	2022-08-26 18:02:43 UTC (rev 1283485)
@@ -2,7 +2,7 @@
 # Contributor: Maxime Schmitt <maxime.schmitt91 at gmail.com>
 
 pkgname=nvtop
-pkgver=2.0.2
+pkgver=2.0.3
 pkgrel=1
 pkgdesc="An htop like monitoring tool for AMD and NVIDIA GPUs"
 arch=('x86_64')
@@ -10,9 +10,15 @@
 license=('GPL3')
 depends=('ncurses')
 makedepends=('cmake' 'libdrm')
-source=("https://github.com/Syllo/nvtop/archive/$pkgver/$pkgname-$pkgver.tar.gz")
-sha512sums=('8cc4859ae26428b8b4835d5205be4533c38ab90f5a369261b2650200bab16f7953c4d012dba375be5d1c793ca5031775c64b18f1629cae381d6f1e3b29992cb5')
+source=("https://github.com/Syllo/nvtop/archive/$pkgver/$pkgname-$pkgver.tar.gz"
+        format-security.patch)
+sha512sums=('ffd9d88898b7c6365d8bcff3c7b187760bc0036fba80ab6a0e3a586217ebf48b3377cdbe84f2fbbe10fb650f96de108973f95ccd29766e45da3901ee5d45f63c'
+            'a388de418586c8569d119dbd6845e2257160a81e370ed75ba60a9823afb90267cb5522200a06925db9ce3ca39b8d589dd02b7ade47de712abe830b02fbd2bd6e')
 
+prepare() {
+  patch -d $pkgname-$pkgver -p1 < format-security.patch
+}
+
 build() {
   cd $pkgname-$pkgver
 

Added: format-security.patch
===================================================================
--- format-security.patch	                        (rev 0)
+++ format-security.patch	2022-08-26 18:02:43 UTC (rev 1283485)
@@ -0,0 +1,90 @@
+commit 663a69f1c9038eabdfc3155112fb9b8d662578aa
+Author: Felix Yan <felixonmars at archlinux.org>
+Date:   Fri Aug 26 21:00:38 2022 +0300
+
+    Fix format-security warnings
+    
+    nvtop 2.0.3 fails to build on Arch Linux with `-Werror=format-security` enabled. Let's fix it.
+
+diff --git a/src/interface.c b/src/interface.c
+index 28bc2b2..3628e62 100644
+--- a/src/interface.c
++++ b/src/interface.c
+@@ -256,35 +256,35 @@ static void initialize_gpu_mem_plot(struct plot_window *plot, struct window_posi
+   char *zeroSec = "0s";
+   if (options->plot_left_to_right) {
+     char *toPrint = zeroSec;
+-    mvwprintw(plot->win, position->sizeY - 1, 4, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4, "%s", toPrint);
+ 
+     int retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / 4 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 4 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 4 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / 2 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 2 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 2 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols * 3 / 4 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols * 3 / 4 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols * 3 / 4 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols - strlen(toPrint), toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols - strlen(toPrint), "%s", toPrint);
+   } else {
+     char *toPrint;
+     int retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / column_divisor / 1000);
+@@ -292,31 +292,31 @@ static void initialize_gpu_mem_plot(struct plot_window *plot, struct window_posi
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols * 3 / 4 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 4 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 4 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / 2 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 2 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols / 2 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     retval = snprintf(elapsedSeconds, 5, "%ds", options->update_interval * cols / 4 / column_divisor / 1000);
+     if (retval > 4)
+       toPrint = err;
+     else
+       toPrint = elapsedSeconds;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols * 3 / 4 - strlen(toPrint) / 2, toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols * 3 / 4 - strlen(toPrint) / 2, "%s", toPrint);
+ 
+     toPrint = zeroSec;
+-    mvwprintw(plot->win, position->sizeY - 1, 4 + cols - strlen(toPrint), toPrint);
++    mvwprintw(plot->win, position->sizeY - 1, 4 + cols - strlen(toPrint), "%s", toPrint);
+   }
+   wnoutrefresh(plot->win);
+ }



More information about the arch-commits mailing list