public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/
@ 2017-05-24 14:35 Ian Stakenvicius
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Stakenvicius @ 2017-05-24 14:35 UTC (permalink / raw
  To: gentoo-commits

commit:     c4fc03c06cfa8a1c3f4b22fee2a3688ea48046be
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Wed May 24 14:33:44 2017 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Wed May 24 14:35:10 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4fc03c0

sys-cluster/torque: fix CFLAGS munging on version bump to 4.2.10

This commit also bumps to EAPI6 and adjusts some other minor issues
(REPLACING_VERSIONS checks, etc).

Bug: http://bugs.gentoo.org/619436

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 sys-cluster/torque/Manifest                        |   1 +
 .../files/torque-4.2-dont-mess-with-cflags.patch   |  27 +++
 sys-cluster/torque/torque-4.2.10.ebuild            | 196 +++++++++++++++++++++
 3 files changed, 224 insertions(+)

diff --git a/sys-cluster/torque/Manifest b/sys-cluster/torque/Manifest
index dd1e9790410..e3b475c54f4 100644
--- a/sys-cluster/torque/Manifest
+++ b/sys-cluster/torque/Manifest
@@ -1,4 +1,5 @@
 DIST torque-2.5.13.tar.gz 5854910 SHA256 ab59d4c8e8b45383ddd8202fa83956816175e348bb955a4ad5f7e3cd4dde5ff9 SHA512 e08ddf3950bb32177f4bc504a502fae3928a616739c28ca9687c5207606817d4589583306508a2c568cf19fc8c5617dc4a9decc81576c2875660b715c256cfcf WHIRLPOOL 29eefb89d1eb9d6a81735aa117922a1eb0b72e14eeccab7dbd70cdcf01431b7ecd9c3927e1c5c28b7f42d6739b28f45386740b92adb790ccdf9803e4c6e38534
 DIST torque-4.1.7.tar.gz 6218108 SHA256 3c86b2d84589f54ac222e81dd1953d153e1d836163d2000412369fefd25fb2af SHA512 5a085c0a7b205fed075bff4599db90ca5c4bb5f22d87d76fd56539d5cc1935bb8eeffcd4d18ba84401bd4ca128718070b69c8b91ab6814a4638622ba351654e6 WHIRLPOOL cae9216f0cebc22927eec2d1f007b1a3c4a6cc619f2926c40a5f46e0bd0eec19691f9aafcad4fe727e2c5ed2485d11c972603cca613269f82147ff1dc41f1ba4
+DIST torque-4.2.10.tar.gz 6294022 SHA256 46f1f319683af6d3820e18cda69ce59113c9a5c192e1f07826007be69385889b SHA512 898703fa1d02310c22e2a02b86d67ca52ebed46684597931944edebb39f8293746739c8dca9cd10e07c2e7274c3dd7f65a5664d1980817e3feec58952c4cf4d1 WHIRLPOOL e65be66b056a519ebd1c30c2c1ae2ddf43bc4e617a52d3caced1e6dfd2b0d8b2a83c26a0f2e6e41cfae791aca68b6f91424745b2baffa2085fccc8f6ae9b8e04
 DIST torque-4.2.9.tar.gz 6294022 SHA256 46f1f319683af6d3820e18cda69ce59113c9a5c192e1f07826007be69385889b SHA512 898703fa1d02310c22e2a02b86d67ca52ebed46684597931944edebb39f8293746739c8dca9cd10e07c2e7274c3dd7f65a5664d1980817e3feec58952c4cf4d1 WHIRLPOOL e65be66b056a519ebd1c30c2c1ae2ddf43bc4e617a52d3caced1e6dfd2b0d8b2a83c26a0f2e6e41cfae791aca68b6f91424745b2baffa2085fccc8f6ae9b8e04
 DIST torque-6.0.3-1485300822_19e79ad.tar.gz 41660338 SHA256 dcbc806379596848f9887ff3b518d4ca7031e888d29d0b12e4e270c0e677dd80 SHA512 40531f2e7732a11ffc224c536f61adc48ce5699a7caebb8aa1fbe7536b5ca4ed66c8436420bc918f7538ef980818141888aa26390a5a2c8185c8cc57373a0ac1 WHIRLPOOL f504106f33a031f9e578b5aa9992423ecc50fad88ec0b380e10284007d1271aeee10da494b32d9a3f7da5a012eeaadbbae2f91f0180ef0abcda9309942eb7777

diff --git a/sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch b/sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch
new file mode 100644
index 00000000000..aec54aff030
--- /dev/null
+++ b/sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch
@@ -0,0 +1,27 @@
+--- a/configure.ac	2014-09-10 21:06:26.000000000 -0400
++++ b/configure.ac	2017-05-23 10:43:59.051759539 -0400
+@@ -703,24 +703,6 @@
+   AC_HELP_STRING([--with-debug], [compile with debugging symbols]),
+   DEBUG_SYMBOLS=$withval, DEBUG_SYMBOLS="yes")
+ AC_MSG_RESULT([DEBUG_SYMBOLS=$DEBUG_SYMBOLS])
+-dnl  remove -O* and add -g
+-if test "$DEBUG_SYMBOLS" = 'yes'; then
+-  AC_MSG_RESULT([before tweak CFLAGS=$CFLAGS])
+-  CFLAGS=`echo $CFLAGS | sed 's/ \?-O[[^ ]]*//g'`
+-  AC_MSG_RESULT([mid tweak CFLAGS=$CFLAGS])
+-  case $CFLAGS in
+-    *-g*)
+-      ;;
+-    *)
+-      if test "$CFLAGS" = ''; then
+-        CFLAGS="-g"
+-      else
+-        CFLAGS="-g $CFLAGS"
+-      fi
+-      ;;
+-  esac
+-  AC_MSG_RESULT([after tweak CFLAGS=$CFLAGS])
+-fi
+ 
+ dnl if using gcc, we can be very strict
+ AC_ARG_ENABLE(gcc_warnings, [

diff --git a/sys-cluster/torque/torque-4.2.10.ebuild b/sys-cluster/torque/torque-4.2.10.ebuild
new file mode 100644
index 00000000000..769264fd387
--- /dev/null
+++ b/sys-cluster/torque/torque-4.2.10.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools eutils linux-info
+
+DESCRIPTION="Resource manager and queuing system based on OpenPBS"
+HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque"
+# TODO:  hopefully moving to github tags soon
+# http://www.supercluster.org/pipermail/torquedev/2013-May/004519.html
+SRC_URI="http://www.adaptivecomputing.com/index.php?wpfb_dl=2849 -> ${P}.tar.gz"
+
+LICENSE="torque-2.5"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="cpusets +crypt doc drmaa kernel_linux libressl munge nvidia server +syslog tk"
+
+DEPEND_COMMON="
+	sys-libs/zlib
+	sys-libs/readline:0=
+	dev-libs/libxml2
+	!libressl? ( dev-libs/openssl:0= )
+	libressl? ( dev-libs/libressl:0= )
+	cpusets? ( sys-apps/hwloc )
+	munge? ( sys-auth/munge )
+	nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+	tk? (
+		dev-lang/tk:0=
+		dev-lang/tcl:0=
+	)
+	syslog? ( virtual/logger )
+	!!games-util/qstat"
+
+# libncurses.so is only needed for configure check on readline
+DEPEND="${DEPEND_COMMON}
+	sys-libs/ncurses:*
+	!!sys-cluster/slurm"
+
+RDEPEND="${DEPEND_COMMON}
+	crypt? ( net-misc/openssh )
+	!crypt? ( net-misc/netkit-rsh )
+	!dev-libs/uthash"
+
+S="${WORKDIR}"/${PN}-4.2.9
+
+# Torque should depend on dev-libs/uthash but that's pretty much impossible
+# to patch in as they ship with a broken configure such that files referenced
+# by the configure.ac and Makefile.am are missing.
+# http://www.supercluster.org/pipermail/torquedev/2014-October/004773.html
+
+pkg_setup() {
+	PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/${PN}}"
+
+	# Find a Torque server to use.  Check environment, then
+	# current setup (if any), and fall back on current hostname.
+	if [ -z "${PBS_SERVER_NAME}" ]; then
+		if [ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]; then
+			PBS_SERVER_NAME="$(<${ROOT}${PBS_SERVER_HOME}/server_name)"
+		else
+			PBS_SERVER_NAME=$(hostname -f)
+		fi
+	fi
+
+	if use cpusets; then
+		if ! use kernel_linux; then
+			einfo
+			elog "    Torque currently only has support for cpusets in linux."
+			elog "Assuming you didn't really want this USE flag and ignoring its state."
+			einfo
+		else
+			linux-info_pkg_setup
+			if ! linux_config_exists || ! linux_chkconfig_present CPUSETS; then
+				einfo
+				elog "    Torque support for cpusets will require that you recompile"
+				elog "your kernel with CONFIG_CPUSETS enabled."
+				einfo
+			fi
+		fi
+	fi
+}
+
+src_prepare() {
+	# Unused and causes breakage when switching from glibc to tirpc.
+	# https://github.com/adaptivecomputing/torque/pull/148
+	sed -i '/rpc\/rpc\.h/d' src/lib/Libnet/net_client.c || die
+
+	# We install to a valid location, no need to muck with ld.so.conf
+	# --without-loadlibfile is supposed to do this for us...
+	sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die
+
+	eapply "${FILESDIR}"/${PN}-4.2.9-tcl8.6.patch
+
+	# 524362
+	eapply "${FILESDIR}"/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch
+
+	eapply "${FILESDIR}"/${PN}-4.2-dont-mess-with-cflags.patch
+	eapply_user
+	mkdir -p "${S}"/m4
+	eautoconf
+}
+
+src_configure() {
+	econf \
+		$(use_enable tk gui) \
+		$(use_enable syslog) \
+		$(use_enable server) \
+		$(use_enable drmaa) \
+		$(use_enable munge munge-auth) \
+		$(use_enable nvidia nvidia-gpus) \
+		$(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+		$(usex crypt --with-rcp=scp --with-rcp=mom_rcp) \
+		--with-server-home=${PBS_SERVER_HOME} \
+		--with-environ=/etc/pbs_environment \
+		--with-default-server=${PBS_SERVER_NAME} \
+		--disable-gcc-warnings \
+		--with-tcp-retry-limit=2 \
+		--without-loadlibfile
+}
+
+src_install() {
+	local dir
+
+	DOCS=( CHANGELOG README.* Release_Notes )
+	use doc && DOCS+=( doc/admin_guide.ps doc/*.pdf )
+
+	default
+
+	# The build script isn't alternative install location friendly,
+	# So we have to fix some hard-coded paths in tclIndex for xpbs* to work
+	for file in $(find "${ED}" -iname tclIndex); do
+		sed \
+			-e "s/${ED//\// }/ /" \
+			-i "${file}" || die
+	done
+
+	for dir in $(find "${ED}/${PBS_SERVER_HOME}" -type d); do
+		keepdir "${dir#${ED}}"
+	done
+
+	if use server; then
+		newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server
+		newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched
+	fi
+	newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom
+	newconfd "${FILESDIR}"/${PN}-conf.d-munge ${PN}
+	newinitd "${FILESDIR}"/trqauthd-init.d trqauthd
+	newenvd "${FILESDIR}"/${PN}-env.d 25${PN}
+}
+
+pkg_preinst() {
+	if [[ -f "${ROOT}etc/pbs_environment" ]]; then
+		cp "${ROOT}etc/pbs_environment" "${ED}"/etc/pbs_environment || die
+	fi
+
+	if use server && [[ -f "${ROOT}${PBS_SERVER_HOME}/server_priv/nodes" ]]; then
+		cp \
+			"${EROOT}${PBS_SERVER_HOME}/server_priv/nodes" \
+			"${ED}/${PBS_SERVER_HOME}/server_priv/nodes" || die
+	fi
+
+	echo "${PBS_SERVER_NAME}" > "${ED}${PBS_SERVER_HOME}/server_name" || die
+
+	# Fix up the env.d file to use our set server home.
+	sed \
+		-e "s:/var/spool/${PN}:${PBS_SERVER_HOME}:g" \
+		-i "${ED}"/etc/env.d/25${PN} || die
+
+	if use munge; then
+		sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${ED}"/etc/conf.d/${PN} || die
+	fi
+}
+
+pkg_postinst() {
+	local showmessage=1
+	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+		showmessage=0;
+		elog "If this is the first time torque has been installed, then you are not"
+		elog "ready to start the server.  Please refer to the documentation located at:"
+		elog "http://docs.adaptivecomputing.com/torque/${PN//./-}/Content/topics/1-installConfig/initializeConfigOnServer.htm"
+		elog
+	else
+		for i in ${REPLACING_VERSIONS} ; do
+			if [[ ${i} == 4* ]]; then
+				showmessage=0; break;
+			fi
+		done
+	fi
+	if [[ ${showmessage} > 0 ]]; then
+		elog "Important v4.x changes:"
+		elog "  - The on-wire protocol version has been changed."
+		elog "    Versions of Torque before 4.0.0 are no longer able to communicate."
+		elog "  - pbs_iff has been replaced by trqauthd, you will now need to add"
+		elog "    trqauthd to your default runlevel."
+	fi
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/
@ 2017-11-21 19:31 Ian Stakenvicius
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Stakenvicius @ 2017-11-21 19:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d6f144825d2c355ac84e6d24631d170a8502f064
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 21 19:31:11 2017 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Tue Nov 21 19:31:50 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6f14482

sys-cluster/torque-6.0.3: fix an empty-string comparison error

Bug: http://bugs.gentoo.org/638346
Package-Manager: Portage-2.3.13, Repoman-2.3.3

 .../torque-6.0.3-fix-emptystring-comparison.patch   | 21 +++++++++++++++++++++
 sys-cluster/torque/torque-6.0.3.ebuild              |  1 +
 2 files changed, 22 insertions(+)

diff --git a/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch b/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch
new file mode 100644
index 00000000000..0666eda1593
--- /dev/null
+++ b/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch
@@ -0,0 +1,21 @@
+--- a/src/lib/Libattr/req.cpp	2017-01-24 18:35:27.000000000 -0500
++++ b/src/lib/Libattr/req.cpp	2017-11-21 13:40:27.201964749 -0500
+@@ -1037,17 +1037,17 @@
+     error = "Bad tasks value: '";
+     error += submission_str;
+     error += "'";
+     return(PBSE_BAD_PARAMETER);
+     }
+ 
+   if (*current == ':')
+     current++;
+-  else if (current != '\0')
++  else if (*current != '\0')
+     {
+     error = "Invalid task specification";
+     return(PBSE_BAD_PARAMETER);
+     }
+ 
+   while ((current != NULL) && 
+          (*current != '\0'))
+     {

diff --git a/sys-cluster/torque/torque-6.0.3.ebuild b/sys-cluster/torque/torque-6.0.3.ebuild
index 74409b48eef..ec9563e95bf 100644
--- a/sys-cluster/torque/torque-6.0.3.ebuild
+++ b/sys-cluster/torque/torque-6.0.3.ebuild
@@ -81,6 +81,7 @@ pkg_setup() {
 }
 
 src_prepare() {
+	epatch "${FILESDIR}"/${P}-fix-emptystring-comparison.patch
 	# We install to a valid location, no need to muck with ld.so.conf
 	# --without-loadlibfile is supposed to do this for us...
 	sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/
@ 2019-10-22 17:06 Ian Stakenvicius
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Stakenvicius @ 2019-10-22 17:06 UTC (permalink / raw
  To: gentoo-commits

commit:     9af2199057ca2caed5237c4b9f9af2bbcbb71612
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 22 17:02:55 2019 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Tue Oct 22 17:06:18 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9af21990

sys-cluster/torque: fix build issues with newer toolchains

Backported upstream patch for 6.1.3 codebase to fix "gcc-7 errors", which
resolves build errors from using C++ standards newer than 03.

Also removed unpatch torque-6.0.4 ebuild as it no longer builds

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Ian Stakenvicius <axs <AT> gentoo.org>

 .../torque-6.0.3-fix-emptystring-comparison.patch  |   49 +
 .../torque-6.0.4-error_buf_overflow_prevent.patch  |   11 +
 sys-cluster/torque/files/torque-6.0.4-gcc7.patch   | 1606 ++++++++++++++++++++
 sys-cluster/torque/torque-6.0.4-r1.ebuild          |    4 +-
 sys-cluster/torque/torque-6.0.4.ebuild             |  177 ---
 5 files changed, 1668 insertions(+), 179 deletions(-)

diff --git a/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch b/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch
index 0666eda1593..6584f0ea8b3 100644
--- a/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch
+++ b/sys-cluster/torque/files/torque-6.0.3-fix-emptystring-comparison.patch
@@ -19,3 +19,52 @@
    while ((current != NULL) && 
           (*current != '\0'))
      {
+--- a/src/cmds/qsub_functions.c	2017-01-24 18:35:27.000000000 -0500
++++ b/src/cmds/qsub_functions.c	2017-11-21 13:40:27.201964749 -0500
+@@ -900,7 +900,7 @@
+   else
+     {
+     char *tmp_host = pbs_default();
+-    if (tmp_host == '\0')
++    if (*tmp_host == '\0')
+       hash_add_or_exit(job_attr, ATTR_pbs_o_server, qsub_host, LOGIC_DATA);
+     else
+       hash_add_or_exit(job_attr, ATTR_pbs_o_server, tmp_host, LOGIC_DATA);
+--- a/src/cmds/pbsnodes.c 2017-01-24 18:35:27.000000000 -0500
++++ b/src/cmds/pbsnodes.c 2017-11-21 13:40:27.201964749 -0500
+@@ -900,7 +900,7 @@
+         {
+         nodeargs = (char **)calloc(2, sizeof(char *));
+         nodeargs[0] = strdup("");
+-        nodeargs[1] = '\0';
++        nodeargs[1] = NULL;
+         }
+       }
+     }
+@@ -1020,7 +1020,7 @@
+ 
+         MXMLCreateE(&DE, "Data");
+ 
+-        for (lindex = 0;nodeargs[lindex] != '\0';lindex++)
++        for (lindex = 0;nodeargs[lindex] != NULL;lindex++)
+           {
+           bstatus = statnode(con, nodeargs[lindex]);
+ 
+@@ -1041,7 +1041,7 @@
+         }
+       else
+         {
+-        for (lindex = 0;nodeargs[lindex] != '\0';lindex++)
++        for (lindex = 0;nodeargs[lindex] != NULL;lindex++)
+           {
+           bstatus = statnode(con, nodeargs[lindex]);
+ 
+@@ -1065,7 +1065,7 @@
+ 
+       /* list any node that is DOWN, OFFLINE, or UNKNOWN */
+ 
+-      for (lindex = 0;nodeargs[lindex] != '\0';lindex++)
++      for (lindex = 0;nodeargs[lindex] != NULL;lindex++)
+         {
+         bstatus = statnode(con, nodeargs[lindex]);
+ 

diff --git a/sys-cluster/torque/files/torque-6.0.4-error_buf_overflow_prevent.patch b/sys-cluster/torque/files/torque-6.0.4-error_buf_overflow_prevent.patch
new file mode 100644
index 00000000000..639f4f0662f
--- /dev/null
+++ b/sys-cluster/torque/files/torque-6.0.4-error_buf_overflow_prevent.patch
@@ -0,0 +1,11 @@
+--- a/src/daemon_client/trq_auth_daemon.c	2017-08-29 18:25:11.000000000 -0400
++++ b/src/daemon_client/trq_auth_daemon.c	2019-10-21 13:58:47.441212099 -0400
+@@ -134,7 +134,7 @@
+     {
+        openlog("daemonize_trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
+        syslog(LOG_ALERT, "Failed to create client_logs directory: %s errno: %d error message: %s", path_log, errno, strerror(errno));
+-       sprintf(error_buf,"Failed to create client_logs directory: %s, error message: %s",path_log,strerror(errno));
++       snprintf(error_buf,sizeof(error_buf),"Failed to create client_logs directory: %s, error message: %s",path_log,strerror(errno));
+        log_err(errno,__func__,error_buf);
+        closelog();
+        return(PBSE_SYSTEM);

diff --git a/sys-cluster/torque/files/torque-6.0.4-gcc7.patch b/sys-cluster/torque/files/torque-6.0.4-gcc7.patch
new file mode 100644
index 00000000000..340eb9e1bfc
--- /dev/null
+++ b/sys-cluster/torque/files/torque-6.0.4-gcc7.patch
@@ -0,0 +1,1606 @@
+From 8a0b748d3644dde30372ee25c4fe05bec10b2166 Mon Sep 17 00:00:00 2001
+From: Chad Vizino <cvizino@adaptivecomputing.com>
+Date: Fri, 29 Mar 2019 09:23:08 -0600
+Subject: [PATCH] TRQ-4330 - fix gcc/g++ 7 compile issues
+
+---
+ src/cmds/qdel.c                            |  6 +-
+ src/cmds/qsub_functions.c                  | 12 ++--
+ src/cmds/qterm.c                           |  2 +
+ src/include/array.h                        |  2 +-
+ src/include/attribute.h                    |  4 +-
+ src/lib/Libattr/attr_fn_acl.c              |  4 +-
+ src/lib/Libattr/attr_fn_arst.c             |  4 +-
+ src/lib/Libcmds/cvtdate.c                  |  8 +--
+ src/lib/Libdis/disrsc.c                    |  2 +
+ src/lib/Libdis/disrsi.c                    |  2 +
+ src/lib/Libdis/disrsl.c                    |  2 +
+ src/lib/Libdis/disrss.c                    |  2 +
+ src/lib/Libnet/net_client.c                |  4 +-
+ src/lib/Libnet/net_common.c                |  1 +
+ src/lib/Libutils/jsoncpp.cpp               |  9 +++
+ src/lib/Libutils/numa_chip.cpp             | 10 +--
+ src/resmom/checkpoint.c                    | 59 ++++++++++------
+ src/resmom/generate_alps_status.c          |  7 +-
+ src/resmom/linux/mom_mach.c                | 79 +++++++++++++--------
+ src/resmom/mom_main.c                      | 16 ++---
+ src/resmom/mom_req_quejob.c                | 12 ++--
+ src/resmom/mom_server.c                    | 41 +++++------
+ src/resmom/parse_config.c                  |  4 +-
+ src/resmom/requests.c                      |  8 +--
+ src/scheduler.cc/samples/fifo/dedtime.c    |  2 +-
+ src/server/array_func.c                    |  6 +-
+ src/server/array_func.h                    |  2 +-
+ src/server/geteusernam.c                   |  2 +-
+ src/server/job_func.c                      | 28 ++++++--
+ src/server/node_attr_def.c                 | 16 ++---
+ src/server/node_manager.c                  |  5 +-
+ src/server/pbsd_init.c                     |  2 +
+ src/server/process_request.c               | 18 ++---
+ src/server/req_jobobit.c                   | 16 ++++-
+ src/server/req_quejob.c                    |  2 +-
+ src/server/req_runjob.c                    | 10 ++-
+ src/server/req_stat.c                      |  2 +-
+ src/server/svr_chk_owner.c                 | 47 +++++++++----
+ src/server/svr_jobfunc.c                   | 80 +++++++++++++++-------
+ src/test/catch_child/scaffolding.c         |  1 +
+ src/test/geteusernam/scaffolding.c         |  2 +-
+ src/test/node_manager/test_uut.c           |  4 +-
+ src/test/pbs_log/scaffolding.c             |  3 +-
+ src/test/pbsd_main/scaffolding.c           |  2 +-
+ src/test/process_alps_status/scaffolding.c |  2 +
+ src/test/process_request/scaffolding.c     |  6 +-
+ src/test/req_stat/scaffolding.c            |  4 +-
+ src/test/svr_chk_owner/scaffolding.c       |  2 +-
+ torque.setup.in                            |  2 +-
+ 49 files changed, 358 insertions(+), 208 deletions(-)
+
+diff --git a/src/cmds/qdel.c b/src/cmds/qdel.c
+index 909018da66..d7e64f6289 100644
+--- a/src/cmds/qdel.c
++++ b/src/cmds/qdel.c
+@@ -49,7 +49,7 @@ void process_config_file(
+ 
+ 
+ 
+-bool is_array(
++bool is_job_array(
+ 
+   char *job_id)
+ 
+@@ -66,7 +66,7 @@ bool is_array(
+     }
+     
+   return(false);
+-  } /* END is_array() */
++  } /* END is_job_array() */
+ 
+ 
+ 
+@@ -289,7 +289,7 @@ int qdel_main(
+     snprintf(job_id, sizeof(job_id), "%s", argv[optind]);
+    
+     if ((dash_t == true) && 
+-        (is_array(job_id) == false))
++        (is_job_array(job_id) == false))
+       {
+       fprintf(stderr, "qdel: Error: job id '%s' isn't a job array but -t was specified.\n",
+         job_id);
+diff --git a/src/cmds/qsub_functions.c b/src/cmds/qsub_functions.c
+index 4fdfac0a7b..9799c831f4 100644
+--- a/src/cmds/qsub_functions.c
++++ b/src/cmds/qsub_functions.c
+@@ -3363,14 +3363,14 @@ void process_opts(
+         if (add_verify_resources(ji->res_attr, optarg, data_type) != 0)
+           print_qsub_usage_exit("qsub: illegal -l value");
+ 
+-          //If cpuclock gets set we need to set the node exclusive flag
++        //If cpuclock gets set we need to set the node exclusive flag
++        {
++        job_data *pData = NULL;
++        if (hash_find(ji->res_attr,"cpuclock",&pData))
+           {
+-          job_data *pData = NULL;
+-          if (hash_find(ji->res_attr,"cpuclock",&pData))
+-            {
+-            hash_add_or_exit(ji->job_attr, ATTR_node_exclusive, "TRUE", data_type);
+-            }
++          hash_add_or_exit(ji->job_attr, ATTR_node_exclusive, "TRUE", data_type);
+           }
++        }
+ 
+         break;
+ 
+diff --git a/src/cmds/qterm.c b/src/cmds/qterm.c
+index d05bd42d4e..0519328c01 100644
+--- a/src/cmds/qterm.c
++++ b/src/cmds/qterm.c
+@@ -89,6 +89,8 @@ int main(
+ 
+         local = true;
+ 
++        break;
++
+       case 't':
+ 
+         type = optarg;
+diff --git a/src/include/array.h b/src/include/array.h
+index 74050d0a25..d53dec1d3a 100644
+--- a/src/include/array.h
++++ b/src/include/array.h
+@@ -176,7 +176,7 @@ 
+ #define TOKENS_TAG "tokens"
+ #define TOKEN_TAG "token"
+ 
+-int  is_array(char *id);
++int  is_id_array(char *id);
+ int  array_delete(job_array *pa);
+ int  array_save(job_array *pa);
+ int  array_save(job_array *pa);
+diff --git a/src/include/attribute.h b/src/include/attribute.h
+index 8fbff163b8..3d025ab66f 100644
+--- a/src/include/attribute.h
++++ b/src/include/attribute.h
+@@ -512,12 +512,12 @@ int to_size(const char *val, struct size_value *psize);
+ void from_size(struct size_value *psize, char *cvnbuf);
+ void create_size_string(char *buf, struct size_value values);
+ 
+-#define NULL_FUNC '\0'
++#define NULL_FUNC NULL
+ 
+ /* other associated funtions */
+ 
+ int   acl_check(pbs_attribute *, char *canidate, int type);
+-int   acl_check_my_array_string(struct array_strings *, char *, int);
++int   acl_check_my_array_string(struct array_strings *, const char *, int);
+ char *arst_string(const char *str, pbs_attribute *pattr);
+ void  attrl_fixlink(tlist_head *svrattrl);
+ void  recov_acl(pbs_attribute *, attribute_def *, const char *, const char *);
+diff --git a/src/lib/Libattr/attr_fn_acl.c b/src/lib/Libattr/attr_fn_acl.c
+index ebb2775bf4..a7368b9f3b 100644
+--- a/src/lib/Libattr/attr_fn_acl.c
++++ b/src/lib/Libattr/attr_fn_acl.c
+@@ -232,7 +232,7 @@ fptr_int get_my_match_func(
+ int acl_check_my_array_string(
+ 
+   struct array_strings *pas,
+-  char                 *name,
++  const char           *name,
+   int                   type)
+ 
+   {
+@@ -503,6 +503,8 @@ int set_allacl(
+ 
+       /* No break, "Set" falls into "Incr" to add strings */
+ 
++      // fall through
++
+     case INCR_OLD:
+     case INCR:
+ 
+diff --git a/src/lib/Libattr/attr_fn_arst.c b/src/lib/Libattr/attr_fn_arst.c
+index c63281637e..9d82e873a3 100644
+--- a/src/lib/Libattr/attr_fn_arst.c
++++ b/src/lib/Libattr/attr_fn_arst.c
+@@ -532,7 +532,8 @@ int encode_arst(
+ 
+         *pc++ = '\\';
+ 
+-        // escape sequence added. Fall through.
++        // escape sequence added.
++        // fall through
+ 
+       default:
+ 
+@@ -735,6 +736,7 @@ int set_arst(
+       pas->as_next = pas->as_buf;
+ 
+       /* no break, "SET" falls into "MERGE" to add strings */
++      // fall through
+ 
+     case INCR_OLD:
+     case MERGE:
+diff --git a/src/lib/Libcmds/cvtdate.c b/src/lib/Libcmds/cvtdate.c
+index e936c6fbed..0e24639619 100644
+--- a/src/lib/Libcmds/cvtdate.c
++++ b/src/lib/Libcmds/cvtdate.c
+@@ -167,7 +167,7 @@ time_t cvtdate(
+       year   = atoi(buf) * 100;
+       datestr += 2;
+ 
+-      /* no break, fall into next case */
++      // fall through
+ 
+     case 10:  /* YYMMDDhhmm */
+       buf[0] = datestr[0];
+@@ -187,7 +187,7 @@ time_t cvtdate(
+ 
+       datestr += 2;
+ 
+-      /* no break, fall into next case */
++      // fall through
+ 
+     case 8:  /* MMDDhhmm */
+       buf[0] = datestr[0];
+@@ -209,7 +209,7 @@ time_t cvtdate(
+ 
+       datestr += 2;
+ 
+-      /* no break, fall into next case */
++      // fall through
+ 
+     case 6:  /* DDhhmm */
+       buf[0] = datestr[0];
+@@ -229,7 +229,7 @@ time_t cvtdate(
+ 
+       datestr += 2;
+ 
+-      /* no break, fall into next case */
++      // fall through
+ 
+     case 4:  /* hhmm */
+       buf[0] = datestr[0];
+diff --git a/src/lib/Libdis/disrsc.c b/src/lib/Libdis/disrsc.c
+index ac7fec6cbb..2baf87b2b9 100644
+--- a/src/lib/Libdis/disrsc.c
++++ b/src/lib/Libdis/disrsc.c
+@@ -141,6 +141,8 @@ signed char disrsc(
+       else
+         locret = DIS_OVERFLOW;
+ 
++      // fall through
++
+     case DIS_OVERFLOW:
+       value = negate ? SCHAR_MIN : SCHAR_MAX;
+     }
+diff --git a/src/lib/Libdis/disrsi.c b/src/lib/Libdis/disrsi.c
+index a2417725fe..dd073b1bb0 100644
+--- a/src/lib/Libdis/disrsi.c
++++ b/src/lib/Libdis/disrsi.c
+@@ -141,6 +141,8 @@ int disrsi(
+         *retval = locret;
+         }
+ 
++    // fall through
++
+     case DIS_OVERFLOW:
+ 
+       value = negate ? INT_MIN : INT_MAX;
+diff --git a/src/lib/Libdis/disrsl.c b/src/lib/Libdis/disrsl.c
+index 9853056fcf..5fba4a4ba0 100644
+--- a/src/lib/Libdis/disrsl.c
++++ b/src/lib/Libdis/disrsl.c
+@@ -139,6 +139,8 @@ long disrsl(
+       else
+         locret = DIS_OVERFLOW;
+ 
++      // fall through
++
+     case DIS_OVERFLOW:
+       value = negate ? LONG_MIN : LONG_MAX;
+     }
+diff --git a/src/lib/Libdis/disrss.c b/src/lib/Libdis/disrss.c
+index 80eb98109b..e2496b8adf 100644
+--- a/src/lib/Libdis/disrss.c
++++ b/src/lib/Libdis/disrss.c
+@@ -140,6 +140,8 @@ short disrss(
+       else
+         locret = DIS_OVERFLOW;
+ 
++      // fall through
++
+     case DIS_OVERFLOW:
+       value = negate ? SHRT_MIN : SHRT_MAX;
+     }
+diff --git a/src/lib/Libnet/net_client.c b/src/lib/Libnet/net_client.c
+index 8f8542320b..a324c08197 100644
+--- a/src/lib/Libnet/net_client.c
++++ b/src/lib/Libnet/net_client.c
+@@ -532,7 +532,7 @@ int client_to_svr(
+         break;
+         }/* Interrupted system call */
+       
+-      /* fall through to next case */
++      // fall through
+ 
+     case EINVAL:		/* Invalid argument */
+     
+@@ -583,6 +583,8 @@ int client_to_svr(
+         
+         goto retry;
+         }
++
++      // fall through
+       
+     default:
+       
+diff --git a/src/lib/Libnet/net_common.c b/src/lib/Libnet/net_common.c
+index 7b36d31aa1..80bb78bee5 100644
+--- a/src/lib/Libnet/net_common.c
++++ b/src/lib/Libnet/net_common.c
+@@ -405,6 +405,7 @@ int socket_connect_addr(
+           }
+ 
+         /* essentially, only fall through for a transient failure */
++        // fall through
+ 
+       /* socket not ready for writing after 5 timeout */
+       case EINVAL:    /* Invalid argument */
+diff --git a/src/resmom/checkpoint.c b/src/resmom/checkpoint.c
+index f178f48408..7e94b8b00a 100644
+--- a/src/resmom/checkpoint.c
++++ b/src/resmom/checkpoint.c
+@@ -51,6 +51,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <string>
++#include <sstream>
+ #include <unistd.h>
+ #include <assert.h>
+ #include <dirent.h>
+@@ -950,6 +952,7 @@ int blcr_checkpoint_job(
+   char             sid[20];
+   char            *arg[20];
+   char             buf[1024];
++  std::string      err_msg;
+   int              len;
+   char           **ap;
+   FILE            *fs;
+@@ -1107,9 +1110,10 @@ int blcr_checkpoint_job(
+ 
+     /* remove checkpoint directory that was created for this checkpoint attempt */
+ 
+-    sprintf(buf, "Checkpoint failed for job %s, removing checkpoint directory\n",
+-        pjob->ji_qs.ji_jobid);
+-    log_ext(-1, __func__, buf, LOG_DEBUG);
++    err_msg = "Checkpoint failed for job ";
++    err_msg += pjob->ji_qs.ji_jobid;
++    err_msg += ", removing checkpoint directory\n";
++    log_ext(-1, __func__, err_msg.c_str(), LOG_DEBUG);
+ 
+     delete_blcr_checkpoint_files(pjob);
+ 
+@@ -1123,9 +1127,12 @@ int blcr_checkpoint_job(
+ 
+       if (err != 0)
+         {
+-        sprintf(buf, "pbs_alterjob requested on job %s failed (%d-%s)\n",
+-            pjob->ji_qs.ji_jobid, err, pbs_strerror(err));
+-        log_err(-1, __func__, buf);
++        std::ostringstream buf_s;
++
++        buf_s << "pbs_alterjob requested on job " << pjob->ji_qs.ji_jobid <<
++          " failed (" << err << "-" << pbs_strerror(err) << ")\n";
++        err_msg = buf_s.str();
++        log_err(-1, __func__, err_msg.c_str());
+         if (err == PBSE_UNKJOBID)
+           {
+           /* TODO: GB - can the job exit while waiting for the checkpoint
+@@ -1190,9 +1197,12 @@ int blcr_checkpoint_job(
+ 
+       if (err != 0)
+         {
+-        sprintf(buf, "pbs_alterjob requested on job %s failed (%d-%s)\n",
+-            pjob->ji_qs.ji_jobid, err, pbs_strerror(err));
+-        log_err(-1, __func__, buf);
++        std::ostringstream buf_s;
++
++        buf_s << "pbs_alterjob requested on job " << pjob->ji_qs.ji_jobid <<
++          " failed (" << err << "-" << pbs_strerror(err) << ")\n";
++        err_msg = buf_s.str();
++        log_err(-1, __func__, err_msg.c_str());
+         if (err == PBSE_UNKJOBID)
+           {
+           /* TODO: GB - can the job exit while waiting for the checkpoint
+@@ -1527,6 +1537,8 @@ int start_checkpoint(
+   pid_t     pid;
+   int       rc = PBSE_NONE;
+   char      name_buffer[MAXPATHLEN + 1];
++  std::ostringstream buf_s;
++  std::string buf;
+   time_t    time_now;
+ 
+   time_now = time((time_t *)0);
+@@ -1548,11 +1560,10 @@ int start_checkpoint(
+        * to the pbs_server until the checkpoint has completed successfully.
+        */
+ 
+-      sprintf(name_buffer,"ckpt.%s.%d",
+-        pjob->ji_qs.ji_jobid,
+-        (int)time_now);
++      buf_s << "ckpt." << pjob->ji_qs.ji_jobid << "." << time_now;
++      buf = buf_s.str();
+ 
+-      decode_str(&pjob->ji_wattr[JOB_ATR_checkpoint_name], NULL, NULL, name_buffer, 0);
++      decode_str(&pjob->ji_wattr[JOB_ATR_checkpoint_name], NULL, NULL, buf.c_str(), 0);
+ 
+       pjob->ji_wattr[JOB_ATR_checkpoint_name].at_flags =
+         ATR_VFLAG_SET | ATR_VFLAG_MODIFY;
+@@ -1760,8 +1771,8 @@ int blcr_restart_job(
+   int            pid;
+   char           sid[20];
+   char          *arg[20];
++  std::string    err_msg;
+   extern char    restart_script_name[MAXPATHLEN + 1];
+-  char           buf[1024];
+   char           namebuf[MAXPATHLEN + 1];
+   char           restartfile[MAXPATHLEN + 1];
+   char           script_buf[MAXPATHLEN + 1];
+@@ -1886,14 +1897,18 @@ int blcr_restart_job(
+     arg[6] = SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str);
+     arg[7] = NULL;
+ 
+-    snprintf(buf, sizeof(buf), "restart args: %s %s %s %s %s %s %s",
+-      restart_script_name, sid, pjob->ji_qs.ji_jobid,
+-      SET_ARG(pjob->ji_wattr[JOB_ATR_euser].at_val.at_str),
+-      SET_ARG(pjob->ji_wattr[JOB_ATR_egroup].at_val.at_str),
+-      namebuf,
+-      SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str));
+-
+-    log_ext(-1, __func__, buf, LOG_DEBUG);
++    err_msg = "restart args: ";
++    err_msg += restart_script_name;
++    err_msg += " ";
++    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_euser].at_val.at_str);
++    err_msg += " ";
++    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_egroup].at_val.at_str);
++    err_msg += " ";
++    err_msg += namebuf;
++    err_msg += " ";
++    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str);
++
++    log_ext(-1, __func__, err_msg.c_str(), LOG_DEBUG);
+ 
+     log_close(0);
+ 
+diff --git a/src/resmom/generate_alps_status.c b/src/resmom/generate_alps_status.c
+index 305d603874..286d6b02ef 100644
+--- a/src/resmom/generate_alps_status.c
++++ b/src/resmom/generate_alps_status.c
+@@ -87,6 +87,7 @@
+ #include "alps_constants.h"
+ #include "alps_functions.h"
+ #include <string>
++#include <sstream>
+ #include <vector>
+ #include <set>
+ #include <time.h>
+@@ -586,9 +587,9 @@ int process_node(
+     ani.features += features.c_str();
+     }
+ 
+-  char node_index_buf[MAXLINE];
+-  snprintf(node_index_buf, sizeof(node_index_buf), "node_index=%lu", alps_nodes.size());
+-  ani.node_index = node_index_buf;
++  std::ostringstream ostr;
++  ostr << "node_index=" << alps_nodes.size();
++  ani.node_index = ostr.str();
+ 
+   alps_nodes[nid] = ani;
+ 
+diff --git a/src/resmom/linux/mom_mach.c b/src/resmom/linux/mom_mach.c
+index acaf81d467..8d8011a868 100644
+--- a/src/resmom/linux/mom_mach.c
++++ b/src/resmom/linux/mom_mach.c
+@@ -3,6 +3,7 @@
+ #include "lib_mom.h" /* header */
+ 
+ #include <string>
++#include <sstream>
+ #include <vector>
+ #include <assert.h>
+ #include <limits.h>
+@@ -1221,6 +1222,7 @@ unsigned long cput_sum(
+   int          fd;
+   int          rc;
+   char         buf[LOCAL_BUF_SIZE];
++  std::string  err_msg;
+ 
+   pbs_attribute *pattr;
+   pattr = &pjob->ji_wattr[JOB_ATR_req_information];
+@@ -1234,8 +1236,11 @@ unsigned long cput_sum(
+     rc = cr->get_req_index_for_host(mom_alias, req_index);
+     if (rc != PBSE_NONE)
+       {
+-      sprintf(buf, "Could not find req for host %s, job_id %s", mom_alias, pjob->ji_qs.ji_jobid);
+-      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
++      err_msg = "Could not find req for host ";
++      err_msg += mom_alias;
++      err_msg += ", job_id ";
++      err_msg += pjob->ji_qs.ji_jobid;
++      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, err_msg.c_str());
+       return(cputime);
+       }
+ 
+@@ -1272,8 +1277,11 @@ unsigned long cput_sum(
+       {
+       if (pjob->ji_cgroups_created == true)
+         {
+-        sprintf(buf, "failed to open %s: %s", full_cgroup_path.c_str(), strerror(errno));
+-        log_err(-1, __func__, buf);
++        err_msg = "failed to open ";
++        err_msg += full_cgroup_path;
++        err_msg += ": ";
++        err_msg += strerror(errno);
++        log_err(-1, __func__, err_msg.c_str());
+         }
+       return(0);
+       }
+@@ -1281,8 +1289,11 @@ unsigned long cput_sum(
+     rc = read(fd, buf, LOCAL_BUF_SIZE);
+     if (rc == -1)
+       {
+-      sprintf(buf, "failed to read %s: %s", full_cgroup_path.c_str(), strerror(errno));
+-      log_err(-1, __func__, buf);
++      err_msg = "failed to read ";
++      err_msg += full_cgroup_path;
++      err_msg += ": ";
++      err_msg += strerror(errno);
++      log_err(-1, __func__, err_msg.c_str());
+       close(fd);
+       return(0);
+       }
+@@ -1567,6 +1578,7 @@ unsigned long long resi_sum(
+   char         buf[LOCAL_BUF_SIZE];
+   int          fd;
+   int          rc;
++  std::string  err_msg;
+ 
+   pbs_attribute *pattr;
+   pattr = &pjob->ji_wattr[JOB_ATR_req_information];
+@@ -1579,8 +1591,11 @@ unsigned long long resi_sum(
+     rc = cr->get_req_index_for_host(mom_alias, req_index);
+     if (rc != PBSE_NONE)
+       {
+-      sprintf(buf, "Could not find req for host %s, job_id %s", mom_alias, pjob->ji_qs.ji_jobid);
+-      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
++      err_msg = "Could not find req for host ";
++      err_msg += mom_alias;
++      err_msg += ", job_id ";
++      err_msg += pjob->ji_qs.ji_jobid;
++      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, err_msg.c_str());
+       return(resisize);
+       }
+ 
+@@ -1614,8 +1629,11 @@ unsigned long long resi_sum(
+     {
+     if (pjob->ji_cgroups_created == true)
+       {
+-      sprintf(buf, "failed to open %s: %s", full_cgroup_path.c_str(), strerror(errno));
+-      log_err(-1, __func__, buf);
++      err_msg = "failed to open ";
++      err_msg += full_cgroup_path;
++      err_msg += ": ";
++      err_msg += strerror(errno);
++      log_err(-1, __func__, err_msg.c_str());
+       }
+ 
+     return(0);
+@@ -1624,8 +1642,11 @@ unsigned long long resi_sum(
+   rc = read(fd, buf, LOCAL_BUF_SIZE);
+   if (rc == -1)
+     {
+-    sprintf(buf, "failed to read %s: %s", full_cgroup_path.c_str(), strerror(errno));
+-    log_err(-1, __func__, buf);
++    err_msg = "failed to read ";
++    err_msg += full_cgroup_path;
++    err_msg += ": ";
++    err_msg += strerror(errno);
++    log_err(-1, __func__, err_msg.c_str());
+     close(fd);
+     return(0);
+     }
+@@ -1637,8 +1658,9 @@ unsigned long long resi_sum(
+     buf2 = strstr(buf, "\nrss ");
+     if (buf2 == NULL)
+       {
+-      sprintf(buf, "read failed finding rss %s", full_cgroup_path.c_str());
+-      log_err(errno, __func__, buf);
++      err_msg = "read failed finding rss ";
++      err_msg += full_cgroup_path;
++      log_err(errno, __func__, err_msg.c_str());
+       close(fd);
+       return(0);
+       }
+@@ -4983,16 +5005,17 @@ void scan_non_child_tasks(void)
+ 
+       if (!found)
+         {
+-        char buf[MAXLINE];
++        std::ostringstream sbuf;
++        std::string buf;
+ 
+         extern int exiting_tasks;
+ 
+-        sprintf(buf, "found exited session %d for task %d in job %s",
+-            pTask->ti_qs.ti_sid,
+-            pTask->ti_qs.ti_task,
+-            pJob->ji_qs.ji_jobid);
++        sbuf << "found exited session " << pTask->ti_qs.ti_sid <<
++          " for task " << pTask->ti_qs.ti_task << " in job " <<
++          pJob->ji_qs.ji_jobid;
++        buf = sbuf.str();
+ 
+-        log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
++        log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf.c_str());
+ 
+         pTask->ti_qs.ti_exitstat = 0;  /* actually unknown */
+         pTask->ti_qs.ti_status = TI_STATE_EXITED;
+@@ -5006,10 +5029,11 @@ void scan_non_child_tasks(void)
+ 
+           if (LOGLEVEL >= 7)
+             {
+-            sprintf(buf, "marking job as MOM_JOB_RECOVERY for task %d",
+-                pTask->ti_qs.ti_task);
++            sbuf << "marking job as MOM_JOB_RECOVERY for task " <<
++              pTask->ti_qs.ti_task);
++            buf = sbuf.str();
+ 
+-            log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, pJob->ji_qs.ji_jobid, buf);
++            log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, pJob->ji_qs.ji_jobid, buf.c_str());
+             }
+           }
+ #endif    /* USESAVEDRESOURCES */
+@@ -5075,7 +5099,6 @@ const char *idletime(
+   DIR         *dp;
+ 
+   struct dirent *de;
+-  char          ttyname[50];
+   time_t         curtm;
+ 
+   if (attrib)
+@@ -5104,16 +5127,18 @@ const char *idletime(
+ 
+   while ((de = readdir(dp)) != NULL)
+     {
++    std::string ttyname;
++
+     if (maxtm >= curtm)
+       break;
+ 
+     if (strncmp(de->d_name, "tty", 3))
+       continue;
+ 
+-    sprintf(ttyname, "/dev/%s",
+-            de->d_name);
++    ttyname = "/dev/";
++    ttyname += de->d_name;
+ 
+-    setmax(ttyname);
++    setmax(ttyname.c_str());
+     }
+ 
+   closedir(dp);
+diff --git a/src/resmom/mom_main.c b/src/resmom/mom_main.c
+index 2d8453a15f..35896e58b1 100644
+--- a/src/resmom/mom_main.c
++++ b/src/resmom/mom_main.c
+@@ -1067,7 +1067,7 @@ char *conf_res(
+     goto done;
+     }
+ 
+-  name[i] = '\0';
++  name[i] = NULL;
+ 
+   for (d = ret_string, resline++;*resline;)
+     {
+@@ -6519,17 +6519,17 @@ void prepare_child_tasks_for_delete()
+     for (unsigned int i = 0; i < pJob->ji_tasks->size(); i++)
+       {
+       task *pTask = pJob->ji_tasks->at(i);
+-
+-      char buf[128];
++      std::ostringstream sbuf;
++      std::string buf;
+ 
+       extern int exiting_tasks;
+ 
+-      sprintf(buf, "preparing exited session %d for task %d in job %s for deletion",
+-              pTask->ti_qs.ti_sid,
+-              pTask->ti_qs.ti_task,
+-              pJob->ji_qs.ji_jobid);
++      sbuf << "preparing exited session " << pTask->ti_qs.ti_sid <<
++        " for task " << pTask->ti_qs.ti_task << " in job " <<
++        pJob->ji_qs.ji_jobid << " for deletion";
++      buf = sbuf.str();
+ 
+-      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
++      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf.c_str());
+ 
+       pTask->ti_qs.ti_exitstat = 0;  /* actually unknown */
+       pTask->ti_qs.ti_status = TI_STATE_EXITED;
+diff --git a/src/resmom/mom_req_quejob.c b/src/resmom/mom_req_quejob.c
+index 2211f52d55..4e10581184 100644
+--- a/src/resmom/mom_req_quejob.c
++++ b/src/resmom/mom_req_quejob.c
+@@ -743,11 +743,15 @@ void req_mvjobfile(
+ 
+   if (pj == NULL)
+     {
+-    snprintf(log_buffer, 1024, "cannot find job %s for move of %s file",
+-      preq->rq_ind.rq_jobfile.rq_jobid,
+-      TJobFileType[jft]);
++    std::string err_msg;
+ 
+-    log_err(-1, __func__, log_buffer);
++    err_msg = "cannot find job ";
++    err_msg += preq->rq_ind.rq_jobfile.rq_jobid;
++    err_msg += " for move of ";
++    err_msg += TJobFileType[jft];
++    err_msg += " file";
++
++    log_err(-1, __func__, err_msg.c_str());
+ 
+     req_reject(PBSE_UNKJOBID, 0, preq, NULL, NULL);
+ 
+diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c
+index f90c2cd227..e03395225a 100644
+--- a/src/resmom/mom_server.c
++++ b/src/resmom/mom_server.c
+@@ -1900,7 +1900,6 @@ void mom_server_diag(
+   std::stringstream &output)
+ 
+   {
+-  char tmpLine[1024];
+   time_t Now;
+ 
+   if (pms->pbs_servername[0] == '\0')
+@@ -1910,22 +1909,18 @@ void mom_server_diag(
+ 
+   time(&Now);
+ 
+-  sprintf(tmpLine, "Server[%d]: %s (%s)\n",
+-          sindex,
+-          pms->pbs_servername,
+-          netaddr(&(pms->sock_addr)));
+-
+-  output << tmpLine;
++  output << "Server[" << sindex << "]: " << pms->pbs_servername <<
++    " (" << netaddr(&(pms->sock_addr)) << ")\n";
+ 
+   if (pms->MOMSendStatFailure[0] != '\0')
+     {
+-    sprintf(tmpLine, "  WARNING:  could not open connection to server, %s%s\n",
+-            pms->MOMSendStatFailure,
+-            (strstr(pms->MOMSendStatFailure, "cname") != NULL) ?
+-            " (check name resolution - /etc/hosts?)" :
+-            "");
++    output << "  WARNING:  could not open connection to server, " <<
++      pms->MOMSendStatFailure;
++
++    if (strstr(pms->MOMSendStatFailure, "cname") != NULL)
++      output << " (check name resolution - /etc/hosts?)";
+ 
+-    output << tmpLine;
++    output << "\n";
+     }
+ 
+   if (TMOMRejectConn[0] != '\0')
+@@ -1935,30 +1930,26 @@ void mom_server_diag(
+ 
+   if (pms->MOMLastRecvFromServerTime > 0)
+     {
+-    sprintf(tmpLine, "  Last Msg From Server:   %ld seconds (%s)\n",
+-            (long)Now - pms->MOMLastRecvFromServerTime,
+-            (pms->MOMLastRecvFromServerCmd[0] != '\0') ?
+-            pms->MOMLastRecvFromServerCmd : "N/A");
++    output << "  Last Msg From Server:   " <<
++      ((long)Now - pms->MOMLastRecvFromServerTime) << " seconds (" <<
++      ((pms->MOMLastRecvFromServerCmd[0] != '\0') ?
++        pms->MOMLastRecvFromServerCmd : "N/A") << "\n";
+     }
+   else
+     {
+-    sprintf(tmpLine, "  WARNING:  no messages received from server\n");
++    output << "  WARNING:  no messages received from server\n";
+     }
+ 
+-  output << tmpLine;
+-
+   if (pms->MOMLastSendToServerTime > 0)
+     {
+-    sprintf(tmpLine, "  Last Msg To Server:     %ld seconds\n",
+-            (long)Now - pms->MOMLastSendToServerTime);
++    output << "  Last Msg To Server:     " <<
++      ((long)Now - pms->MOMLastSendToServerTime) << " seconds\n";
+     }
+   else
+     {
+-    sprintf(tmpLine, "  WARNING:  no messages sent to server\n");
++    output << "  WARNING:  no messages sent to server\n";
+     }
+ 
+-  output << tmpLine;
+-
+   return;
+   }  /* END mom_server_diag() */
+ 
+diff --git a/src/resmom/parse_config.c b/src/resmom/parse_config.c
+index 8c4bb8585d..35efb7880e 100644
+--- a/src/resmom/parse_config.c
++++ b/src/resmom/parse_config.c
+@@ -2385,14 +2385,14 @@ void reset_config_vars()
+   mom_host[0] = '\0';
+   hostname_specified = 0;
+   MOMConfigRReconfig = 0;
+-  TNoSpoolDirList[0] = '\0';
++  TNoSpoolDirList[0] = NULL;
+   is_reporter_mom = FALSE;
+   is_login_node = FALSE;
+   job_exit_wait_time = DEFAULT_JOB_EXIT_WAIT_TIME;
+   jobstarter_exe_name[0] = '\0';
+   jobstarter_set = 0;
+   server_alias = NULL;
+-  TRemChkptDirList[0] = '\0';
++  TRemChkptDirList[0] = NULL;
+   tmpdir_basename[0] = '\0';  /* for $TMPDIR */
+   rcp_path[0] = '\0';
+   rcp_args[0] = '\0';
+diff --git a/src/resmom/requests.c b/src/resmom/requests.c
+index 588905e4e3..6fce46cdfb 100644
+--- a/src/resmom/requests.c
++++ b/src/resmom/requests.c
+@@ -1490,16 +1490,16 @@ void req_modifyjob(
+   int            rc;
+   unsigned int   momport = 0;
+ 
+-  char           tmpLine[1024];
++  std::string    tmpLine;
+ 
+   pjob = mom_find_job(preq->rq_ind.rq_modify.rq_objname);
+ 
+   if (pjob == NULL)
+     {
+-    sprintf(tmpLine, "modify job failed, unknown job %s",
+-            preq->rq_ind.rq_modify.rq_objname);
++    tmpLine = "modify job failed, unknown job ";
++    tmpLine += preq->rq_ind.rq_modify.rq_objname;
+ 
+-    req_reject(PBSE_UNKJOBID, 0, preq, mom_host, tmpLine);
++    req_reject(PBSE_UNKJOBID, 0, preq, mom_host, tmpLine.c_str());
+ 
+     return;
+     }
+diff --git a/src/scheduler.cc/samples/fifo/dedtime.c b/src/scheduler.cc/samples/fifo/dedtime.c
+index b919ec8946..246bd4f8af 100644
+--- a/src/scheduler.cc/samples/fifo/dedtime.c
++++ b/src/scheduler.cc/samples/fifo/dedtime.c
+@@ -118,7 +118,7 @@ int parse_ded_file(const char *filename)
+ 
+   i = 0;
+ 
+-  memset(conf.ded_time, 0, MAX_DEDTIME_SIZE);
++  memset(conf.ded_time, 0, sizeof(struct timegap) * MAX_DEDTIME_SIZE);
+ 
+   while (fgets(line, 256, fp) != NULL)
+     {
+diff --git a/src/server/array_func.c b/src/server/array_func.c
+index fabe4541fa..8f5caf0520 100644
+--- a/src/server/array_func.c
++++ b/src/server/array_func.c
+@@ -4,7 +4,7 @@
+ 
+   included functions:
+ 
+-  is_array() determine if jobnum is actually an array identifyer
++  is_id_array() determine if jobnum is actually an array identifyer
+   get_array() return array struct for given "parent id"
+   array_save() save array struct to disk
+   array_get_parent_id() return id of parent job if job belongs to a job array
+@@ -90,7 +90,7 @@ void        force_purge_work(job *pjob);
+ 
+ /* search job array list to determine if id is a job array */
+ 
+-int is_array(
++int is_id_array(
+     
+   char *id)
+ 
+@@ -154,7 +154,7 @@ int is_array(
+   allarrays.unlock();
+ 
+   return(rc);
+-  } /* END is_array() */
++  } /* END is_id_array() */
+ 
+ 
+ 
+diff --git a/src/server/array_func.h b/src/server/array_func.h
+index 6cb1b84c9c..70e3d326f7 100644
+--- a/src/server/array_func.h
++++ b/src/server/array_func.h
+@@ -8,7 +8,7 @@
+ #include "batch_request.h" /* batch_request */
+ 
+ 
+-int is_array(char *id);
++int is_id_array(char *id);
+ 
+ int array_save(job_array *pa);
+ 
+diff --git a/src/server/job_func.c b/src/server/job_func.c
+index dbc47de458..8922deab35 100644
+--- a/src/server/job_func.c
++++ b/src/server/job_func.c
+@@ -2387,22 +2387,36 @@ int fix_cray_exec_hosts(
+ 
+ 
+ 
++// change job id from x.y to x-0.y
+ 
+ int change_external_job_name(
+ 
+   job *pjob)
+ 
+   {
+-  char  tmp_jobid[PBS_MAXSVRJOBID + 1];
+-  char *dot = strchr(pjob->ji_qs.ji_jobid, '.');
++  std::string jobid_new;
++  size_t pos;
+ 
+-  if (dot != NULL)
+-    *dot = '\0';
++  // null job pointer
++  if (pjob == NULL)
++    return(-1);
+ 
+-  snprintf(tmp_jobid, sizeof(tmp_jobid), "%s-0.%s",
+-    pjob->ji_qs.ji_jobid, dot + 1);
++  // copy original job id
++  jobid_new = pjob->ji_qs.ji_jobid;
++
++  // make sure job id has a .
++  if ((pos = jobid_new.find('.', 0)) == std::string::npos)
++    return(-1);
++
++  // change "." to "-0."
++  jobid_new.replace(pos, 1, "-0.");
++
++  // confirm new string will fit
++  if (jobid_new.length() > PBS_MAXSVRJOBID)
++    return(-1);
+ 
+-  strcpy(pjob->ji_qs.ji_jobid, tmp_jobid);
++  // update original
++  strncpy(pjob->ji_qs.ji_jobid, jobid_new.c_str(), PBS_MAXSVRJOBID);
+ 
+   return(PBSE_NONE);
+   } /* END change_external_job_name() */
+diff --git a/src/server/node_attr_def.c b/src/server/node_attr_def.c
+index 37aa121ca2..386f12b32d 100644
+--- a/src/server/node_attr_def.c
++++ b/src/server/node_attr_def.c
+@@ -380,7 +380,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -392,7 +392,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -404,7 +404,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -416,7 +416,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -428,7 +428,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -440,7 +440,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-    NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -452,7 +452,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-		NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+@@ -464,7 +464,7 @@ attribute_def node_attr_def[] =
+ 	  set_l,
+ 	  comp_null,
+ 	  free_null,
+-		NULL_FUNC,
++          NULL_FUNC,
+ 	  NO_USER_SET,
+ 	  ATR_TYPE_LONG,
+ 	  PARENT_TYPE_NODE,
+diff --git a/src/server/node_manager.c b/src/server/node_manager.c
+index 663b741da6..92c4d73f8a 100644
+--- a/src/server/node_manager.c
++++ b/src/server/node_manager.c
+@@ -924,9 +924,10 @@ void process_legacy_job_attribute_information(
+       {
+       char *attr_name = threadsafe_tokenizer(&attr_val, "=");
+ 
+-      if ((attr_name != NULL) &&
+-          (attr_val != '\0'))
++      if ((attr_name != NULL) && (*attr_name != '\0') &&
++          (attr_val != NULL) && (*attr_val != '\0'))
+         {
++        // convert attr_name, attr_val strings to an attribute
+         if (str_to_attr(attr_name, attr_val, pjob->ji_wattr, job_attr_def, JOB_ATR_LAST) == ATTR_NOT_FOUND)
+           {
+           // should be resources used if not found as attribute
+diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c
+index 0233800586..1a639ab2dc 100644
+--- a/src/server/pbsd_init.c
++++ b/src/server/pbsd_init.c
+@@ -2667,6 +2667,8 @@ int pbsd_init_job(
+ 
+       svr_setjobstate(pjob, JOB_STATE_COMPLETE, JOB_SUBSTATE_COMPLETE, FALSE);
+ 
++      // fall through
++
+ 
+     case JOB_SUBSTATE_COMPLETE:
+ 
+diff --git a/src/server/process_request.c b/src/server/process_request.c
+index e7f243f58e..ec1935cca4 100644
+--- a/src/server/process_request.c
++++ b/src/server/process_request.c
+@@ -795,7 +795,7 @@ int dispatch_request(
+        * req_deletejob() function.
+       */
+ 
+-      if (is_array(request->rq_ind.rq_delete.rq_objname))
++      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
+         rc = req_deletearray(request);
+       else
+         rc = req_deletejob(request);
+@@ -803,7 +803,7 @@ int dispatch_request(
+       break;
+ 
+     case PBS_BATCH_HoldJob:
+-      if (is_array(request->rq_ind.rq_hold.rq_orig.rq_objname))
++      if (is_id_array(request->rq_ind.rq_hold.rq_orig.rq_objname))
+         rc = req_holdarray(request);
+       else
+         rc = req_holdjob(request);
+@@ -843,7 +843,7 @@ int dispatch_request(
+     case PBS_BATCH_AsyModifyJob:
+ 
+     case PBS_BATCH_ModifyJob:
+-      if (is_array(request->rq_ind.rq_delete.rq_objname))
++      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
+         rc = req_modifyarray(request);
+       else
+         req_modifyjob(request);
+@@ -888,7 +888,7 @@ int dispatch_request(
+ 
+     case PBS_BATCH_ReleaseJob:
+ 
+-      if (is_array(request->rq_ind.rq_delete.rq_objname))
++      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
+         rc = req_releasearray(request);
+       else
+         rc = req_releasejob(request);
+@@ -972,7 +972,7 @@ int dispatch_request(
+ 
+     case PBS_BATCH_RegistDep:
+ 
+-      if (is_array(request->rq_ind.rq_register.rq_parent))
++      if (is_id_array(request->rq_ind.rq_register.rq_parent))
+         {
+         rc = req_registerarray(request);
+         }
+diff --git a/src/server/req_quejob.c b/src/server/req_quejob.c
+index e30acbb59d..5ce1ec3fdf 100644
+--- a/src/server/req_quejob.c
++++ b/src/server/req_quejob.c
+@@ -326,7 +326,7 @@ void sum_select_mem_request(
+       tmp = atoi(current);
+       
+       /* advance past the digits to the units */
+-      while ((current != '\0') &&
++      while ((*current != '\0') &&
+              (isdigit(*current)))
+         current++;
+ 
+diff --git a/src/server/req_runjob.c b/src/server/req_runjob.c
+index 8b128b8dba..59dbe77b48 100644
+--- a/src/server/req_runjob.c
++++ b/src/server/req_runjob.c
+@@ -1676,8 +1676,14 @@ job *chk_job_torun(
+ 
+   if ((pjob->ji_qs.ji_state != JOB_STATE_QUEUED) && (pjob->ji_qs.ji_state != JOB_STATE_HELD))
+     {
+-    sprintf(EMsg, "job %s state %s", pjob->ji_qs.ji_jobid, PJobState[pjob->ji_qs.ji_state]);
+-    req_reject(PBSE_BADSTATE, 0, preq, NULL, EMsg);
++    std::string err_msg;
++
++    err_msg = "job ";
++    err_msg += pjob->ji_qs.ji_jobid;
++    err_msg += " state ";
++    err_msg += PJobState[pjob->ji_qs.ji_state];
++
++    req_reject(PBSE_BADSTATE, 0, preq, NULL, err_msg.c_str());
+     return(NULL);
+     }
+ 
+diff --git a/src/server/req_stat.c b/src/server/req_stat.c
+index 21a608aeee..392f22772e 100644
+--- a/src/server/req_stat.c
++++ b/src/server/req_stat.c
+@@ -241,7 +241,7 @@ int req_stat_job(
+     {
+     /* status a single job */
+ 
+-    if (is_array(name))
++    if (is_id_array(name))
+       {
+       if (type != tjstSummarizeArraysServer)
+         {
+diff --git a/src/server/svr_chk_owner.c b/src/server/svr_chk_owner.c
+index 4b33c57226..b98135710e 100644
+--- a/src/server/svr_chk_owner.c
++++ b/src/server/svr_chk_owner.c
+@@ -413,9 +413,8 @@ int authenticate_user(
+ 
+   {
+   int    rc;
+-  char   uath[PBS_MAXUSER + PBS_MAXHOSTNAME + 1];
+   time_t time_now = time(NULL);
+-  char   error_msg[1024];
++  std::string error_msg;
+   long   acl_enabled = FALSE;
+ 
+ #ifdef MUNGE_AUTH
+@@ -437,9 +436,14 @@ int authenticate_user(
+     if ((acl_check_my_array_string(my_acl, uh, ACL_User_Host)) == 0)
+       {
+       *autherr = strdup("User not in authorized user list.");
+-      sprintf(error_msg, "%s Requested user %s: requested from host %s",
+-                     *autherr, preq->rq_user, preq->rq_host);
+-      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
++
++      error_msg = *autherr;
++      error_msg += " Requested user ";
++      error_msg += preq->rq_user;
++      error_msg += ": requested from host ";
++      error_msg += preq->rq_host;
++  
++      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
+       return(PBSE_BADCRED);
+       }
+     }
+@@ -447,9 +451,16 @@ int authenticate_user(
+   if (strncmp(preq->rq_user, pcred->username, PBS_MAXUSER))
+     {
+     *autherr = strdup("Users do not match");
+-    sprintf(error_msg, "%s: Requested user %s: credential user %s: requested from host %s",
+-                   *autherr, preq->rq_user, pcred->username, preq->rq_host);
+-    log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
++
++    error_msg = *autherr;
++    error_msg += " Requested user ";
++    error_msg += preq->rq_user;
++    error_msg += ": credential user ";
++    error_msg += pcred->username;
++    error_msg += ": requested from host ";
++    error_msg += preq->rq_host;
++
++    log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
+     return(PBSE_BADCRED);
+     }
+ #endif
+@@ -481,10 +492,14 @@ int authenticate_user(
+         (memcmp(sai1, sai2, sizeof(struct sockaddr_in))))
+       {
+       *autherr = strdup("Hosts do not match");
+-      
+-      sprintf(error_msg, "%s: Requested host %s: credential host: %s",
+-        *autherr, preq->rq_host, pcred->hostname);
+-      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
++     
++      error_msg = *autherr; 
++      error_msg += ": Requested host ";
++      error_msg += preq->rq_host;
++      error_msg += ": credential host: ";
++      error_msg += pcred->hostname;
++
++      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
+     
+       return(PBSE_BADCRED);
+       }
+@@ -520,10 +535,14 @@ int authenticate_user(
+   if (acl_enabled)
+     {
+     struct array_strings *acl_users = NULL;
+-    snprintf(uath, sizeof(uath), "%s@%s", preq->rq_user, preq->rq_host);
++    std::string uath;
++
++    uath = preq->rq_user;
++    uath += "@";
++    uath = preq->rq_host;
+     
+     get_svr_attr_arst(SRV_ATR_AclUsers, &acl_users);
+-    if (acl_check_my_array_string(acl_users, uath, ACL_User) == 0)
++    if (acl_check_my_array_string(acl_users, uath.c_str(), ACL_User) == 0)
+       {
+       int       my_err;
+       pbs_net_t connect_addr = get_hostaddr(&my_err, preq->rq_host);
+diff --git a/src/test/catch_child/scaffolding.c b/src/test/catch_child/scaffolding.c
+index 7db1077854..f08383d01e 100644
+--- a/src/test/catch_child/scaffolding.c
++++ b/src/test/catch_child/scaffolding.c
+@@ -1012,6 +1012,7 @@ int DIS_reply_read(struct tcp_chan *chan, struct batch_reply *preply)
+         {
+       case 1:
+           rc = 1;
++          // fall through
+       case 2:
+           preply->brp_code = PBSE_NONE;
+           LOGLEVEL = 4;
+diff --git a/src/test/geteusernam/scaffolding.c b/src/test/geteusernam/scaffolding.c
+index ec849ab6df..f2cb83be16 100644
+--- a/src/test/geteusernam/scaffolding.c
++++ b/src/test/geteusernam/scaffolding.c
+@@ -64,7 +64,7 @@ void get_jobowner(char *from, char *to)
+   exit(1);
+   }
+ 
+-int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
++int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
+   {
+   return(0);
+   }
+diff --git a/src/test/node_manager/test_uut.c b/src/test/node_manager/test_uut.c
+index 75c23b39af..b4aa98912f 100644
+--- a/src/test/node_manager/test_uut.c
++++ b/src/test/node_manager/test_uut.c
+@@ -284,12 +284,12 @@ END_TEST
+ START_TEST(test_kill_job_on_mom)
+   {
+   struct pbsnode  pnode;
+-  char            job_id[20];
++  char            *job_id;
+   int             rc;
+   unsigned long   addr = 4567;
+ 
+   memset(&pnode, 0, sizeof(pnode));
+-  strcpy(job_id, "33.torque-devtest-03");
++  job_id = strdup("33.torque-devtest-03");
+ 
+   pnode.change_name("numa3.ac");
+   pnode.nd_mom_port = 1234;
+diff --git a/src/test/pbs_log/scaffolding.c b/src/test/pbs_log/scaffolding.c
+index fc5878c601..d63f053851 100644
+--- a/src/test/pbs_log/scaffolding.c
++++ b/src/test/pbs_log/scaffolding.c
+@@ -37,8 +37,7 @@ DIR *opendir(const char *name)
+ 
+ int closedir(DIR *dirp)
+   {
+-  if (dirp != NULL)
+-    free(dirp);
++  free(dirp);
+   return(0);
+   }
+ 
+diff --git a/src/test/pbsd_main/scaffolding.c b/src/test/pbsd_main/scaffolding.c
+index 90110e8fe8..0d7179a795 100644
+--- a/src/test/pbsd_main/scaffolding.c
++++ b/src/test/pbsd_main/scaffolding.c
+@@ -407,7 +407,7 @@ int get_svr_attr_arst(int index, struct array_strings **arst)
+   return(0);
+   }
+ 
+-int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
++int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
+   {
+   return(0);
+   }
+diff --git a/src/test/process_alps_status/scaffolding.c b/src/test/process_alps_status/scaffolding.c
+index dd8ab2c577..3c6449aa70 100644
+--- a/src/test/process_alps_status/scaffolding.c
++++ b/src/test/process_alps_status/scaffolding.c
+@@ -713,6 +713,8 @@ int set_arst(
+       pas->as_next = pas->as_buf;
+ 
+       /* no break, "SET" falls into "MERGE" to add strings */
++      // fall through
++
+     case INCR_OLD:
+     case MERGE:
+ 
+diff --git a/src/test/process_request/scaffolding.c b/src/test/process_request/scaffolding.c
+index 66618f8900..36aff63746 100644
+--- a/src/test/process_request/scaffolding.c
++++ b/src/test/process_request/scaffolding.c
+@@ -373,9 +373,9 @@ int req_modify_node(struct batch_request *preq)
+   }
+ 
+ 
+-int is_array(char *id)
++int is_id_array(char *id)
+   {
+-  fprintf(stderr, "The call to is_array needs to be mocked!!\n");
++  fprintf(stderr, "The call to is_id_array needs to be mocked!!\n");
+   exit(1);
+   }
+ 
+@@ -489,7 +489,7 @@ int get_svr_attr_b(int index, bool *b)
+   return(0);
+   }
+ 
+-int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
++int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
+   {
+   return(0);
+   }
+diff --git a/src/test/req_stat/scaffolding.c b/src/test/req_stat/scaffolding.c
+index cbba4d809a..80f1956d61 100644
+--- a/src/test/req_stat/scaffolding.c
++++ b/src/test/req_stat/scaffolding.c
+@@ -221,9 +221,9 @@ int svr_connect(pbs_net_t hostaddr, unsigned int port, int *err, struct pbsnode
+   exit(1);
+   }
+ 
+-int is_array(char *id)
++int is_id_array(char *id)
+   {
+-  fprintf(stderr, "The call to is_array to be mocked!!\n");
++  fprintf(stderr, "The call to is_id_array to be mocked!!\n");
+   exit(1);
+   }
+ 
+diff --git a/src/test/svr_chk_owner/scaffolding.c b/src/test/svr_chk_owner/scaffolding.c
+index 6d00f6e381..59a8c84e95 100644
+--- a/src/test/svr_chk_owner/scaffolding.c
++++ b/src/test/svr_chk_owner/scaffolding.c
+@@ -79,7 +79,7 @@ int get_svr_attr_arst(int index, struct array_strings **arst)
+   return(0);
+   }
+ 
+-int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
++int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
+   {
+   return(0);
+   }
+diff --git a/torque.setup.in b/torque.setup.in
+index 15716c9b97..b0f2ee305f 100644
+--- a/torque.setup.in
++++ b/torque.setup.in
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #
+ # torque.setup - create pbs_server database and default queue
+ # 
+--- a/src/server/svr_jobfunc.c	2017-08-29 22:25:11.000000000 -0000
++++ b/src/server/svr_jobfunc.c	2019-10-22 14:29:39.465723637 -0000
+@@ -4015,16 +4015,18 @@
+ 
+   {
+   int rc = PBSE_NONE;
+-  char *err_msg = NULL;
+-  char stub_msg[] = "no pos";
++  std::string err_msg;
+ 
+   if (logging >= 10)
+     {
+-    err_msg = (char *)calloc(1, MSG_LEN_LONG);
+-    if (msg == NULL)
+-      msg = stub_msg;
+-    snprintf(err_msg, MSG_LEN_LONG, "locking %s in method %s-%s", pjob->ji_qs.ji_jobid, id, msg);
+-    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++    err_msg = "locking ";
++    err_msg += pjob->ji_qs.ji_jobid;
++    err_msg += " in method ";
++    err_msg += id;
++    err_msg += "-";
++    if (msg != NULL)
++      err_msg += msg;
++    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+     }
+ 
+   if (pjob->ji_mutex != NULL)
+@@ -4033,9 +4035,11 @@
+       {
+       if (logging >= 20)
+         {
+-        snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot lock job %s mutex in method %s",
+-                                     pjob->ji_qs.ji_jobid, id);
+-        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++        err_msg = "ALERT: cannot lock job ";
++        err_msg += pjob->ji_qs.ji_jobid;
++        err_msg += " mutex in method ";
++        err_msg += id;
++        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+         }
+       rc = PBSE_MUTEX;
+       }
+@@ -4046,9 +4050,6 @@
+     log_err(rc, __func__, "Uninitialized mutex pass to pthread_mutex_lock!");
+     }
+ 
+-  if (err_msg != NULL)
+-  free(err_msg);
+-
+   return rc;
+   }
+ 
+@@ -4063,16 +4064,18 @@
+ 
+   {
+   int rc = PBSE_NONE;
+-  char *err_msg = NULL;
+-  char stub_msg[] = "no pos";
++  std::string err_msg;
+ 
+   if (logging >= 10)
+     {
+-    err_msg = (char *)calloc(1, MSG_LEN_LONG);
+-    if (msg == NULL)
+-      msg = stub_msg;
+-    snprintf(err_msg, MSG_LEN_LONG, "unlocking %s in method %s-%s", pjob->ji_qs.ji_jobid, id, msg);
+-    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++    err_msg = "unlocking ";
++    err_msg += pjob->ji_qs.ji_jobid;
++    err_msg += " in method ";
++    err_msg += id;
++    err_msg += "-";
++    if (msg != NULL)
++      err_msg += msg;
++    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+     }
+ 
+   if (pjob->ji_mutex != NULL)
+@@ -4081,9 +4084,11 @@
+       {
+     if (logging >= 20)
+         {
+-        snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot unlock job %s mutex in method %s",
+-                                            pjob->ji_qs.ji_jobid, id);
+-        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++        err_msg = "ALERT: cannot unlock job ";
++        err_msg += pjob->ji_qs.ji_jobid;
++        err_msg += " mutex in method ";
++        err_msg += id;
++        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+         }
+       rc = PBSE_MUTEX;
+       }
+@@ -4094,9 +4099,6 @@
+     log_err(rc, __func__, "Uninitialized mutex pass to pthread_mutex_unlock!");
+     }
+ 
+-   if (err_msg != NULL)
+-     free(err_msg);
+-
+    return rc;
+    }
+ 
+@@ -4110,32 +4112,33 @@
+ 
+   {
+   int rc = PBSE_NONE;
+-  char *err_msg = NULL;
+-  char stub_msg[] = "no pos";
++  std::string err_msg;
+ 
+   if (logging >= 10)
+     {
+-    err_msg = (char *)calloc(1, MSG_LEN_LONG);
+-    if (msg == NULL)
+-      msg = stub_msg;
+-    snprintf(err_msg, MSG_LEN_LONG, "locking %s in method %s-%s", pa->ai_qs.parent_id, id, msg);
+-    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++    err_msg = "locking ";
++    err_msg += pa->ai_qs.parent_id,
++    err_msg += " in method ";
++    err_msg += id;
++    err_msg += "-";
++    if (msg != NULL)
++      err_msg += msg;
++    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+     }
+ 
+   if (pthread_mutex_lock(pa->ai_mutex) != 0)
+     {
+     if (logging >= 20)
+       {
+-      snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot lock job array %s mutex in method %s",
+-                                   pa->ai_qs.parent_id, id);
+-      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++      err_msg = "ALERT: cannot lock job array ";
++      err_msg += pa->ai_qs.parent_id,
++      err_msg += " mutex in method ";
++      err_msg += id;
++      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+       }
+     rc = PBSE_MUTEX;
+     }
+ 
+-  if (err_msg != NULL)
+-  free(err_msg);
+-
+   return rc;
+   }
+ 
+@@ -4149,32 +4152,33 @@
+ 
+   {
+   int rc = PBSE_NONE;
+-  char *err_msg = NULL;
+-  char stub_msg[] = "no pos";
++  std::string err_msg;
+ 
+   if (logging >= 10)
+     {
+-    err_msg = (char *)calloc(1, MSG_LEN_LONG);
+-    if (msg == NULL)
+-      msg = stub_msg;
+-    snprintf(err_msg, MSG_LEN_LONG, "unlocking %s in method %s-%s", pa->ai_qs.parent_id, id, msg);
+-    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++    err_msg = "unlocking ";
++    err_msg += pa->ai_qs.parent_id,
++    err_msg += " in method ";
++    err_msg += id;
++    err_msg += "-";
++    if (msg != NULL)
++      err_msg += msg;
++    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+     }
+ 
+   if (pthread_mutex_unlock(pa->ai_mutex) != 0)
+     {
+     if (logging >= 20)
+       {
+-      snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot unlock job array %s mutex in method %s",
+-                                   pa->ai_qs.parent_id, id);
+-      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
++      err_msg = "ALERT: cannot unlock job array ";
++      err_msg += pa->ai_qs.parent_id,
++      err_msg += " mutex in method ";
++      err_msg += id;
++      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
+       }
+     rc = PBSE_MUTEX;
+     }
+ 
+-  if (err_msg != NULL)
+-  free(err_msg);
+-
+   return rc;
+   }
+ 

diff --git a/sys-cluster/torque/torque-6.0.4-r1.ebuild b/sys-cluster/torque/torque-6.0.4-r1.ebuild
index 1607c10d62d..93a88643f0d 100644
--- a/sys-cluster/torque/torque-6.0.4-r1.ebuild
+++ b/sys-cluster/torque/torque-6.0.4-r1.ebuild
@@ -47,8 +47,10 @@ RDEPEND="${DEPEND_COMMON}
 S="${WORKDIR}"/${PN}-6a0b37f85c7d644e9217cbab1542792d646f59a6
 
 PATCHES=(
+	"${FILESDIR}"/${P}-gcc7.patch
 	"${FILESDIR}"/${PN}-6.0.3-fix-emptystring-comparison.patch
 	"${FILESDIR}"/${P}-no-openssl.patch
+	"${FILESDIR}"/${P}-error_buf_overflow_prevent.patch
 )
 
 pkg_setup() {
@@ -92,8 +94,6 @@ src_prepare() {
 
 src_configure() {
 	append-cflags "-fpermissive"
-	use kernel_linux && append-cflags "-Dlinux"
-	append-cxxflags "-std=c++03"
 
 	econf \
 		$(use_enable tk gui) \

diff --git a/sys-cluster/torque/torque-6.0.4.ebuild b/sys-cluster/torque/torque-6.0.4.ebuild
deleted file mode 100644
index 42f1f078421..00000000000
--- a/sys-cluster/torque/torque-6.0.4.ebuild
+++ /dev/null
@@ -1,177 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit autotools flag-o-matic linux-info
-
-DESCRIPTION="Resource manager and queuing system based on OpenPBS"
-HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque"
-SRC_URI="https://github.com/adaptivecomputing/torque/archive/6a0b37f85c7d644e9217cbab1542792d646f59a6.tar.gz -> ${P}-gh-20170829.tar.gz"
-
-LICENSE="torque-2.5"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
-IUSE="autorun cgroups cpusets +crypt doc drmaa kernel_linux libressl munge nvidia quickcommit server +syslog tk"
-
-DEPEND_COMMON="
-	sys-libs/zlib
-	sys-libs/readline:0=
-	dev-libs/libxml2
-	>=dev-libs/boost-1.41
-	!libressl? ( dev-libs/openssl:0= )
-	libressl? ( dev-libs/libressl:0= )
-	cpusets? ( sys-apps/hwloc )
-	munge? ( sys-auth/munge )
-	nvidia? ( >=x11-drivers/nvidia-drivers-275 )
-	tk? (
-		dev-lang/tk:0=
-		dev-lang/tcl:0=
-	)
-	syslog? ( virtual/logger )
-	!!games-util/qstat"
-
-# libncurses.so is only needed for configure check on readline
-DEPEND="${DEPEND_COMMON}
-	sys-libs/ncurses:*
-	!!sys-cluster/slurm"
-
-RDEPEND="${DEPEND_COMMON}
-	crypt? ( net-misc/openssh )
-	!crypt? ( net-misc/netkit-rsh )
-	!dev-libs/uthash"
-
-# Torque should depend on dev-libs/uthash but that's pretty much impossible
-# to patch in as they ship with a broken configure such that files referenced
-# by the configure.ac and Makefile.am are missing.
-# http://www.supercluster.org/pipermail/torquedev/2014-October/004773.html
-
-S="${WORKDIR}"/${PN}-6a0b37f85c7d644e9217cbab1542792d646f59a6
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-6.0.3-fix-emptystring-comparison.patch
-)
-
-pkg_setup() {
-	PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/${PN}}"
-
-	# Find a Torque server to use.  Check environment, then
-	# current setup (if any), and fall back on current hostname.
-	if [ -z "${PBS_SERVER_NAME}" ]; then
-		if [ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]; then
-			PBS_SERVER_NAME="$(<${ROOT}${PBS_SERVER_HOME}/server_name)"
-		else
-			PBS_SERVER_NAME=$(hostname -f)
-		fi
-	fi
-
-	if use cpusets || use cgroups; then
-		if ! use kernel_linux; then
-			einfo
-			elog "    Torque currently only has support for cpusets and cgroups in linux."
-			elog "Assuming you didn't really want this USE flag and ignoring its state."
-			einfo
-		else
-			linux-info_pkg_setup
-			if ! linux_config_exists || ! linux_chkconfig_present CPUSETS; then
-				einfo
-				elog "    Torque support for cpusets will require that you recompile"
-				elog "your kernel with CONFIG_CPUSETS enabled."
-				einfo
-			fi
-		fi
-	fi
-}
-
-src_prepare() {
-	default
-	# We install to a valid location, no need to muck with ld.so.conf
-	# --without-loadlibfile is supposed to do this for us...
-	sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die
-	eautoreconf
-}
-
-src_configure() {
-	econf \
-		$(use_enable tk gui) \
-		$(use_enable tk tcl-qstat) \
-		$(use_enable syslog) \
-		$(use_enable server) \
-		$(use_enable drmaa) \
-		$(use_enable munge munge-auth) \
-		$(use_enable nvidia nvidia-gpus) \
-		$(usex crypt "--with-rcp=scp" "--with-rcp=mom_rcp") \
-		$(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
-		$(usex kernel_linux $(use_enable cpusets geometry-request) --disable-geometry-request) \
-		$(usex kernel_linux $(use_enable cgroups) --disable-cgroups) \
-		$(use_enable autorun) \
-		$(use_enable quickcommit) \
-		--with-server-home=${PBS_SERVER_HOME} \
-		--with-environ=/etc/pbs_environment \
-		--with-default-server=${PBS_SERVER_NAME} \
-		--disable-gcc-warnings \
-		--disable-silent-rules \
-		--with-tcp-retry-limit=2 \
-		--without-loadlibfile
-}
-
-src_install() {
-	local dir
-
-	DOCS=( CHANGELOG README.* Release_Notes )
-	use doc && DOCS+=( doc/admin_guide.ps doc/*.pdf )
-
-	default
-
-	# The build script isn't alternative install location friendly,
-	# So we have to fix some hard-coded paths in tclIndex for xpbs* to work
-	for file in $(find "${ED}" -iname tclIndex); do
-		sed \
-			-e "s/${ED//\// }/ /" \
-			-i "${file}" || die
-	done
-
-	for dir in $(find "${ED}/${PBS_SERVER_HOME}" -type d); do
-		keepdir "${dir#${ED}}"
-	done
-
-	if use server; then
-		newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server
-		newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched
-	fi
-	newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom
-	newconfd "${FILESDIR}"/${PN}-conf.d-munge ${PN}
-	newinitd "${FILESDIR}"/trqauthd-init.d trqauthd
-	newenvd "${FILESDIR}"/${PN}-env.d 25${PN}
-}
-
-pkg_preinst() {
-	if [[ -f "${ROOT}etc/pbs_environment" ]]; then
-		cp "${ROOT}etc/pbs_environment" "${ED}"/etc/pbs_environment || die
-	fi
-
-	if use server && [[ -f "${ROOT}${PBS_SERVER_HOME}/server_priv/nodes" ]]; then
-		cp \
-			"${EROOT}${PBS_SERVER_HOME}/server_priv/nodes" \
-			"${ED}/${PBS_SERVER_HOME}/server_priv/nodes" || die
-	fi
-
-	echo "${PBS_SERVER_NAME}" > "${ED}${PBS_SERVER_HOME}/server_name" || die
-
-	# Fix up the env.d file to use our set server home.
-	sed \
-		-e "s:/var/spool/${PN}:${PBS_SERVER_HOME}:g" \
-		-i "${ED}"/etc/env.d/25${PN} || die
-
-	if use munge; then
-		sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${ED}"/etc/conf.d/${PN} || die
-	fi
-}
-
-pkg_postinst() {
-	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
-		elog "If this is the first time torque has been installed, then you are not"
-		elog "ready to start the server.  Please refer to the documentation located at:"
-		elog "http://docs.adaptivecomputing.com/torque/${PN//./-}/adminGuide/help.htm#topics/torque/1-installConfig/initializeConfigOnServer.htm"
-	fi
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/
@ 2020-11-15 15:31 Joonas Niilola
  0 siblings, 0 replies; 5+ messages in thread
From: Joonas Niilola @ 2020-11-15 15:31 UTC (permalink / raw
  To: gentoo-commits

commit:     0c4b62b4f66782541d7a7fbb579a078e7661f38f
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 15 13:54:18 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Nov 15 15:31:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c4b62b4

sys-cluster/torque: fix SizeViolation issue

Closes: https://bugs.gentoo.org/748216
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sys-cluster/torque/Manifest                      |    1 +
 sys-cluster/torque/files/torque-6.0.4-gcc7.patch | 1606 ----------------------
 sys-cluster/torque/torque-6.0.4-r1.ebuild        |    5 +-
 3 files changed, 4 insertions(+), 1608 deletions(-)

diff --git a/sys-cluster/torque/Manifest b/sys-cluster/torque/Manifest
index 14f7f301012..712c69b3f5a 100644
--- a/sys-cluster/torque/Manifest
+++ b/sys-cluster/torque/Manifest
@@ -1,3 +1,4 @@
 DIST torque-4.1.7.tar.gz 6218108 BLAKE2B 6c1ad0f1bb3f364603ad7f498999bd910491910fa5632b9f6b82e08b3afb8c54e8775c38bc8e5c959aa99d0647c54c7c348cd07bcbe11add8bfab5f3f06a4c80 SHA512 5a085c0a7b205fed075bff4599db90ca5c4bb5f22d87d76fd56539d5cc1935bb8eeffcd4d18ba84401bd4ca128718070b69c8b91ab6814a4638622ba351654e6
 DIST torque-4.2.10-gh-20150517.tar.gz 5836286 BLAKE2B 7108f1adcb6f674526b7db97df4ebcee04ae5c818d4f35ed1230a4e72e52ec0bc3b44e17334a143b21bcd3acccefc3927eca4f98d54d37745c8bb46a75e07045 SHA512 600bb5389b6a4161732b7aa82627f1ebeae238d7091aa2e223d9a14c44bf4668662f664b976f62ba3f1d8a366f90fb6058a8c904e20c26432dccd6abcd9c57fa
+DIST torque-6.0.4-gcc7.patch 50412 BLAKE2B 43748e9bfd3811abdfeb56f93dd517fcb07a6902194120e2c9e16bbe5bbe0f04afd3f898616d46e0310902a6376671be0c8f3865e8f7dd5381fca46e7ad62fc8 SHA512 430ae6a80ebbfb2066831326f8ce25a34cb6fc17c1fbe4a202c495baceb2b7011c9f6782da31b78c34287f26765c76c587611d689791523b8bd53d634e3681b6
 DIST torque-6.0.4-gh-20170829.tar.gz 6182495 BLAKE2B f9156ae4ffe388a7f3fa0df142e5f2d48c16fd7b8c148a3a80cd1c977eb0c1ef4a455da275f993100867be043422526ed05c53734e707851083d6d23ee1a2cc4 SHA512 8f1101adb89e06617de501f7956e126633b78b495baeb7980d3c534d34537cc604a3cf0a7c23c48eb2554b26cc13672b0e00c75d0f722d63ac4d42d57388ed94

diff --git a/sys-cluster/torque/files/torque-6.0.4-gcc7.patch b/sys-cluster/torque/files/torque-6.0.4-gcc7.patch
deleted file mode 100644
index 340eb9e1bfc..00000000000
--- a/sys-cluster/torque/files/torque-6.0.4-gcc7.patch
+++ /dev/null
@@ -1,1606 +0,0 @@
-From 8a0b748d3644dde30372ee25c4fe05bec10b2166 Mon Sep 17 00:00:00 2001
-From: Chad Vizino <cvizino@adaptivecomputing.com>
-Date: Fri, 29 Mar 2019 09:23:08 -0600
-Subject: [PATCH] TRQ-4330 - fix gcc/g++ 7 compile issues
-
----
- src/cmds/qdel.c                            |  6 +-
- src/cmds/qsub_functions.c                  | 12 ++--
- src/cmds/qterm.c                           |  2 +
- src/include/array.h                        |  2 +-
- src/include/attribute.h                    |  4 +-
- src/lib/Libattr/attr_fn_acl.c              |  4 +-
- src/lib/Libattr/attr_fn_arst.c             |  4 +-
- src/lib/Libcmds/cvtdate.c                  |  8 +--
- src/lib/Libdis/disrsc.c                    |  2 +
- src/lib/Libdis/disrsi.c                    |  2 +
- src/lib/Libdis/disrsl.c                    |  2 +
- src/lib/Libdis/disrss.c                    |  2 +
- src/lib/Libnet/net_client.c                |  4 +-
- src/lib/Libnet/net_common.c                |  1 +
- src/lib/Libutils/jsoncpp.cpp               |  9 +++
- src/lib/Libutils/numa_chip.cpp             | 10 +--
- src/resmom/checkpoint.c                    | 59 ++++++++++------
- src/resmom/generate_alps_status.c          |  7 +-
- src/resmom/linux/mom_mach.c                | 79 +++++++++++++--------
- src/resmom/mom_main.c                      | 16 ++---
- src/resmom/mom_req_quejob.c                | 12 ++--
- src/resmom/mom_server.c                    | 41 +++++------
- src/resmom/parse_config.c                  |  4 +-
- src/resmom/requests.c                      |  8 +--
- src/scheduler.cc/samples/fifo/dedtime.c    |  2 +-
- src/server/array_func.c                    |  6 +-
- src/server/array_func.h                    |  2 +-
- src/server/geteusernam.c                   |  2 +-
- src/server/job_func.c                      | 28 ++++++--
- src/server/node_attr_def.c                 | 16 ++---
- src/server/node_manager.c                  |  5 +-
- src/server/pbsd_init.c                     |  2 +
- src/server/process_request.c               | 18 ++---
- src/server/req_jobobit.c                   | 16 ++++-
- src/server/req_quejob.c                    |  2 +-
- src/server/req_runjob.c                    | 10 ++-
- src/server/req_stat.c                      |  2 +-
- src/server/svr_chk_owner.c                 | 47 +++++++++----
- src/server/svr_jobfunc.c                   | 80 +++++++++++++++-------
- src/test/catch_child/scaffolding.c         |  1 +
- src/test/geteusernam/scaffolding.c         |  2 +-
- src/test/node_manager/test_uut.c           |  4 +-
- src/test/pbs_log/scaffolding.c             |  3 +-
- src/test/pbsd_main/scaffolding.c           |  2 +-
- src/test/process_alps_status/scaffolding.c |  2 +
- src/test/process_request/scaffolding.c     |  6 +-
- src/test/req_stat/scaffolding.c            |  4 +-
- src/test/svr_chk_owner/scaffolding.c       |  2 +-
- torque.setup.in                            |  2 +-
- 49 files changed, 358 insertions(+), 208 deletions(-)
-
-diff --git a/src/cmds/qdel.c b/src/cmds/qdel.c
-index 909018da66..d7e64f6289 100644
---- a/src/cmds/qdel.c
-+++ b/src/cmds/qdel.c
-@@ -49,7 +49,7 @@ void process_config_file(
- 
- 
- 
--bool is_array(
-+bool is_job_array(
- 
-   char *job_id)
- 
-@@ -66,7 +66,7 @@ bool is_array(
-     }
-     
-   return(false);
--  } /* END is_array() */
-+  } /* END is_job_array() */
- 
- 
- 
-@@ -289,7 +289,7 @@ int qdel_main(
-     snprintf(job_id, sizeof(job_id), "%s", argv[optind]);
-    
-     if ((dash_t == true) && 
--        (is_array(job_id) == false))
-+        (is_job_array(job_id) == false))
-       {
-       fprintf(stderr, "qdel: Error: job id '%s' isn't a job array but -t was specified.\n",
-         job_id);
-diff --git a/src/cmds/qsub_functions.c b/src/cmds/qsub_functions.c
-index 4fdfac0a7b..9799c831f4 100644
---- a/src/cmds/qsub_functions.c
-+++ b/src/cmds/qsub_functions.c
-@@ -3363,14 +3363,14 @@ void process_opts(
-         if (add_verify_resources(ji->res_attr, optarg, data_type) != 0)
-           print_qsub_usage_exit("qsub: illegal -l value");
- 
--          //If cpuclock gets set we need to set the node exclusive flag
-+        //If cpuclock gets set we need to set the node exclusive flag
-+        {
-+        job_data *pData = NULL;
-+        if (hash_find(ji->res_attr,"cpuclock",&pData))
-           {
--          job_data *pData = NULL;
--          if (hash_find(ji->res_attr,"cpuclock",&pData))
--            {
--            hash_add_or_exit(ji->job_attr, ATTR_node_exclusive, "TRUE", data_type);
--            }
-+          hash_add_or_exit(ji->job_attr, ATTR_node_exclusive, "TRUE", data_type);
-           }
-+        }
- 
-         break;
- 
-diff --git a/src/cmds/qterm.c b/src/cmds/qterm.c
-index d05bd42d4e..0519328c01 100644
---- a/src/cmds/qterm.c
-+++ b/src/cmds/qterm.c
-@@ -89,6 +89,8 @@ int main(
- 
-         local = true;
- 
-+        break;
-+
-       case 't':
- 
-         type = optarg;
-diff --git a/src/include/array.h b/src/include/array.h
-index 74050d0a25..d53dec1d3a 100644
---- a/src/include/array.h
-+++ b/src/include/array.h
-@@ -176,7 +176,7 @@ 
- #define TOKENS_TAG "tokens"
- #define TOKEN_TAG "token"
- 
--int  is_array(char *id);
-+int  is_id_array(char *id);
- int  array_delete(job_array *pa);
- int  array_save(job_array *pa);
- int  array_save(job_array *pa);
-diff --git a/src/include/attribute.h b/src/include/attribute.h
-index 8fbff163b8..3d025ab66f 100644
---- a/src/include/attribute.h
-+++ b/src/include/attribute.h
-@@ -512,12 +512,12 @@ int to_size(const char *val, struct size_value *psize);
- void from_size(struct size_value *psize, char *cvnbuf);
- void create_size_string(char *buf, struct size_value values);
- 
--#define NULL_FUNC '\0'
-+#define NULL_FUNC NULL
- 
- /* other associated funtions */
- 
- int   acl_check(pbs_attribute *, char *canidate, int type);
--int   acl_check_my_array_string(struct array_strings *, char *, int);
-+int   acl_check_my_array_string(struct array_strings *, const char *, int);
- char *arst_string(const char *str, pbs_attribute *pattr);
- void  attrl_fixlink(tlist_head *svrattrl);
- void  recov_acl(pbs_attribute *, attribute_def *, const char *, const char *);
-diff --git a/src/lib/Libattr/attr_fn_acl.c b/src/lib/Libattr/attr_fn_acl.c
-index ebb2775bf4..a7368b9f3b 100644
---- a/src/lib/Libattr/attr_fn_acl.c
-+++ b/src/lib/Libattr/attr_fn_acl.c
-@@ -232,7 +232,7 @@ fptr_int get_my_match_func(
- int acl_check_my_array_string(
- 
-   struct array_strings *pas,
--  char                 *name,
-+  const char           *name,
-   int                   type)
- 
-   {
-@@ -503,6 +503,8 @@ int set_allacl(
- 
-       /* No break, "Set" falls into "Incr" to add strings */
- 
-+      // fall through
-+
-     case INCR_OLD:
-     case INCR:
- 
-diff --git a/src/lib/Libattr/attr_fn_arst.c b/src/lib/Libattr/attr_fn_arst.c
-index c63281637e..9d82e873a3 100644
---- a/src/lib/Libattr/attr_fn_arst.c
-+++ b/src/lib/Libattr/attr_fn_arst.c
-@@ -532,7 +532,8 @@ int encode_arst(
- 
-         *pc++ = '\\';
- 
--        // escape sequence added. Fall through.
-+        // escape sequence added.
-+        // fall through
- 
-       default:
- 
-@@ -735,6 +736,7 @@ int set_arst(
-       pas->as_next = pas->as_buf;
- 
-       /* no break, "SET" falls into "MERGE" to add strings */
-+      // fall through
- 
-     case INCR_OLD:
-     case MERGE:
-diff --git a/src/lib/Libcmds/cvtdate.c b/src/lib/Libcmds/cvtdate.c
-index e936c6fbed..0e24639619 100644
---- a/src/lib/Libcmds/cvtdate.c
-+++ b/src/lib/Libcmds/cvtdate.c
-@@ -167,7 +167,7 @@ time_t cvtdate(
-       year   = atoi(buf) * 100;
-       datestr += 2;
- 
--      /* no break, fall into next case */
-+      // fall through
- 
-     case 10:  /* YYMMDDhhmm */
-       buf[0] = datestr[0];
-@@ -187,7 +187,7 @@ time_t cvtdate(
- 
-       datestr += 2;
- 
--      /* no break, fall into next case */
-+      // fall through
- 
-     case 8:  /* MMDDhhmm */
-       buf[0] = datestr[0];
-@@ -209,7 +209,7 @@ time_t cvtdate(
- 
-       datestr += 2;
- 
--      /* no break, fall into next case */
-+      // fall through
- 
-     case 6:  /* DDhhmm */
-       buf[0] = datestr[0];
-@@ -229,7 +229,7 @@ time_t cvtdate(
- 
-       datestr += 2;
- 
--      /* no break, fall into next case */
-+      // fall through
- 
-     case 4:  /* hhmm */
-       buf[0] = datestr[0];
-diff --git a/src/lib/Libdis/disrsc.c b/src/lib/Libdis/disrsc.c
-index ac7fec6cbb..2baf87b2b9 100644
---- a/src/lib/Libdis/disrsc.c
-+++ b/src/lib/Libdis/disrsc.c
-@@ -141,6 +141,8 @@ signed char disrsc(
-       else
-         locret = DIS_OVERFLOW;
- 
-+      // fall through
-+
-     case DIS_OVERFLOW:
-       value = negate ? SCHAR_MIN : SCHAR_MAX;
-     }
-diff --git a/src/lib/Libdis/disrsi.c b/src/lib/Libdis/disrsi.c
-index a2417725fe..dd073b1bb0 100644
---- a/src/lib/Libdis/disrsi.c
-+++ b/src/lib/Libdis/disrsi.c
-@@ -141,6 +141,8 @@ int disrsi(
-         *retval = locret;
-         }
- 
-+    // fall through
-+
-     case DIS_OVERFLOW:
- 
-       value = negate ? INT_MIN : INT_MAX;
-diff --git a/src/lib/Libdis/disrsl.c b/src/lib/Libdis/disrsl.c
-index 9853056fcf..5fba4a4ba0 100644
---- a/src/lib/Libdis/disrsl.c
-+++ b/src/lib/Libdis/disrsl.c
-@@ -139,6 +139,8 @@ long disrsl(
-       else
-         locret = DIS_OVERFLOW;
- 
-+      // fall through
-+
-     case DIS_OVERFLOW:
-       value = negate ? LONG_MIN : LONG_MAX;
-     }
-diff --git a/src/lib/Libdis/disrss.c b/src/lib/Libdis/disrss.c
-index 80eb98109b..e2496b8adf 100644
---- a/src/lib/Libdis/disrss.c
-+++ b/src/lib/Libdis/disrss.c
-@@ -140,6 +140,8 @@ short disrss(
-       else
-         locret = DIS_OVERFLOW;
- 
-+      // fall through
-+
-     case DIS_OVERFLOW:
-       value = negate ? SHRT_MIN : SHRT_MAX;
-     }
-diff --git a/src/lib/Libnet/net_client.c b/src/lib/Libnet/net_client.c
-index 8f8542320b..a324c08197 100644
---- a/src/lib/Libnet/net_client.c
-+++ b/src/lib/Libnet/net_client.c
-@@ -532,7 +532,7 @@ int client_to_svr(
-         break;
-         }/* Interrupted system call */
-       
--      /* fall through to next case */
-+      // fall through
- 
-     case EINVAL:		/* Invalid argument */
-     
-@@ -583,6 +583,8 @@ int client_to_svr(
-         
-         goto retry;
-         }
-+
-+      // fall through
-       
-     default:
-       
-diff --git a/src/lib/Libnet/net_common.c b/src/lib/Libnet/net_common.c
-index 7b36d31aa1..80bb78bee5 100644
---- a/src/lib/Libnet/net_common.c
-+++ b/src/lib/Libnet/net_common.c
-@@ -405,6 +405,7 @@ int socket_connect_addr(
-           }
- 
-         /* essentially, only fall through for a transient failure */
-+        // fall through
- 
-       /* socket not ready for writing after 5 timeout */
-       case EINVAL:    /* Invalid argument */
-diff --git a/src/resmom/checkpoint.c b/src/resmom/checkpoint.c
-index f178f48408..7e94b8b00a 100644
---- a/src/resmom/checkpoint.c
-+++ b/src/resmom/checkpoint.c
-@@ -51,6 +51,8 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <string>
-+#include <sstream>
- #include <unistd.h>
- #include <assert.h>
- #include <dirent.h>
-@@ -950,6 +952,7 @@ int blcr_checkpoint_job(
-   char             sid[20];
-   char            *arg[20];
-   char             buf[1024];
-+  std::string      err_msg;
-   int              len;
-   char           **ap;
-   FILE            *fs;
-@@ -1107,9 +1110,10 @@ int blcr_checkpoint_job(
- 
-     /* remove checkpoint directory that was created for this checkpoint attempt */
- 
--    sprintf(buf, "Checkpoint failed for job %s, removing checkpoint directory\n",
--        pjob->ji_qs.ji_jobid);
--    log_ext(-1, __func__, buf, LOG_DEBUG);
-+    err_msg = "Checkpoint failed for job ";
-+    err_msg += pjob->ji_qs.ji_jobid;
-+    err_msg += ", removing checkpoint directory\n";
-+    log_ext(-1, __func__, err_msg.c_str(), LOG_DEBUG);
- 
-     delete_blcr_checkpoint_files(pjob);
- 
-@@ -1123,9 +1127,12 @@ int blcr_checkpoint_job(
- 
-       if (err != 0)
-         {
--        sprintf(buf, "pbs_alterjob requested on job %s failed (%d-%s)\n",
--            pjob->ji_qs.ji_jobid, err, pbs_strerror(err));
--        log_err(-1, __func__, buf);
-+        std::ostringstream buf_s;
-+
-+        buf_s << "pbs_alterjob requested on job " << pjob->ji_qs.ji_jobid <<
-+          " failed (" << err << "-" << pbs_strerror(err) << ")\n";
-+        err_msg = buf_s.str();
-+        log_err(-1, __func__, err_msg.c_str());
-         if (err == PBSE_UNKJOBID)
-           {
-           /* TODO: GB - can the job exit while waiting for the checkpoint
-@@ -1190,9 +1197,12 @@ int blcr_checkpoint_job(
- 
-       if (err != 0)
-         {
--        sprintf(buf, "pbs_alterjob requested on job %s failed (%d-%s)\n",
--            pjob->ji_qs.ji_jobid, err, pbs_strerror(err));
--        log_err(-1, __func__, buf);
-+        std::ostringstream buf_s;
-+
-+        buf_s << "pbs_alterjob requested on job " << pjob->ji_qs.ji_jobid <<
-+          " failed (" << err << "-" << pbs_strerror(err) << ")\n";
-+        err_msg = buf_s.str();
-+        log_err(-1, __func__, err_msg.c_str());
-         if (err == PBSE_UNKJOBID)
-           {
-           /* TODO: GB - can the job exit while waiting for the checkpoint
-@@ -1527,6 +1537,8 @@ int start_checkpoint(
-   pid_t     pid;
-   int       rc = PBSE_NONE;
-   char      name_buffer[MAXPATHLEN + 1];
-+  std::ostringstream buf_s;
-+  std::string buf;
-   time_t    time_now;
- 
-   time_now = time((time_t *)0);
-@@ -1548,11 +1560,10 @@ int start_checkpoint(
-        * to the pbs_server until the checkpoint has completed successfully.
-        */
- 
--      sprintf(name_buffer,"ckpt.%s.%d",
--        pjob->ji_qs.ji_jobid,
--        (int)time_now);
-+      buf_s << "ckpt." << pjob->ji_qs.ji_jobid << "." << time_now;
-+      buf = buf_s.str();
- 
--      decode_str(&pjob->ji_wattr[JOB_ATR_checkpoint_name], NULL, NULL, name_buffer, 0);
-+      decode_str(&pjob->ji_wattr[JOB_ATR_checkpoint_name], NULL, NULL, buf.c_str(), 0);
- 
-       pjob->ji_wattr[JOB_ATR_checkpoint_name].at_flags =
-         ATR_VFLAG_SET | ATR_VFLAG_MODIFY;
-@@ -1760,8 +1771,8 @@ int blcr_restart_job(
-   int            pid;
-   char           sid[20];
-   char          *arg[20];
-+  std::string    err_msg;
-   extern char    restart_script_name[MAXPATHLEN + 1];
--  char           buf[1024];
-   char           namebuf[MAXPATHLEN + 1];
-   char           restartfile[MAXPATHLEN + 1];
-   char           script_buf[MAXPATHLEN + 1];
-@@ -1886,14 +1897,18 @@ int blcr_restart_job(
-     arg[6] = SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str);
-     arg[7] = NULL;
- 
--    snprintf(buf, sizeof(buf), "restart args: %s %s %s %s %s %s %s",
--      restart_script_name, sid, pjob->ji_qs.ji_jobid,
--      SET_ARG(pjob->ji_wattr[JOB_ATR_euser].at_val.at_str),
--      SET_ARG(pjob->ji_wattr[JOB_ATR_egroup].at_val.at_str),
--      namebuf,
--      SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str));
--
--    log_ext(-1, __func__, buf, LOG_DEBUG);
-+    err_msg = "restart args: ";
-+    err_msg += restart_script_name;
-+    err_msg += " ";
-+    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_euser].at_val.at_str);
-+    err_msg += " ";
-+    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_egroup].at_val.at_str);
-+    err_msg += " ";
-+    err_msg += namebuf;
-+    err_msg += " ";
-+    err_msg += SET_ARG(pjob->ji_wattr[JOB_ATR_checkpoint_name].at_val.at_str);
-+
-+    log_ext(-1, __func__, err_msg.c_str(), LOG_DEBUG);
- 
-     log_close(0);
- 
-diff --git a/src/resmom/generate_alps_status.c b/src/resmom/generate_alps_status.c
-index 305d603874..286d6b02ef 100644
---- a/src/resmom/generate_alps_status.c
-+++ b/src/resmom/generate_alps_status.c
-@@ -87,6 +87,7 @@
- #include "alps_constants.h"
- #include "alps_functions.h"
- #include <string>
-+#include <sstream>
- #include <vector>
- #include <set>
- #include <time.h>
-@@ -586,9 +587,9 @@ int process_node(
-     ani.features += features.c_str();
-     }
- 
--  char node_index_buf[MAXLINE];
--  snprintf(node_index_buf, sizeof(node_index_buf), "node_index=%lu", alps_nodes.size());
--  ani.node_index = node_index_buf;
-+  std::ostringstream ostr;
-+  ostr << "node_index=" << alps_nodes.size();
-+  ani.node_index = ostr.str();
- 
-   alps_nodes[nid] = ani;
- 
-diff --git a/src/resmom/linux/mom_mach.c b/src/resmom/linux/mom_mach.c
-index acaf81d467..8d8011a868 100644
---- a/src/resmom/linux/mom_mach.c
-+++ b/src/resmom/linux/mom_mach.c
-@@ -3,6 +3,7 @@
- #include "lib_mom.h" /* header */
- 
- #include <string>
-+#include <sstream>
- #include <vector>
- #include <assert.h>
- #include <limits.h>
-@@ -1221,6 +1222,7 @@ unsigned long cput_sum(
-   int          fd;
-   int          rc;
-   char         buf[LOCAL_BUF_SIZE];
-+  std::string  err_msg;
- 
-   pbs_attribute *pattr;
-   pattr = &pjob->ji_wattr[JOB_ATR_req_information];
-@@ -1234,8 +1236,11 @@ unsigned long cput_sum(
-     rc = cr->get_req_index_for_host(mom_alias, req_index);
-     if (rc != PBSE_NONE)
-       {
--      sprintf(buf, "Could not find req for host %s, job_id %s", mom_alias, pjob->ji_qs.ji_jobid);
--      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
-+      err_msg = "Could not find req for host ";
-+      err_msg += mom_alias;
-+      err_msg += ", job_id ";
-+      err_msg += pjob->ji_qs.ji_jobid;
-+      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, err_msg.c_str());
-       return(cputime);
-       }
- 
-@@ -1272,8 +1277,11 @@ unsigned long cput_sum(
-       {
-       if (pjob->ji_cgroups_created == true)
-         {
--        sprintf(buf, "failed to open %s: %s", full_cgroup_path.c_str(), strerror(errno));
--        log_err(-1, __func__, buf);
-+        err_msg = "failed to open ";
-+        err_msg += full_cgroup_path;
-+        err_msg += ": ";
-+        err_msg += strerror(errno);
-+        log_err(-1, __func__, err_msg.c_str());
-         }
-       return(0);
-       }
-@@ -1281,8 +1289,11 @@ unsigned long cput_sum(
-     rc = read(fd, buf, LOCAL_BUF_SIZE);
-     if (rc == -1)
-       {
--      sprintf(buf, "failed to read %s: %s", full_cgroup_path.c_str(), strerror(errno));
--      log_err(-1, __func__, buf);
-+      err_msg = "failed to read ";
-+      err_msg += full_cgroup_path;
-+      err_msg += ": ";
-+      err_msg += strerror(errno);
-+      log_err(-1, __func__, err_msg.c_str());
-       close(fd);
-       return(0);
-       }
-@@ -1567,6 +1578,7 @@ unsigned long long resi_sum(
-   char         buf[LOCAL_BUF_SIZE];
-   int          fd;
-   int          rc;
-+  std::string  err_msg;
- 
-   pbs_attribute *pattr;
-   pattr = &pjob->ji_wattr[JOB_ATR_req_information];
-@@ -1579,8 +1591,11 @@ unsigned long long resi_sum(
-     rc = cr->get_req_index_for_host(mom_alias, req_index);
-     if (rc != PBSE_NONE)
-       {
--      sprintf(buf, "Could not find req for host %s, job_id %s", mom_alias, pjob->ji_qs.ji_jobid);
--      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
-+      err_msg = "Could not find req for host ";
-+      err_msg += mom_alias;
-+      err_msg += ", job_id ";
-+      err_msg += pjob->ji_qs.ji_jobid;
-+      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, err_msg.c_str());
-       return(resisize);
-       }
- 
-@@ -1614,8 +1629,11 @@ unsigned long long resi_sum(
-     {
-     if (pjob->ji_cgroups_created == true)
-       {
--      sprintf(buf, "failed to open %s: %s", full_cgroup_path.c_str(), strerror(errno));
--      log_err(-1, __func__, buf);
-+      err_msg = "failed to open ";
-+      err_msg += full_cgroup_path;
-+      err_msg += ": ";
-+      err_msg += strerror(errno);
-+      log_err(-1, __func__, err_msg.c_str());
-       }
- 
-     return(0);
-@@ -1624,8 +1642,11 @@ unsigned long long resi_sum(
-   rc = read(fd, buf, LOCAL_BUF_SIZE);
-   if (rc == -1)
-     {
--    sprintf(buf, "failed to read %s: %s", full_cgroup_path.c_str(), strerror(errno));
--    log_err(-1, __func__, buf);
-+    err_msg = "failed to read ";
-+    err_msg += full_cgroup_path;
-+    err_msg += ": ";
-+    err_msg += strerror(errno);
-+    log_err(-1, __func__, err_msg.c_str());
-     close(fd);
-     return(0);
-     }
-@@ -1637,8 +1658,9 @@ unsigned long long resi_sum(
-     buf2 = strstr(buf, "\nrss ");
-     if (buf2 == NULL)
-       {
--      sprintf(buf, "read failed finding rss %s", full_cgroup_path.c_str());
--      log_err(errno, __func__, buf);
-+      err_msg = "read failed finding rss ";
-+      err_msg += full_cgroup_path;
-+      log_err(errno, __func__, err_msg.c_str());
-       close(fd);
-       return(0);
-       }
-@@ -4983,16 +5005,17 @@ void scan_non_child_tasks(void)
- 
-       if (!found)
-         {
--        char buf[MAXLINE];
-+        std::ostringstream sbuf;
-+        std::string buf;
- 
-         extern int exiting_tasks;
- 
--        sprintf(buf, "found exited session %d for task %d in job %s",
--            pTask->ti_qs.ti_sid,
--            pTask->ti_qs.ti_task,
--            pJob->ji_qs.ji_jobid);
-+        sbuf << "found exited session " << pTask->ti_qs.ti_sid <<
-+          " for task " << pTask->ti_qs.ti_task << " in job " <<
-+          pJob->ji_qs.ji_jobid;
-+        buf = sbuf.str();
- 
--        log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
-+        log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf.c_str());
- 
-         pTask->ti_qs.ti_exitstat = 0;  /* actually unknown */
-         pTask->ti_qs.ti_status = TI_STATE_EXITED;
-@@ -5006,10 +5029,11 @@ void scan_non_child_tasks(void)
- 
-           if (LOGLEVEL >= 7)
-             {
--            sprintf(buf, "marking job as MOM_JOB_RECOVERY for task %d",
--                pTask->ti_qs.ti_task);
-+            sbuf << "marking job as MOM_JOB_RECOVERY for task " <<
-+              pTask->ti_qs.ti_task);
-+            buf = sbuf.str();
- 
--            log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, pJob->ji_qs.ji_jobid, buf);
-+            log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, pJob->ji_qs.ji_jobid, buf.c_str());
-             }
-           }
- #endif    /* USESAVEDRESOURCES */
-@@ -5075,7 +5099,6 @@ const char *idletime(
-   DIR         *dp;
- 
-   struct dirent *de;
--  char          ttyname[50];
-   time_t         curtm;
- 
-   if (attrib)
-@@ -5104,16 +5127,18 @@ const char *idletime(
- 
-   while ((de = readdir(dp)) != NULL)
-     {
-+    std::string ttyname;
-+
-     if (maxtm >= curtm)
-       break;
- 
-     if (strncmp(de->d_name, "tty", 3))
-       continue;
- 
--    sprintf(ttyname, "/dev/%s",
--            de->d_name);
-+    ttyname = "/dev/";
-+    ttyname += de->d_name;
- 
--    setmax(ttyname);
-+    setmax(ttyname.c_str());
-     }
- 
-   closedir(dp);
-diff --git a/src/resmom/mom_main.c b/src/resmom/mom_main.c
-index 2d8453a15f..35896e58b1 100644
---- a/src/resmom/mom_main.c
-+++ b/src/resmom/mom_main.c
-@@ -1067,7 +1067,7 @@ char *conf_res(
-     goto done;
-     }
- 
--  name[i] = '\0';
-+  name[i] = NULL;
- 
-   for (d = ret_string, resline++;*resline;)
-     {
-@@ -6519,17 +6519,17 @@ void prepare_child_tasks_for_delete()
-     for (unsigned int i = 0; i < pJob->ji_tasks->size(); i++)
-       {
-       task *pTask = pJob->ji_tasks->at(i);
--
--      char buf[128];
-+      std::ostringstream sbuf;
-+      std::string buf;
- 
-       extern int exiting_tasks;
- 
--      sprintf(buf, "preparing exited session %d for task %d in job %s for deletion",
--              pTask->ti_qs.ti_sid,
--              pTask->ti_qs.ti_task,
--              pJob->ji_qs.ji_jobid);
-+      sbuf << "preparing exited session " << pTask->ti_qs.ti_sid <<
-+        " for task " << pTask->ti_qs.ti_task << " in job " <<
-+        pJob->ji_qs.ji_jobid << " for deletion";
-+      buf = sbuf.str();
- 
--      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf);
-+      log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, buf.c_str());
- 
-       pTask->ti_qs.ti_exitstat = 0;  /* actually unknown */
-       pTask->ti_qs.ti_status = TI_STATE_EXITED;
-diff --git a/src/resmom/mom_req_quejob.c b/src/resmom/mom_req_quejob.c
-index 2211f52d55..4e10581184 100644
---- a/src/resmom/mom_req_quejob.c
-+++ b/src/resmom/mom_req_quejob.c
-@@ -743,11 +743,15 @@ void req_mvjobfile(
- 
-   if (pj == NULL)
-     {
--    snprintf(log_buffer, 1024, "cannot find job %s for move of %s file",
--      preq->rq_ind.rq_jobfile.rq_jobid,
--      TJobFileType[jft]);
-+    std::string err_msg;
- 
--    log_err(-1, __func__, log_buffer);
-+    err_msg = "cannot find job ";
-+    err_msg += preq->rq_ind.rq_jobfile.rq_jobid;
-+    err_msg += " for move of ";
-+    err_msg += TJobFileType[jft];
-+    err_msg += " file";
-+
-+    log_err(-1, __func__, err_msg.c_str());
- 
-     req_reject(PBSE_UNKJOBID, 0, preq, NULL, NULL);
- 
-diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c
-index f90c2cd227..e03395225a 100644
---- a/src/resmom/mom_server.c
-+++ b/src/resmom/mom_server.c
-@@ -1900,7 +1900,6 @@ void mom_server_diag(
-   std::stringstream &output)
- 
-   {
--  char tmpLine[1024];
-   time_t Now;
- 
-   if (pms->pbs_servername[0] == '\0')
-@@ -1910,22 +1909,18 @@ void mom_server_diag(
- 
-   time(&Now);
- 
--  sprintf(tmpLine, "Server[%d]: %s (%s)\n",
--          sindex,
--          pms->pbs_servername,
--          netaddr(&(pms->sock_addr)));
--
--  output << tmpLine;
-+  output << "Server[" << sindex << "]: " << pms->pbs_servername <<
-+    " (" << netaddr(&(pms->sock_addr)) << ")\n";
- 
-   if (pms->MOMSendStatFailure[0] != '\0')
-     {
--    sprintf(tmpLine, "  WARNING:  could not open connection to server, %s%s\n",
--            pms->MOMSendStatFailure,
--            (strstr(pms->MOMSendStatFailure, "cname") != NULL) ?
--            " (check name resolution - /etc/hosts?)" :
--            "");
-+    output << "  WARNING:  could not open connection to server, " <<
-+      pms->MOMSendStatFailure;
-+
-+    if (strstr(pms->MOMSendStatFailure, "cname") != NULL)
-+      output << " (check name resolution - /etc/hosts?)";
- 
--    output << tmpLine;
-+    output << "\n";
-     }
- 
-   if (TMOMRejectConn[0] != '\0')
-@@ -1935,30 +1930,26 @@ void mom_server_diag(
- 
-   if (pms->MOMLastRecvFromServerTime > 0)
-     {
--    sprintf(tmpLine, "  Last Msg From Server:   %ld seconds (%s)\n",
--            (long)Now - pms->MOMLastRecvFromServerTime,
--            (pms->MOMLastRecvFromServerCmd[0] != '\0') ?
--            pms->MOMLastRecvFromServerCmd : "N/A");
-+    output << "  Last Msg From Server:   " <<
-+      ((long)Now - pms->MOMLastRecvFromServerTime) << " seconds (" <<
-+      ((pms->MOMLastRecvFromServerCmd[0] != '\0') ?
-+        pms->MOMLastRecvFromServerCmd : "N/A") << "\n";
-     }
-   else
-     {
--    sprintf(tmpLine, "  WARNING:  no messages received from server\n");
-+    output << "  WARNING:  no messages received from server\n";
-     }
- 
--  output << tmpLine;
--
-   if (pms->MOMLastSendToServerTime > 0)
-     {
--    sprintf(tmpLine, "  Last Msg To Server:     %ld seconds\n",
--            (long)Now - pms->MOMLastSendToServerTime);
-+    output << "  Last Msg To Server:     " <<
-+      ((long)Now - pms->MOMLastSendToServerTime) << " seconds\n";
-     }
-   else
-     {
--    sprintf(tmpLine, "  WARNING:  no messages sent to server\n");
-+    output << "  WARNING:  no messages sent to server\n";
-     }
- 
--  output << tmpLine;
--
-   return;
-   }  /* END mom_server_diag() */
- 
-diff --git a/src/resmom/parse_config.c b/src/resmom/parse_config.c
-index 8c4bb8585d..35efb7880e 100644
---- a/src/resmom/parse_config.c
-+++ b/src/resmom/parse_config.c
-@@ -2385,14 +2385,14 @@ void reset_config_vars()
-   mom_host[0] = '\0';
-   hostname_specified = 0;
-   MOMConfigRReconfig = 0;
--  TNoSpoolDirList[0] = '\0';
-+  TNoSpoolDirList[0] = NULL;
-   is_reporter_mom = FALSE;
-   is_login_node = FALSE;
-   job_exit_wait_time = DEFAULT_JOB_EXIT_WAIT_TIME;
-   jobstarter_exe_name[0] = '\0';
-   jobstarter_set = 0;
-   server_alias = NULL;
--  TRemChkptDirList[0] = '\0';
-+  TRemChkptDirList[0] = NULL;
-   tmpdir_basename[0] = '\0';  /* for $TMPDIR */
-   rcp_path[0] = '\0';
-   rcp_args[0] = '\0';
-diff --git a/src/resmom/requests.c b/src/resmom/requests.c
-index 588905e4e3..6fce46cdfb 100644
---- a/src/resmom/requests.c
-+++ b/src/resmom/requests.c
-@@ -1490,16 +1490,16 @@ void req_modifyjob(
-   int            rc;
-   unsigned int   momport = 0;
- 
--  char           tmpLine[1024];
-+  std::string    tmpLine;
- 
-   pjob = mom_find_job(preq->rq_ind.rq_modify.rq_objname);
- 
-   if (pjob == NULL)
-     {
--    sprintf(tmpLine, "modify job failed, unknown job %s",
--            preq->rq_ind.rq_modify.rq_objname);
-+    tmpLine = "modify job failed, unknown job ";
-+    tmpLine += preq->rq_ind.rq_modify.rq_objname;
- 
--    req_reject(PBSE_UNKJOBID, 0, preq, mom_host, tmpLine);
-+    req_reject(PBSE_UNKJOBID, 0, preq, mom_host, tmpLine.c_str());
- 
-     return;
-     }
-diff --git a/src/scheduler.cc/samples/fifo/dedtime.c b/src/scheduler.cc/samples/fifo/dedtime.c
-index b919ec8946..246bd4f8af 100644
---- a/src/scheduler.cc/samples/fifo/dedtime.c
-+++ b/src/scheduler.cc/samples/fifo/dedtime.c
-@@ -118,7 +118,7 @@ int parse_ded_file(const char *filename)
- 
-   i = 0;
- 
--  memset(conf.ded_time, 0, MAX_DEDTIME_SIZE);
-+  memset(conf.ded_time, 0, sizeof(struct timegap) * MAX_DEDTIME_SIZE);
- 
-   while (fgets(line, 256, fp) != NULL)
-     {
-diff --git a/src/server/array_func.c b/src/server/array_func.c
-index fabe4541fa..8f5caf0520 100644
---- a/src/server/array_func.c
-+++ b/src/server/array_func.c
-@@ -4,7 +4,7 @@
- 
-   included functions:
- 
--  is_array() determine if jobnum is actually an array identifyer
-+  is_id_array() determine if jobnum is actually an array identifyer
-   get_array() return array struct for given "parent id"
-   array_save() save array struct to disk
-   array_get_parent_id() return id of parent job if job belongs to a job array
-@@ -90,7 +90,7 @@ void        force_purge_work(job *pjob);
- 
- /* search job array list to determine if id is a job array */
- 
--int is_array(
-+int is_id_array(
-     
-   char *id)
- 
-@@ -154,7 +154,7 @@ int is_array(
-   allarrays.unlock();
- 
-   return(rc);
--  } /* END is_array() */
-+  } /* END is_id_array() */
- 
- 
- 
-diff --git a/src/server/array_func.h b/src/server/array_func.h
-index 6cb1b84c9c..70e3d326f7 100644
---- a/src/server/array_func.h
-+++ b/src/server/array_func.h
-@@ -8,7 +8,7 @@
- #include "batch_request.h" /* batch_request */
- 
- 
--int is_array(char *id);
-+int is_id_array(char *id);
- 
- int array_save(job_array *pa);
- 
-diff --git a/src/server/job_func.c b/src/server/job_func.c
-index dbc47de458..8922deab35 100644
---- a/src/server/job_func.c
-+++ b/src/server/job_func.c
-@@ -2387,22 +2387,36 @@ int fix_cray_exec_hosts(
- 
- 
- 
-+// change job id from x.y to x-0.y
- 
- int change_external_job_name(
- 
-   job *pjob)
- 
-   {
--  char  tmp_jobid[PBS_MAXSVRJOBID + 1];
--  char *dot = strchr(pjob->ji_qs.ji_jobid, '.');
-+  std::string jobid_new;
-+  size_t pos;
- 
--  if (dot != NULL)
--    *dot = '\0';
-+  // null job pointer
-+  if (pjob == NULL)
-+    return(-1);
- 
--  snprintf(tmp_jobid, sizeof(tmp_jobid), "%s-0.%s",
--    pjob->ji_qs.ji_jobid, dot + 1);
-+  // copy original job id
-+  jobid_new = pjob->ji_qs.ji_jobid;
-+
-+  // make sure job id has a .
-+  if ((pos = jobid_new.find('.', 0)) == std::string::npos)
-+    return(-1);
-+
-+  // change "." to "-0."
-+  jobid_new.replace(pos, 1, "-0.");
-+
-+  // confirm new string will fit
-+  if (jobid_new.length() > PBS_MAXSVRJOBID)
-+    return(-1);
- 
--  strcpy(pjob->ji_qs.ji_jobid, tmp_jobid);
-+  // update original
-+  strncpy(pjob->ji_qs.ji_jobid, jobid_new.c_str(), PBS_MAXSVRJOBID);
- 
-   return(PBSE_NONE);
-   } /* END change_external_job_name() */
-diff --git a/src/server/node_attr_def.c b/src/server/node_attr_def.c
-index 37aa121ca2..386f12b32d 100644
---- a/src/server/node_attr_def.c
-+++ b/src/server/node_attr_def.c
-@@ -380,7 +380,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -392,7 +392,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -404,7 +404,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -416,7 +416,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -428,7 +428,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -440,7 +440,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--    NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -452,7 +452,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--		NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-@@ -464,7 +464,7 @@ attribute_def node_attr_def[] =
- 	  set_l,
- 	  comp_null,
- 	  free_null,
--		NULL_FUNC,
-+          NULL_FUNC,
- 	  NO_USER_SET,
- 	  ATR_TYPE_LONG,
- 	  PARENT_TYPE_NODE,
-diff --git a/src/server/node_manager.c b/src/server/node_manager.c
-index 663b741da6..92c4d73f8a 100644
---- a/src/server/node_manager.c
-+++ b/src/server/node_manager.c
-@@ -924,9 +924,10 @@ void process_legacy_job_attribute_information(
-       {
-       char *attr_name = threadsafe_tokenizer(&attr_val, "=");
- 
--      if ((attr_name != NULL) &&
--          (attr_val != '\0'))
-+      if ((attr_name != NULL) && (*attr_name != '\0') &&
-+          (attr_val != NULL) && (*attr_val != '\0'))
-         {
-+        // convert attr_name, attr_val strings to an attribute
-         if (str_to_attr(attr_name, attr_val, pjob->ji_wattr, job_attr_def, JOB_ATR_LAST) == ATTR_NOT_FOUND)
-           {
-           // should be resources used if not found as attribute
-diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c
-index 0233800586..1a639ab2dc 100644
---- a/src/server/pbsd_init.c
-+++ b/src/server/pbsd_init.c
-@@ -2667,6 +2667,8 @@ int pbsd_init_job(
- 
-       svr_setjobstate(pjob, JOB_STATE_COMPLETE, JOB_SUBSTATE_COMPLETE, FALSE);
- 
-+      // fall through
-+
- 
-     case JOB_SUBSTATE_COMPLETE:
- 
-diff --git a/src/server/process_request.c b/src/server/process_request.c
-index e7f243f58e..ec1935cca4 100644
---- a/src/server/process_request.c
-+++ b/src/server/process_request.c
-@@ -795,7 +795,7 @@ int dispatch_request(
-        * req_deletejob() function.
-       */
- 
--      if (is_array(request->rq_ind.rq_delete.rq_objname))
-+      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
-         rc = req_deletearray(request);
-       else
-         rc = req_deletejob(request);
-@@ -803,7 +803,7 @@ int dispatch_request(
-       break;
- 
-     case PBS_BATCH_HoldJob:
--      if (is_array(request->rq_ind.rq_hold.rq_orig.rq_objname))
-+      if (is_id_array(request->rq_ind.rq_hold.rq_orig.rq_objname))
-         rc = req_holdarray(request);
-       else
-         rc = req_holdjob(request);
-@@ -843,7 +843,7 @@ int dispatch_request(
-     case PBS_BATCH_AsyModifyJob:
- 
-     case PBS_BATCH_ModifyJob:
--      if (is_array(request->rq_ind.rq_delete.rq_objname))
-+      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
-         rc = req_modifyarray(request);
-       else
-         req_modifyjob(request);
-@@ -888,7 +888,7 @@ int dispatch_request(
- 
-     case PBS_BATCH_ReleaseJob:
- 
--      if (is_array(request->rq_ind.rq_delete.rq_objname))
-+      if (is_id_array(request->rq_ind.rq_delete.rq_objname))
-         rc = req_releasearray(request);
-       else
-         rc = req_releasejob(request);
-@@ -972,7 +972,7 @@ int dispatch_request(
- 
-     case PBS_BATCH_RegistDep:
- 
--      if (is_array(request->rq_ind.rq_register.rq_parent))
-+      if (is_id_array(request->rq_ind.rq_register.rq_parent))
-         {
-         rc = req_registerarray(request);
-         }
-diff --git a/src/server/req_quejob.c b/src/server/req_quejob.c
-index e30acbb59d..5ce1ec3fdf 100644
---- a/src/server/req_quejob.c
-+++ b/src/server/req_quejob.c
-@@ -326,7 +326,7 @@ void sum_select_mem_request(
-       tmp = atoi(current);
-       
-       /* advance past the digits to the units */
--      while ((current != '\0') &&
-+      while ((*current != '\0') &&
-              (isdigit(*current)))
-         current++;
- 
-diff --git a/src/server/req_runjob.c b/src/server/req_runjob.c
-index 8b128b8dba..59dbe77b48 100644
---- a/src/server/req_runjob.c
-+++ b/src/server/req_runjob.c
-@@ -1676,8 +1676,14 @@ job *chk_job_torun(
- 
-   if ((pjob->ji_qs.ji_state != JOB_STATE_QUEUED) && (pjob->ji_qs.ji_state != JOB_STATE_HELD))
-     {
--    sprintf(EMsg, "job %s state %s", pjob->ji_qs.ji_jobid, PJobState[pjob->ji_qs.ji_state]);
--    req_reject(PBSE_BADSTATE, 0, preq, NULL, EMsg);
-+    std::string err_msg;
-+
-+    err_msg = "job ";
-+    err_msg += pjob->ji_qs.ji_jobid;
-+    err_msg += " state ";
-+    err_msg += PJobState[pjob->ji_qs.ji_state];
-+
-+    req_reject(PBSE_BADSTATE, 0, preq, NULL, err_msg.c_str());
-     return(NULL);
-     }
- 
-diff --git a/src/server/req_stat.c b/src/server/req_stat.c
-index 21a608aeee..392f22772e 100644
---- a/src/server/req_stat.c
-+++ b/src/server/req_stat.c
-@@ -241,7 +241,7 @@ int req_stat_job(
-     {
-     /* status a single job */
- 
--    if (is_array(name))
-+    if (is_id_array(name))
-       {
-       if (type != tjstSummarizeArraysServer)
-         {
-diff --git a/src/server/svr_chk_owner.c b/src/server/svr_chk_owner.c
-index 4b33c57226..b98135710e 100644
---- a/src/server/svr_chk_owner.c
-+++ b/src/server/svr_chk_owner.c
-@@ -413,9 +413,8 @@ int authenticate_user(
- 
-   {
-   int    rc;
--  char   uath[PBS_MAXUSER + PBS_MAXHOSTNAME + 1];
-   time_t time_now = time(NULL);
--  char   error_msg[1024];
-+  std::string error_msg;
-   long   acl_enabled = FALSE;
- 
- #ifdef MUNGE_AUTH
-@@ -437,9 +436,14 @@ int authenticate_user(
-     if ((acl_check_my_array_string(my_acl, uh, ACL_User_Host)) == 0)
-       {
-       *autherr = strdup("User not in authorized user list.");
--      sprintf(error_msg, "%s Requested user %s: requested from host %s",
--                     *autherr, preq->rq_user, preq->rq_host);
--      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
-+
-+      error_msg = *autherr;
-+      error_msg += " Requested user ";
-+      error_msg += preq->rq_user;
-+      error_msg += ": requested from host ";
-+      error_msg += preq->rq_host;
-+  
-+      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
-       return(PBSE_BADCRED);
-       }
-     }
-@@ -447,9 +451,16 @@ int authenticate_user(
-   if (strncmp(preq->rq_user, pcred->username, PBS_MAXUSER))
-     {
-     *autherr = strdup("Users do not match");
--    sprintf(error_msg, "%s: Requested user %s: credential user %s: requested from host %s",
--                   *autherr, preq->rq_user, pcred->username, preq->rq_host);
--    log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
-+
-+    error_msg = *autherr;
-+    error_msg += " Requested user ";
-+    error_msg += preq->rq_user;
-+    error_msg += ": credential user ";
-+    error_msg += pcred->username;
-+    error_msg += ": requested from host ";
-+    error_msg += preq->rq_host;
-+
-+    log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
-     return(PBSE_BADCRED);
-     }
- #endif
-@@ -481,10 +492,14 @@ int authenticate_user(
-         (memcmp(sai1, sai2, sizeof(struct sockaddr_in))))
-       {
-       *autherr = strdup("Hosts do not match");
--      
--      sprintf(error_msg, "%s: Requested host %s: credential host: %s",
--        *autherr, preq->rq_host, pcred->hostname);
--      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg);
-+     
-+      error_msg = *autherr; 
-+      error_msg += ": Requested host ";
-+      error_msg += preq->rq_host;
-+      error_msg += ": credential host: ";
-+      error_msg += pcred->hostname;
-+
-+      log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, error_msg.c_str());
-     
-       return(PBSE_BADCRED);
-       }
-@@ -520,10 +535,14 @@ int authenticate_user(
-   if (acl_enabled)
-     {
-     struct array_strings *acl_users = NULL;
--    snprintf(uath, sizeof(uath), "%s@%s", preq->rq_user, preq->rq_host);
-+    std::string uath;
-+
-+    uath = preq->rq_user;
-+    uath += "@";
-+    uath = preq->rq_host;
-     
-     get_svr_attr_arst(SRV_ATR_AclUsers, &acl_users);
--    if (acl_check_my_array_string(acl_users, uath, ACL_User) == 0)
-+    if (acl_check_my_array_string(acl_users, uath.c_str(), ACL_User) == 0)
-       {
-       int       my_err;
-       pbs_net_t connect_addr = get_hostaddr(&my_err, preq->rq_host);
-diff --git a/src/test/catch_child/scaffolding.c b/src/test/catch_child/scaffolding.c
-index 7db1077854..f08383d01e 100644
---- a/src/test/catch_child/scaffolding.c
-+++ b/src/test/catch_child/scaffolding.c
-@@ -1012,6 +1012,7 @@ int DIS_reply_read(struct tcp_chan *chan, struct batch_reply *preply)
-         {
-       case 1:
-           rc = 1;
-+          // fall through
-       case 2:
-           preply->brp_code = PBSE_NONE;
-           LOGLEVEL = 4;
-diff --git a/src/test/geteusernam/scaffolding.c b/src/test/geteusernam/scaffolding.c
-index ec849ab6df..f2cb83be16 100644
---- a/src/test/geteusernam/scaffolding.c
-+++ b/src/test/geteusernam/scaffolding.c
-@@ -64,7 +64,7 @@ void get_jobowner(char *from, char *to)
-   exit(1);
-   }
- 
--int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
-+int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
-   {
-   return(0);
-   }
-diff --git a/src/test/node_manager/test_uut.c b/src/test/node_manager/test_uut.c
-index 75c23b39af..b4aa98912f 100644
---- a/src/test/node_manager/test_uut.c
-+++ b/src/test/node_manager/test_uut.c
-@@ -284,12 +284,12 @@ END_TEST
- START_TEST(test_kill_job_on_mom)
-   {
-   struct pbsnode  pnode;
--  char            job_id[20];
-+  char            *job_id;
-   int             rc;
-   unsigned long   addr = 4567;
- 
-   memset(&pnode, 0, sizeof(pnode));
--  strcpy(job_id, "33.torque-devtest-03");
-+  job_id = strdup("33.torque-devtest-03");
- 
-   pnode.change_name("numa3.ac");
-   pnode.nd_mom_port = 1234;
-diff --git a/src/test/pbs_log/scaffolding.c b/src/test/pbs_log/scaffolding.c
-index fc5878c601..d63f053851 100644
---- a/src/test/pbs_log/scaffolding.c
-+++ b/src/test/pbs_log/scaffolding.c
-@@ -37,8 +37,7 @@ DIR *opendir(const char *name)
- 
- int closedir(DIR *dirp)
-   {
--  if (dirp != NULL)
--    free(dirp);
-+  free(dirp);
-   return(0);
-   }
- 
-diff --git a/src/test/pbsd_main/scaffolding.c b/src/test/pbsd_main/scaffolding.c
-index 90110e8fe8..0d7179a795 100644
---- a/src/test/pbsd_main/scaffolding.c
-+++ b/src/test/pbsd_main/scaffolding.c
-@@ -407,7 +407,7 @@ int get_svr_attr_arst(int index, struct array_strings **arst)
-   return(0);
-   }
- 
--int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
-+int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
-   {
-   return(0);
-   }
-diff --git a/src/test/process_alps_status/scaffolding.c b/src/test/process_alps_status/scaffolding.c
-index dd8ab2c577..3c6449aa70 100644
---- a/src/test/process_alps_status/scaffolding.c
-+++ b/src/test/process_alps_status/scaffolding.c
-@@ -713,6 +713,8 @@ int set_arst(
-       pas->as_next = pas->as_buf;
- 
-       /* no break, "SET" falls into "MERGE" to add strings */
-+      // fall through
-+
-     case INCR_OLD:
-     case MERGE:
- 
-diff --git a/src/test/process_request/scaffolding.c b/src/test/process_request/scaffolding.c
-index 66618f8900..36aff63746 100644
---- a/src/test/process_request/scaffolding.c
-+++ b/src/test/process_request/scaffolding.c
-@@ -373,9 +373,9 @@ int req_modify_node(struct batch_request *preq)
-   }
- 
- 
--int is_array(char *id)
-+int is_id_array(char *id)
-   {
--  fprintf(stderr, "The call to is_array needs to be mocked!!\n");
-+  fprintf(stderr, "The call to is_id_array needs to be mocked!!\n");
-   exit(1);
-   }
- 
-@@ -489,7 +489,7 @@ int get_svr_attr_b(int index, bool *b)
-   return(0);
-   }
- 
--int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
-+int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
-   {
-   return(0);
-   }
-diff --git a/src/test/req_stat/scaffolding.c b/src/test/req_stat/scaffolding.c
-index cbba4d809a..80f1956d61 100644
---- a/src/test/req_stat/scaffolding.c
-+++ b/src/test/req_stat/scaffolding.c
-@@ -221,9 +221,9 @@ int svr_connect(pbs_net_t hostaddr, unsigned int port, int *err, struct pbsnode
-   exit(1);
-   }
- 
--int is_array(char *id)
-+int is_id_array(char *id)
-   {
--  fprintf(stderr, "The call to is_array to be mocked!!\n");
-+  fprintf(stderr, "The call to is_id_array to be mocked!!\n");
-   exit(1);
-   }
- 
-diff --git a/src/test/svr_chk_owner/scaffolding.c b/src/test/svr_chk_owner/scaffolding.c
-index 6d00f6e381..59a8c84e95 100644
---- a/src/test/svr_chk_owner/scaffolding.c
-+++ b/src/test/svr_chk_owner/scaffolding.c
-@@ -79,7 +79,7 @@ int get_svr_attr_arst(int index, struct array_strings **arst)
-   return(0);
-   }
- 
--int acl_check_my_array_string(struct array_strings *pas, char *name, int type)
-+int acl_check_my_array_string(struct array_strings *pas, const char *name, int type)
-   {
-   return(0);
-   }
-diff --git a/torque.setup.in b/torque.setup.in
-index 15716c9b97..b0f2ee305f 100644
---- a/torque.setup.in
-+++ b/torque.setup.in
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- #
- # torque.setup - create pbs_server database and default queue
- # 
---- a/src/server/svr_jobfunc.c	2017-08-29 22:25:11.000000000 -0000
-+++ b/src/server/svr_jobfunc.c	2019-10-22 14:29:39.465723637 -0000
-@@ -4015,16 +4015,18 @@
- 
-   {
-   int rc = PBSE_NONE;
--  char *err_msg = NULL;
--  char stub_msg[] = "no pos";
-+  std::string err_msg;
- 
-   if (logging >= 10)
-     {
--    err_msg = (char *)calloc(1, MSG_LEN_LONG);
--    if (msg == NULL)
--      msg = stub_msg;
--    snprintf(err_msg, MSG_LEN_LONG, "locking %s in method %s-%s", pjob->ji_qs.ji_jobid, id, msg);
--    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+    err_msg = "locking ";
-+    err_msg += pjob->ji_qs.ji_jobid;
-+    err_msg += " in method ";
-+    err_msg += id;
-+    err_msg += "-";
-+    if (msg != NULL)
-+      err_msg += msg;
-+    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-     }
- 
-   if (pjob->ji_mutex != NULL)
-@@ -4033,9 +4035,11 @@
-       {
-       if (logging >= 20)
-         {
--        snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot lock job %s mutex in method %s",
--                                     pjob->ji_qs.ji_jobid, id);
--        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+        err_msg = "ALERT: cannot lock job ";
-+        err_msg += pjob->ji_qs.ji_jobid;
-+        err_msg += " mutex in method ";
-+        err_msg += id;
-+        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-         }
-       rc = PBSE_MUTEX;
-       }
-@@ -4046,9 +4050,6 @@
-     log_err(rc, __func__, "Uninitialized mutex pass to pthread_mutex_lock!");
-     }
- 
--  if (err_msg != NULL)
--  free(err_msg);
--
-   return rc;
-   }
- 
-@@ -4063,16 +4064,18 @@
- 
-   {
-   int rc = PBSE_NONE;
--  char *err_msg = NULL;
--  char stub_msg[] = "no pos";
-+  std::string err_msg;
- 
-   if (logging >= 10)
-     {
--    err_msg = (char *)calloc(1, MSG_LEN_LONG);
--    if (msg == NULL)
--      msg = stub_msg;
--    snprintf(err_msg, MSG_LEN_LONG, "unlocking %s in method %s-%s", pjob->ji_qs.ji_jobid, id, msg);
--    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+    err_msg = "unlocking ";
-+    err_msg += pjob->ji_qs.ji_jobid;
-+    err_msg += " in method ";
-+    err_msg += id;
-+    err_msg += "-";
-+    if (msg != NULL)
-+      err_msg += msg;
-+    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-     }
- 
-   if (pjob->ji_mutex != NULL)
-@@ -4081,9 +4084,11 @@
-       {
-     if (logging >= 20)
-         {
--        snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot unlock job %s mutex in method %s",
--                                            pjob->ji_qs.ji_jobid, id);
--        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+        err_msg = "ALERT: cannot unlock job ";
-+        err_msg += pjob->ji_qs.ji_jobid;
-+        err_msg += " mutex in method ";
-+        err_msg += id;
-+        log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-         }
-       rc = PBSE_MUTEX;
-       }
-@@ -4094,9 +4099,6 @@
-     log_err(rc, __func__, "Uninitialized mutex pass to pthread_mutex_unlock!");
-     }
- 
--   if (err_msg != NULL)
--     free(err_msg);
--
-    return rc;
-    }
- 
-@@ -4110,32 +4112,33 @@
- 
-   {
-   int rc = PBSE_NONE;
--  char *err_msg = NULL;
--  char stub_msg[] = "no pos";
-+  std::string err_msg;
- 
-   if (logging >= 10)
-     {
--    err_msg = (char *)calloc(1, MSG_LEN_LONG);
--    if (msg == NULL)
--      msg = stub_msg;
--    snprintf(err_msg, MSG_LEN_LONG, "locking %s in method %s-%s", pa->ai_qs.parent_id, id, msg);
--    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+    err_msg = "locking ";
-+    err_msg += pa->ai_qs.parent_id,
-+    err_msg += " in method ";
-+    err_msg += id;
-+    err_msg += "-";
-+    if (msg != NULL)
-+      err_msg += msg;
-+    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-     }
- 
-   if (pthread_mutex_lock(pa->ai_mutex) != 0)
-     {
-     if (logging >= 20)
-       {
--      snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot lock job array %s mutex in method %s",
--                                   pa->ai_qs.parent_id, id);
--      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+      err_msg = "ALERT: cannot lock job array ";
-+      err_msg += pa->ai_qs.parent_id,
-+      err_msg += " mutex in method ";
-+      err_msg += id;
-+      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-       }
-     rc = PBSE_MUTEX;
-     }
- 
--  if (err_msg != NULL)
--  free(err_msg);
--
-   return rc;
-   }
- 
-@@ -4149,32 +4152,33 @@
- 
-   {
-   int rc = PBSE_NONE;
--  char *err_msg = NULL;
--  char stub_msg[] = "no pos";
-+  std::string err_msg;
- 
-   if (logging >= 10)
-     {
--    err_msg = (char *)calloc(1, MSG_LEN_LONG);
--    if (msg == NULL)
--      msg = stub_msg;
--    snprintf(err_msg, MSG_LEN_LONG, "unlocking %s in method %s-%s", pa->ai_qs.parent_id, id, msg);
--    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+    err_msg = "unlocking ";
-+    err_msg += pa->ai_qs.parent_id,
-+    err_msg += " in method ";
-+    err_msg += id;
-+    err_msg += "-";
-+    if (msg != NULL)
-+      err_msg += msg;
-+    log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-     }
- 
-   if (pthread_mutex_unlock(pa->ai_mutex) != 0)
-     {
-     if (logging >= 20)
-       {
--      snprintf(err_msg, MSG_LEN_LONG, "ALERT: cannot unlock job array %s mutex in method %s",
--                                   pa->ai_qs.parent_id, id);
--      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg);
-+      err_msg = "ALERT: cannot unlock job array ";
-+      err_msg += pa->ai_qs.parent_id,
-+      err_msg += " mutex in method ";
-+      err_msg += id;
-+      log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, id, err_msg.c_str());
-       }
-     rc = PBSE_MUTEX;
-     }
- 
--  if (err_msg != NULL)
--  free(err_msg);
--
-   return rc;
-   }
- 

diff --git a/sys-cluster/torque/torque-6.0.4-r1.ebuild b/sys-cluster/torque/torque-6.0.4-r1.ebuild
index 6f18c025266..b551a3e0669 100644
--- a/sys-cluster/torque/torque-6.0.4-r1.ebuild
+++ b/sys-cluster/torque/torque-6.0.4-r1.ebuild
@@ -7,7 +7,8 @@ inherit autotools flag-o-matic linux-info
 
 DESCRIPTION="Resource manager and queuing system based on OpenPBS"
 HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque"
-SRC_URI="https://github.com/adaptivecomputing/torque/archive/6a0b37f85c7d644e9217cbab1542792d646f59a6.tar.gz -> ${P}-gh-20170829.tar.gz"
+SRC_URI="https://github.com/adaptivecomputing/torque/archive/6a0b37f85c7d644e9217cbab1542792d646f59a6.tar.gz -> ${P}-gh-20170829.tar.gz
+	https://dev.gentoo.org/~juippis/distfiles/tmp/torque-6.0.4-gcc7.patch"
 
 LICENSE="torque-2.5"
 SLOT="0"
@@ -47,7 +48,7 @@ RDEPEND="${DEPEND_COMMON}
 S="${WORKDIR}"/${PN}-6a0b37f85c7d644e9217cbab1542792d646f59a6
 
 PATCHES=(
-	"${FILESDIR}"/${P}-gcc7.patch
+	"${DISTDIR}"/${P}-gcc7.patch
 	"${FILESDIR}"/${PN}-6.0.3-fix-emptystring-comparison.patch
 	"${FILESDIR}"/${P}-no-openssl.patch
 	"${FILESDIR}"/${P}-error_buf_overflow_prevent.patch


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/
@ 2023-05-13  4:52 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2023-05-13  4:52 UTC (permalink / raw
  To: gentoo-commits

commit:     62953bb7ceec7d12e7fcf295b39c174b14dd8bf9
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Fri May 12 21:04:26 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 13 04:51:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62953bb7

sys-cluster/torque: Fix register storage class specifier not allowed

Closes: https://bugs.gentoo.org/898574
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/31009
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ..._timeout-has-a-different-language-linkage.patch |  19 +
 ...ster-storage-class-as-it-s-been-deprecate.patch | 740 +++++++++++++++++++++
 sys-cluster/torque/torque-6.0.4-r6.ebuild          | 202 ++++++
 3 files changed, 961 insertions(+)

diff --git a/sys-cluster/torque/files/torque-6.0.4-fix-pbs_tcp_timeout-has-a-different-language-linkage.patch b/sys-cluster/torque/files/torque-6.0.4-fix-pbs_tcp_timeout-has-a-different-language-linkage.patch
new file mode 100644
index 000000000000..7fda492e86fb
--- /dev/null
+++ b/sys-cluster/torque/files/torque-6.0.4-fix-pbs_tcp_timeout-has-a-different-language-linkage.patch
@@ -0,0 +1,19 @@
+From 6019c52444309dc2fdc61c5340c9458aeff6dced Mon Sep 17 00:00:00 2001
+From: Brahmajit Das <brahmajit.xyz@gmail.com>
+Date: Sat, 13 May 2023 02:11:24 +0530
+Subject: [PATCH] Fix pbs_tcp_timeout has a different language linkage
+
+Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
+--- a/src/include/tcp.h
++++ b/src/include/tcp.h
+@@ -38,6 +38,6 @@ int tcp_wcommit(struct tcp_chan *chan, int);
+ int tcp_rskip(struct tcp_chan *chan,size_t);
+ int tcp_chan_has_data(struct tcp_chan *chan);
+ 
+-extern time_t pbs_tcp_timeout;
++extern "C" time_t pbs_tcp_timeout;
+ 
+ #endif /* TCP_PBS_H */
+-- 
+2.40.1
+

diff --git a/sys-cluster/torque/files/torque-6.0.4-remove-register-storage-class-as-it-s-been-deprecate.patch b/sys-cluster/torque/files/torque-6.0.4-remove-register-storage-class-as-it-s-been-deprecate.patch
new file mode 100644
index 000000000000..64fc80c01f2e
--- /dev/null
+++ b/sys-cluster/torque/files/torque-6.0.4-remove-register-storage-class-as-it-s-been-deprecate.patch
@@ -0,0 +1,740 @@
+From 9bd19c7101d0db6910747fc75c9bd1f8a54419c3 Mon Sep 17 00:00:00 2001
+From: Brahmajit Das <brahmajit.xyz@gmail.com>
+Date: Sat, 13 May 2023 02:06:35 +0530
+Subject: [PATCH] Remove register storage class as it's been deprecated since
+ c++17
+
+Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
+Bug: https://bugs.gentoo.org/898574
+--- a/src/lib/Libattr/attr_func.c
++++ b/src/lib/Libattr/attr_func.c
+@@ -310,7 +310,7 @@ svrattrl *attrlist_alloc(
+   int szval)   /* I */
+ 
+   {
+-  register size_t  tsize;
++  size_t  tsize;
+   svrattrl        *pal;
+ 
+   /* alloc memory block <SVRATTRL><NAME><RESC><VAL> */
+--- a/src/resmom/aix4/mom_mach.c
++++ b/src/resmom/aix4/mom_mach.c
+@@ -642,7 +642,7 @@ cput_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -697,7 +697,7 @@ mem_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -760,7 +760,7 @@ overmem_proc(job *pjob, unsigned long limit)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1192,7 +1192,7 @@ static unsigned long nodes_ses(
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1631,7 +1631,7 @@ kill_task(task *ptask, int sig, int pg)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1758,7 +1758,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1819,7 +1819,7 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1919,7 +1919,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1966,7 +1966,7 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2227,7 +2227,7 @@ sessions(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2342,7 +2342,7 @@ pids(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2403,7 +2403,7 @@ nusers(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+--- a/src/resmom/aix5/mom_mach.c
++++ b/src/resmom/aix5/mom_mach.c
+@@ -646,7 +646,7 @@ cput_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -701,7 +701,7 @@ mem_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -764,7 +764,7 @@ overmem_proc(job *pjob, unsigned long limit)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1190,7 +1190,7 @@ nodes_ses(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1601,7 +1601,7 @@ kill_task(task *ptask, int sig, int pg)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1728,7 +1728,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1789,7 +1789,7 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1889,7 +1889,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -1936,7 +1936,7 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2191,7 +2191,7 @@ sessions(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2306,7 +2306,7 @@ pids(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+@@ -2367,7 +2367,7 @@ nusers(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct procsinfo *pp = &proc_tbl[i];
++    struct procsinfo *pp = &proc_tbl[i];
+ 
+     if (pp->pi_state == SNONE)
+       continue;
+--- a/src/resmom/cygwin/mom_mach.c
++++ b/src/resmom/cygwin/mom_mach.c
+@@ -2771,7 +2771,7 @@ char *sessions(
+   int            njids = 0;
+   pid_t         *jids, *hold;
+   static int     maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib != NULL)
+     {
+@@ -3022,7 +3022,7 @@ char *nusers(
+   int  nuids = 0;
+   uid_t  *uids, *hold;
+   static int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib != NULL)
+     {
+--- a/src/resmom/digitalunix/mom_mach.c
++++ b/src/resmom/digitalunix/mom_mach.c
+@@ -1526,7 +1526,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1717,7 +1717,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/fujitsu/mom_mach.c
++++ b/src/resmom/fujitsu/mom_mach.c
+@@ -1560,7 +1560,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1751,7 +1751,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/hpux10/mom_mach.c
++++ b/src/resmom/hpux10/mom_mach.c
+@@ -1432,7 +1432,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1625,7 +1625,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/hpux11/mom_mach.c
++++ b/src/resmom/hpux11/mom_mach.c
+@@ -1512,7 +1512,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1705,7 +1705,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/irix5/mom_mach.c
++++ b/src/resmom/irix5/mom_mach.c
+@@ -1679,7 +1679,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1894,7 +1894,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/irix6/mom_mach.c
++++ b/src/resmom/irix6/mom_mach.c
+@@ -1923,7 +1923,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -2114,7 +2114,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/linux/mom_mach.c
++++ b/src/resmom/linux/mom_mach.c
+@@ -4250,7 +4250,7 @@ const char *nusers(
+   int                nuids = 0;
+   uid_t             *uids, *hold;
+   static int         maxuid = 200;
+-  register uid_t     uid;
++  uid_t     uid;
+ #ifdef NUMA_SUPPORT
+   char               mom_check_name[PBS_MAXSERVERNAME], *s;
+   job               *pjob;
+--- a/src/resmom/mom_server.c
++++ b/src/resmom/mom_server.c
+@@ -1811,11 +1811,11 @@ void mom_server_all_update_stat(void)
+ 
+ long power(
+ 
+-  register int x,
+-  register int n)
++  int x,
++  int n)
+ 
+   {
+-  register long p;
++  long p;
+ 
+   for (p = 1;n > 0;--n)
+     {
+--- a/src/resmom/mom_server_lib.h
++++ b/src/resmom/mom_server_lib.h
+@@ -86,7 +86,7 @@ int send_update();
+ 
+ void mom_server_all_update_stat(void);
+ 
+-long power(register int x, register int n);
++long power(int x, int n);
+ 
+ int calculate_retry_seconds(int count);
+ 
+--- a/src/resmom/solaris5/mom_mach.c
++++ b/src/resmom/solaris5/mom_mach.c
+@@ -1534,7 +1534,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1725,7 +1725,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/solaris7/mom_mach.c
++++ b/src/resmom/solaris7/mom_mach.c
+@@ -1623,7 +1623,7 @@ sessions(struct rm_attribute *attrib)
+   int   njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 200;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -1814,7 +1814,7 @@ nusers(struct rm_attribute *attrib)
+   int   nuids = 0;
+   uid_t   *uids, *hold;
+   static  int maxuid = 200;
+-  register uid_t uid;
++  uid_t uid;
+ 
+   if (attrib)
+     {
+--- a/src/resmom/sunos4/mom_mach.c
++++ b/src/resmom/sunos4/mom_mach.c
+@@ -384,7 +384,7 @@ cput_sum(job *pjob)
+   char   *id = "cput_sum";
+   int   i;
+ 
+-  register struct user *uarea;
++  struct user *uarea;
+   unsigned long  cputime;
+   int   nps = 0;
+ 
+@@ -393,7 +393,7 @@ cput_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -461,7 +461,7 @@ mem_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -493,7 +493,7 @@ resi_sum(job *pjob)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -522,7 +522,7 @@ overmem_proc(job *pjob, unsigned long limit)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1270,7 +1270,7 @@ pid_t jobid;
+   double   ses_time;
+   int   i;
+ 
+-  register struct user *uarea;
++  struct user *uarea;
+   unsigned long  cputime;
+ 
+   if (getprocs() == 0)
+@@ -1284,7 +1284,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1335,9 +1335,9 @@ pid_t pid;
+   {
+   char   *id = "cput_proc";
+ 
+-  register struct proc *pp;
++  struct proc *pp;
+ 
+-  register struct user *uarea;
++  struct user *uarea;
+   uint   cputime;
+ 
+   if (kd == NULL)
+@@ -1438,7 +1438,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1470,7 +1470,7 @@ pid_t pid;
+   {
+   char   *id = "mem_proc";
+ 
+-  register struct proc *pp;
++  struct proc *pp;
+   int   memsize;
+ 
+   if (kd == NULL)
+@@ -1553,7 +1553,7 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1583,7 +1583,7 @@ pid_t pid;
+   {
+   char   *id = "resi_proc";
+ 
+-  register struct proc *pp;
++  struct proc *pp;
+ 
+   if (kd == NULL)
+     {
+@@ -1679,7 +1679,7 @@ sessions(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1791,7 +1791,7 @@ pids(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -1850,7 +1850,7 @@ nusers(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2160,7 +2160,7 @@ walltime(struct rm_attribute *attrib)
+   {
+   char   *id = "walltime";
+ 
+-  register struct user *uarea;
++  struct user *uarea;
+   pid_t   value;
+   int   i, job, found = 0;
+   time_t   now, start;
+@@ -2215,7 +2215,7 @@ walltime(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc *pp = &proc_tbl[i];
++    struct proc *pp = &proc_tbl[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+--- a/src/resmom/unicos8/mom_mach.c
++++ b/src/resmom/unicos8/mom_mach.c
+@@ -263,7 +263,7 @@ var_init(void)
+ void
+ var_cleanup(void)
+   {
+-  register i;
++  int i;
+ 
+   if (v_name == NULL)
+     return;
+@@ -280,7 +280,7 @@ var_cleanup(void)
+ char *
+ var_value(char *name)
+   {
+-  register i;
++  int i;
+ 
+   for (i = 0; v_name[i]; i++)
+     {
+@@ -2382,9 +2382,9 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+-    register struct pcomm *pc;
++    struct pcomm *pc;
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2437,9 +2437,9 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+-    register struct pcomm *pc;
++    struct pcomm *pc;
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2528,9 +2528,9 @@ pid_t jobid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+-    register struct pcomm *pc;
++    struct pcomm *pc;
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2576,9 +2576,9 @@ pid_t pid;
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+-    register struct pcomm *pc;
++    struct pcomm *pc;
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2646,7 +2646,7 @@ sessions(struct rm_attribute *attrib)
+   int   i, j, nproc, njids = 0;
+   pid_t   *jids, *hold;
+   static  int maxjid = 300;
+-  register pid_t jobid;
++  pid_t jobid;
+ 
+   if (attrib)
+     {
+@@ -2674,7 +2674,7 @@ sessions(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2790,7 +2790,7 @@ nusers(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+@@ -2872,7 +2872,7 @@ pids(struct rm_attribute *attrib)
+   for (i = 0; i < nproc; i++)
+     {
+ 
+-    register struct proc    *pp = &process_table[i];
++    struct proc    *pp = &process_table[i];
+ 
+     if (pp->p_stat == 0)
+       continue;
+--- a/src/server/node_manager.c
++++ b/src/server/node_manager.c
+@@ -5433,10 +5433,10 @@ int node_avail(
+   char           *pc;
+ 
+   struct prop    *prop = NULL;
+-  register int    xavail;
+-  register int    xalloc;
+-  register int    xresvd;
+-  register int    xdown;
++  int    xavail;
++  int    xalloc;
++  int    xresvd;
++  int    xdown;
+   int             node_req = 1;
+   int             gpu_req = 0;
+   int             mic_req = 0;
+-- 
+2.40.1
+

diff --git a/sys-cluster/torque/torque-6.0.4-r6.ebuild b/sys-cluster/torque/torque-6.0.4-r6.ebuild
new file mode 100644
index 000000000000..3e838b63737d
--- /dev/null
+++ b/sys-cluster/torque/torque-6.0.4-r6.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_COMMIT="6a0b37f85c7d644e9217cbab1542792d646f59a6"
+inherit autotools flag-o-matic linux-info toolchain-funcs
+
+DESCRIPTION="Resource manager and queuing system based on OpenPBS"
+HOMEPAGE="https://adaptivecomputing.com/cherry-services/torque-resource-manager/ https://github.com/adaptivecomputing/torque/"
+SRC_URI="
+	https://github.com/adaptivecomputing/torque/archive/${MY_COMMIT}.tar.gz -> ${P}-gh-20170829.tar.gz
+	https://dev.gentoo.org/~juippis/distfiles/tmp/torque-6.0.4-gcc7.patch
+	https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-glibc-2.34-pthread.patch.bz2
+"
+
+LICENSE="torque-2.5"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="autorun cgroups cpusets +crypt doc munge nvidia quickcommit server +syslog tk"
+
+DEPEND_COMMON="
+	sys-libs/zlib
+	sys-libs/readline:0=
+	dev-libs/libxml2
+	dev-libs/boost
+	cpusets? ( sys-apps/hwloc:= )
+	munge? ( sys-auth/munge )
+	nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+	tk? (
+		dev-lang/tk:0=
+		dev-lang/tcl:0=
+	)
+	syslog? ( virtual/logger )
+	!!games-util/qstat
+"
+
+# libncurses.so is only needed for configure check on readline
+DEPEND="
+	${DEPEND_COMMON}
+	sys-libs/ncurses:*
+	!!sys-cluster/slurm
+"
+
+RDEPEND="
+	${DEPEND_COMMON}
+	crypt? ( virtual/openssh )
+	!crypt? ( net-misc/netkit-rsh )
+	!dev-libs/uthash
+"
+
+# Torque should depend on dev-libs/uthash but that's pretty much impossible
+# to patch in as they ship with a broken configure such that files referenced
+# by the configure.ac and Makefile.am are missing.
+# http://www.supercluster.org/pipermail/torquedev/2014-October/004773.html
+
+S="${WORKDIR}"/${PN}-6a0b37f85c7d644e9217cbab1542792d646f59a6
+
+PATCHES=(
+	"${DISTDIR}"/${P}-gcc7.patch
+	"${FILESDIR}"/${PN}-6.0.3-fix-emptystring-comparison.patch
+	"${FILESDIR}"/${P}-no-openssl.patch
+	"${FILESDIR}"/${P}-error_buf_overflow_prevent.patch
+	"${WORKDIR}"/${P}-glibc-2.34-pthread.patch
+	"${FILESDIR}"/${P}-pthreads-deux.patch
+	"${FILESDIR}"/${P}-remove-register-storage-class-as-it-s-been-deprecate.patch
+	"${FILESDIR}"/${P}-fix-pbs_tcp_timeout-has-a-different-language-linkage.patch
+)
+
+pkg_setup() {
+	PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/${PN}}"
+
+	# Find a Torque server to use.  Check environment, then
+	# current setup (if any), and fall back on current hostname.
+	if [[ -z "${PBS_SERVER_NAME}" ]]; then
+		if [ -f "${EROOT}/${PBS_SERVER_HOME}/server_name" ]; then
+			PBS_SERVER_NAME="$(<${EROOT}/${PBS_SERVER_HOME}/server_name)"
+		else
+			PBS_SERVER_NAME=$(hostname -f)
+		fi
+	fi
+
+	if use cpusets || use cgroups; then
+		if ! use kernel_linux; then
+			einfo
+			elog "    Torque currently only has support for cpusets and cgroups in linux."
+			elog "Assuming you didn't really want this USE flag and ignoring its state."
+			einfo
+		else
+			linux-info_pkg_setup
+			if ! linux_config_exists || ! linux_chkconfig_present CPUSETS; then
+				einfo
+				elog "    Torque support for cpusets will require that you recompile"
+				elog "your kernel with CONFIG_CPUSETS enabled."
+				einfo
+			fi
+		fi
+	fi
+}
+
+src_prepare() {
+	default
+	# We install to a valid location, no need to muck with ld.so.conf
+	# --without-loadlibfile is supposed to do this for us...
+	sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die
+	eautoreconf
+}
+
+src_configure() {
+	append-cflags "-fpermissive"
+
+	# Force Bash for configure as there's a lot of issues with configure.ac and such here
+	CONFIG_SHELL="${BROOT}/bin/bash" econf \
+		$(use_enable tk gui) \
+		$(use_enable tk tcl-qstat) \
+		$(use_enable syslog) \
+		$(use_enable server) \
+		--disable-drmaa \
+		$(use_enable munge munge-auth) \
+		$(use_enable nvidia nvidia-gpus) \
+		$(usex crypt "--with-rcp=scp" "--with-rcp=mom_rcp") \
+		$(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+		$(usex kernel_linux $(use_enable cgroups) --disable-cgroups) \
+		$(use_enable autorun) \
+		$(use_enable quickcommit) \
+		--with-server-home=${PBS_SERVER_HOME} \
+		--with-environ=/etc/pbs_environment \
+		--with-default-server=${PBS_SERVER_NAME} \
+		--disable-gcc-warnings \
+		--disable-silent-rules \
+		--with-tcp-retry-limit=2 \
+		--without-loadlibfile
+}
+
+src_compile() {
+	# The .c files are C++, and $(CC) is misused.
+	emake CC="$(tc-getCXX)"
+}
+
+src_install() {
+	local dir
+
+	DOCS=( CHANGELOG README.* Release_Notes )
+	use doc && DOCS+=( doc/admin_guide.ps doc/*.pdf )
+
+	default
+
+	# The build script isn't alternative install location friendly,
+	# So we have to fix some hard-coded paths in tclIndex for xpbs* to work
+	for file in $(find "${ED}" -iname tclIndex); do
+		sed \
+			-e "s/${ED//\// }/ /" \
+			-i "${file}" || die
+	done
+
+	for dir in $(find "${ED}/${PBS_SERVER_HOME}" -type d); do
+		keepdir "${dir#${ED}}"
+	done
+
+	if use server; then
+		newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server
+		newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched
+	fi
+
+	newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom
+	newconfd "${FILESDIR}"/${PN}-conf.d-munge ${PN}
+	newinitd "${FILESDIR}"/trqauthd-init.d trqauthd
+	newenvd "${FILESDIR}"/${PN}-env.d 25${PN}
+
+	find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_preinst() {
+	if [[ -f "${EROOT}/etc/pbs_environment" ]]; then
+		cp "${EROOT}/etc/pbs_environment" "${ED}"/etc/pbs_environment || die
+	fi
+
+	if use server && [[ -f "${EROOT}/${PBS_SERVER_HOME}/server_priv/nodes" ]]; then
+		cp \
+			"${EROOT}/${PBS_SERVER_HOME}/server_priv/nodes" \
+			"${ED}/${PBS_SERVER_HOME}/server_priv/nodes" || die
+	fi
+
+	echo "${PBS_SERVER_NAME}" > "${ED}${PBS_SERVER_HOME}/server_name" || die
+
+	# Fix up the env.d file to use our set server home.
+	sed \
+		-e "s:/var/spool/${PN}:${PBS_SERVER_HOME}:g" \
+		-i "${ED}"/etc/env.d/25${PN} || die
+
+	if use munge; then
+		sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${ED}"/etc/conf.d/${PN} || die
+	fi
+}
+
+pkg_postinst() {
+	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+		elog "If this is the first time torque has been installed, then you are not"
+		elog "ready to start the server.  Please refer to the documentation located at:"
+		elog "http://docs.adaptivecomputing.com/torque/${PV//./-}/adminGuide/torquehelp.htm#topics/torque/1-installConfig/initializeConfigOnServer.htm"
+	fi
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-13  4:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-22 17:06 [gentoo-commits] repo/gentoo:master commit in: sys-cluster/torque/, sys-cluster/torque/files/ Ian Stakenvicius
  -- strict thread matches above, loose matches on Subject: below --
2023-05-13  4:52 Sam James
2020-11-15 15:31 Joonas Niilola
2017-11-21 19:31 Ian Stakenvicius
2017-05-24 14:35 Ian Stakenvicius

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox