[arch-commits] Commit in ncdu/trunk (PKGBUILD hardening.patch)

Andreas Schleifer segaja at gemini.archlinux.org
Thu Mar 24 19:58:15 UTC 2022


    Date: Thursday, March 24, 2022 @ 19:58:15
  Author: segaja
Revision: 1175079

upgpkg: ncdu 2.1-3; enable RELRO; fix RUNPATH; fix crash on reload

Modified:
  ncdu/trunk/PKGBUILD
  ncdu/trunk/hardening.patch

-----------------+
 PKGBUILD        |   19 +++++++++++++------
 hardening.patch |    5 +++--
 2 files changed, 16 insertions(+), 8 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-03-24 19:58:14 UTC (rev 1175078)
+++ PKGBUILD	2022-03-24 19:58:15 UTC (rev 1175079)
@@ -7,7 +7,7 @@
 
 pkgname=ncdu
 pkgver=2.1
-pkgrel=2
+pkgrel=3
 pkgdesc='Disk usage analyzer with an ncurses interface'
 url='https://dev.yorhel.nl/ncdu'
 license=('MIT')
@@ -15,18 +15,23 @@
 makedepends=('zig')
 arch=('x86_64')
 source=("https://dev.yorhel.nl/download/${pkgname}-${pkgver}.tar.gz"{,.asc}
+        # https://code.blicky.net/yorhel/ncdu/issues/194
+        "ncdu-194-sudo-refresh-fix.patch::https://code.blicky.net/yorhel/ncdu/commit/5f383966a91d82394c69ea66ed64cf238bcf0ba0.patch"
         "hardening.patch")
 sha256sums=('4ba8d20a64a55cc00af2d2c6138afcc9dc25e40a5ed6a8c544cb9e2285a195fe'
             'SKIP'
-            '833142036e56cd7f8ee111f2e0855f12d305d2ec03925c2f3848a14f7305abbf')
+            '45cff6eb86382f6657d3ebd8a3b62f372bf61ed96cdc80ede462bd573706754e'
+            '4b90e881d1dd5fb36b269e52952be40e050926dd6d4ce08ac7a7f0e5940e790d')
 b2sums=('9dd90b63ad7edbd402b0cdab7f5aa5263c6df562afb15229b5c2b6143cf7efc7af94fabcd710593b2fd94fca02742e08b401fc0103b1154c6cd278f5709eeef8'
         'SKIP'
-        'bf38e61d425d2d264320fcbf27ad8e3af769aaa2b3df5d51cdaf7176b8aeb84504abb157560d558094afaf1fac406a6b35cc93e769459fda2e34eacf803b210f')
+        'de08ba55f5a6688d10607434df8c6b5f4de46496d50a17bca4ff99c786258cccffe5f4ee7d0e23a6c173dbfc58cbd01899520675211a1523634eb48935da390b'
+        '54b47c408e4144bee629d1d80410e4c97baf375d10399da3644a7a929b21732b8323723b2218890fe7d7d5b9b7b42427a8af74bc64c4002ef23e722c3ed969bf')
 validpgpkeys=('74460D32B80810EBA9AFA2E962394C698C2739FA') # Yoran Heling <projects at yorhel.nl>
 
 prepare() {
     cd "${srcdir}/${pkgname}-${pkgver}"
 
+    patch --verbose --strip=1 --input=../ncdu-194-sudo-refresh-fix.patch
     patch --verbose --strip=1 --input=../hardening.patch
 }
 
@@ -33,9 +38,11 @@
 build() {
     cd "${srcdir}/${pkgname}-${pkgver}"
 
-    zig build -Drelease-safe -Dcpu=baseline
+    # since RELRO is not doable in the zig.build file (https://github.com/ziglang/zig/issues/6977)
+    # we are running zig build-exe directly
+    #zig build -Drelease-safe -Dcpu=baseline
 
-    make doc
+    zig build-exe ./src/main.zig ./src/ncurses_refs.c -lc -lncursesw -OReleaseSafe --name ncdu -target native-native -mcpu x86_64 -D _DEFAULT_SOURCE -D _XOPEN_SOURCE=600 -fPIE -z relro -z now -fno-each-lib-rpath
 }
 
 check() {
@@ -47,7 +54,7 @@
 package() {
     cd "${srcdir}/${pkgname}-${pkgver}"
 
-    install -D --mode=755 "./zig-out/bin/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
+    install -D --mode=755 "./${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
 
     make install-doc PREFIX="${pkgdir}/usr"
 

Modified: hardening.patch
===================================================================
--- hardening.patch	2022-03-24 19:58:14 UTC (rev 1175078)
+++ hardening.patch	2022-03-24 19:58:15 UTC (rev 1175079)
@@ -1,10 +1,11 @@
 --- ncdu-2.1/build.zig	2022-01-01 15:59:36.000000000 +0100
-+++ ncdu-2.1_patched/build.zig	2022-03-09 00:19:11.898641095 +0100
-@@ -13,6 +13,7 @@
++++ ncdu-2.1_patched/build.zig	2022-03-23 22:58:15.208756978 +0100
+@@ -13,6 +13,8 @@
      exe.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
      exe.linkLibC();
      exe.linkSystemLibrary("ncursesw");
 +    exe.pie = true;
++    exe.each_lib_rpath = false;
      exe.install();
  
      const run_cmd = exe.run();



More information about the arch-commits mailing list