[arch-commits] Commit in arch-audit/trunk (PKGBUILD fix-term-crash.patch)

Christian Rebischke shibumi at archlinux.org
Fri May 8 19:26:08 UTC 2020


    Date: Friday, May 8, 2020 @ 19:26:08
  Author: shibumi
Revision: 625764

upgpkg: arch-audit 0.1.15-2 Fix crash when TERM isn't set

This commit applies a patch for crashes when TERM isn't set:
https://gitlab.com/ilpianista/arch-audit/-/commit/5176a625fb5a6b4daf6be996d714c3cef001750f

Added:
  arch-audit/trunk/fix-term-crash.patch
Modified:
  arch-audit/trunk/PKGBUILD

----------------------+
 PKGBUILD             |   14 ++++++++++---
 fix-term-crash.patch |   52 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-05-08 19:05:44 UTC (rev 625763)
+++ PKGBUILD	2020-05-08 19:26:08 UTC (rev 625764)
@@ -3,7 +3,7 @@
 
 pkgname=arch-audit
 pkgver=0.1.15
-pkgrel=1
+pkgrel=2
 pkgdesc='An utility like pkg-audit based on Arch CVE Monitoring Team data'
 url='https://gitlab.com/ilpianista/arch-audit'
 depends=('curl' 'openssl')
@@ -10,9 +10,17 @@
 makedepends=('cargo' 'pkg-config')
 arch=('x86_64')
 license=('MIT')
-source=("${pkgname}-${pkgver}.tar.gz::https://gitlab.com/ilpianista/arch-audit/-/archive/${pkgver}/arch-audit-${pkgver}.tar.gz")
-sha512sums=('f8a6ee8b30f57c5ae572a939e64e47593273cf6e599d430793d657973467f489e0d5940dd21f66ba4e9f5ae8bac8e5f3cf02e6f793fc2e526d829ef83be05c9d')
+source=("${pkgname}-${pkgver}.tar.gz::https://gitlab.com/ilpianista/arch-audit/-/archive/${pkgver}/arch-audit-${pkgver}.tar.gz"
+        "fix-term-crash.patch")
+sha512sums=('f8a6ee8b30f57c5ae572a939e64e47593273cf6e599d430793d657973467f489e0d5940dd21f66ba4e9f5ae8bac8e5f3cf02e6f793fc2e526d829ef83be05c9d'
+            '885c4c58fce12c420296375a7012731afd53d6947884812e53da045f0c0eedb64346af257c103536a4b37cf31eae4ec26fd7edfc0e1f667e268f2a1dddd23f2c')
 
+prepare() {
+  # apply fix for TERM crash
+  cd "${pkgname}-${pkgver}"
+  patch -Np1 < "${srcdir}/fix-term-crash.patch"
+}
+
 build() {
   cd "${pkgname}-${pkgver}"
   cargo build --release

Added: fix-term-crash.patch
===================================================================
--- fix-term-crash.patch	                        (rev 0)
+++ fix-term-crash.patch	2020-05-08 19:26:08 UTC (rev 625764)
@@ -0,0 +1,52 @@
+From 5176a625fb5a6b4daf6be996d714c3cef001750f Mon Sep 17 00:00:00 2001
+From: Andrea Scarpino <andrea at scarpino.dev>
+Date: Sun, 5 Apr 2020 20:21:44 +0200
+Subject: [PATCH] Fix crash when TERM isn't set
+
+Fixes #43
+---
+ src/main.rs | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/main.rs b/src/main.rs
+index 19e2b70..b0fd3d1 100644
+--- a/src/main.rs
++++ b/src/main.rs
+@@ -7,10 +7,13 @@ use log::{debug, info};
+ use serde_json::Value;
+ use std::cmp::Ordering;
+ use std::collections::btree_map::Entry::{Occupied, Vacant};
+-use std::collections::BTreeMap;
++use std::collections::{BTreeMap, HashMap};
+ use std::default::Default;
++use std::io;
+ use std::process::exit;
+ use std::str;
++use term::terminfo::TermInfo;
++use term::{StdoutTerminal, TerminfoTerminal};
+ 
+ mod avg;
+ mod enums;
+@@ -416,7 +419,18 @@ fn test_merge_avgs() {
+ 
+ /// Print a list of `avg::AVG`
+ fn print_avgs(options: &Options, avgs: &BTreeMap<String, avg::AVG>) {
+-    let mut t = term::stdout().expect("term::stdout failed");
++    let fake_term = TermInfo {
++        names: vec![],
++        bools: HashMap::new(),
++        numbers: HashMap::new(),
++        strings: HashMap::new(),
++    };
++
++    let mut t = match term::stdout() {
++        Some(x) => x,
++        None => Box::new(TerminfoTerminal::new_with_terminfo(io::stdout(), fake_term)) as Box<StdoutTerminal>
++    };
++
+     for (pkg, avg) in avgs {
+         match avg.fixed {
+             Some(ref v) if avg.status != enums::Status::Vulnerable => {
+-- 
+2.26.2
+


More information about the arch-commits mailing list