Add procenv (#20121)

* Add procenv

* procenv: Only buildrequire check

* procenv:  Patch for gcc 10

* procenv:  Add omitted patch

* Indent doc string
This commit is contained in:
Dave Love 2021-01-04 21:08:54 +00:00 committed by GitHub
parent 1b33008705
commit 11dd7ffad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 0 deletions

View File

@ -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;

View File

@ -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')