summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/procenv/7cafed1316ddb16fe0689d54ba10c05dd2edd347.patch34
-rw-r--r--var/spack/repos/builtin/packages/procenv/package.py29
2 files changed, 63 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/procenv/7cafed1316ddb16fe0689d54ba10c05dd2edd347.patch b/var/spack/repos/builtin/packages/procenv/7cafed1316ddb16fe0689d54ba10c05dd2edd347.patch
new file mode 100644
index 0000000000..a185ad2120
--- /dev/null
+++ b/var/spack/repos/builtin/packages/procenv/7cafed1316ddb16fe0689d54ba10c05dd2edd347.patch
@@ -0,0 +1,34 @@
+From 7cafed1316ddb16fe0689d54ba10c05dd2edd347 Mon Sep 17 00:00:00 2001
+From: Lukas Maerdian <lukas.maerdian@canonical.com>
+Date: Mon, 10 Aug 2020 15:11:23 +0200
+Subject: [PATCH] Fix GCC-10 build when used with -Werror=format-overflow=
+ (Fixes #15)
+
+Process names have a maximum length of 16 bytes and the buffer used has a
+length of 16 bytes, but the compiler is picky about writing and arbirary
+string into that small buffer. Tell the compiler to write max. 15 chars +
+'\0', to make it happy.
+https://stackoverflow.com/questions/23534263/what-is-the-maximum-allowed-limit-on-the-length-of-a-process-name
+---
+ src/platform/linux/platform.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/platform/linux/platform.c b/src/platform/linux/platform.c
+index a392bc0..49ea36c 100644
+--- a/src/platform/linux/platform.c
++++ b/src/platform/linux/platform.c
+@@ -1263,12 +1263,12 @@ handle_proc_branch_linux (void)
+
+ if ((p=strstr (buffer, "Name:")) == buffer) {
+ p += 1+strlen ("Name:"); /* jump over tab char */
+- sprintf (name, "%s", p);
++ sprintf (name, "%.15s", p);
+ }
+
+ if ((p=strstr (buffer, "PPid:")) == buffer) {
+ p += 1+strlen ("PPid:"); /* jump over tab char */
+- sprintf (ppid, "%s", p);
++ sprintf (ppid, "%.15s", p);
+
+ /* got all we need now */
+ break;
diff --git a/var/spack/repos/builtin/packages/procenv/package.py b/var/spack/repos/builtin/packages/procenv/package.py
new file mode 100644
index 0000000000..0192379f81
--- /dev/null
+++ b/var/spack/repos/builtin/packages/procenv/package.py
@@ -0,0 +1,29 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Procenv(AutotoolsPackage):
+ """A command-line tool that displays as much detail about itself and
+ its environment as possible. It can be used as a test tool, to
+ understand the type of environment a process runs in, and for
+ comparing system environments."""
+
+ homepage = "https://github.com/jamesodhunt/procenv/"
+ url = "https://github.com/jamesodhunt/procenv/archive/0.51.tar.gz"
+
+ version('0.51', sha256='b831c14729e06a285cc13eba095817ce3b6d0ddf484b1264951b03ee4fe25bc9')
+
+ # https://github.com/jamesodhunt/procenv/pull/16
+ patch("7cafed1316ddb16fe0689d54ba10c05dd2edd347.patch", when="@:0.51")
+
+ depends_on('expat')
+ depends_on('libpcap')
+ # Fixme: package these and use conditionally (on linux)
+ # depends_on('libselinux')
+ # depends_on('libapparmor')
+ depends_on('numactl')
+ depends_on('check', type='build')