From a07ad6f6cd503b2bae328e5d3b0f1772e8463de0 Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Sun, 10 Mar 2024 20:49:22 +0100 Subject: [PATCH] Handle 64 bit time_t on 32 bit systems --- gram/jobmanager/lrms/lsf/source/configure.ac | 40 +++++++------- .../lrms/lsf/source/seg/seg_lsf_module.c | 53 ++++++++++--------- .../debian/changelog.in | 6 +++ .../fedora/globus-gram-job-manager-lsf.spec | 7 ++- 4 files changed, 60 insertions(+), 46 deletions(-) diff --git a/gram/jobmanager/lrms/lsf/source/configure.ac b/gram/jobmanager/lrms/lsf/source/configure.ac index b44ce7b211..3845f72f03 100644 --- a/gram/jobmanager/lrms/lsf/source/configure.ac +++ b/gram/jobmanager/lrms/lsf/source/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.60]) -AC_INIT([globus_gram_job_manager_lsf],[3.0],[https://github.com/gridcf/gct/issues]) +AC_INIT([globus_gram_job_manager_lsf],[3.1],[https://github.com/gridcf/gct/issues]) AC_CONFIG_MACRO_DIR([m4]) AC_SUBST([MAJOR_VERSION], [${PACKAGE_VERSION%%.*}]) AC_SUBST([MINOR_VERSION], [${PACKAGE_VERSION##*.}]) @@ -29,11 +29,11 @@ fi AC_ARG_WITH([lsf-profile], AC_HELP_STRING( - [--with-lsf-profile=FILE], + [--with-lsf-profile=FILE], [Use LSF profile located at PATH ${LSF_ENVDIR:-/etc}/profile.lsf]), - [LSF_PROFILE=$withval], - [LSF_PROFILE="${LSF_ENVDIR:-/etc}/profile.lsf" - AC_MSG_WARN([Using default lsf profile of $LSF_PROFILE])]) + [LSF_PROFILE=$withval], + [LSF_PROFILE="${LSF_ENVDIR:-/etc}/profile.lsf" + AC_MSG_WARN([Using default lsf profile of $LSF_PROFILE])]) AC_SUBST(LSF_PROFILE) @@ -88,11 +88,11 @@ AC_ARG_WITH(log-path, AC_SUBST(LSF_LOG_PATH) AC_ARG_WITH(globus-state-dir, - AC_HELP_STRING( - [--with-globus-state-dir=PATH], - [Path to Globus state files]), - globusstatedir="$withval", - globusstatedir=$localstatedir) + AC_HELP_STRING( + [--with-globus-state-dir=PATH], + [Path to Globus state files]), + globusstatedir="$withval", + globusstatedir=$localstatedir) # GRAM-333: SEG config in installer has variables that aren't resolved at # runtime @@ -100,18 +100,18 @@ globusstatedir="`eval echo $globusstatedir`" AC_SUBST(globusstatedir) AC_ARG_WITH(seg, - AC_HELP_STRING( - [--with-seg=yes|no], - [Enable GRAM configuration with the SEG module]), - SEG_ENABLED="$withval", - SEG_ENABLED="no") + AC_HELP_STRING( + [--with-seg=yes|no], + [Enable GRAM configuration with the SEG module]), + SEG_ENABLED="$withval", + SEG_ENABLED="no") case "$SEG_ENABLED" in - yes|no) + yes|no) : ;; - *) - AC_MSG_ERROR([Invalid argument to --with-seg]) - ;; + *) + AC_MSG_ERROR([Invalid argument to --with-seg]) + ;; esac AC_ARG_WITH([perlmoduledir], @@ -137,5 +137,5 @@ AC_CONFIG_FILES( globus-lsf.conf Makefile seg/Makefile - version.h) + version.h) AC_OUTPUT diff --git a/gram/jobmanager/lrms/lsf/source/seg/seg_lsf_module.c b/gram/jobmanager/lrms/lsf/source/seg/seg_lsf_module.c index 1197ee51d1..0c0d6a01a0 100644 --- a/gram/jobmanager/lrms/lsf/source/seg/seg_lsf_module.c +++ b/gram/jobmanager/lrms/lsf/source/seg/seg_lsf_module.c @@ -628,6 +628,7 @@ globus_l_lsf_find_logfile( const char lsf_idx_name[] = "lsb.events.1"; int i; time_t most_recent_event; + long long tmp_most_recent_event; GlobusFuncName(globus_l_lsf_find_logfile); SEGLsfEnter(); @@ -683,7 +684,8 @@ globus_l_lsf_find_logfile( } else { - fscanf(state->fp, "#%ld", &most_recent_event); + fscanf(state->fp, "#%lld", &tmp_most_recent_event); + most_recent_event = tmp_most_recent_event; fclose(state->fp); state->fp = NULL; } @@ -805,6 +807,7 @@ globus_l_lsf_parse_events( { char * eol; time_t event_timestamp; + long long tmp_timestamp; char event_type_buffer[64]; char job_id_buffer[32]; int rc; @@ -848,15 +851,17 @@ globus_l_lsf_parse_events( * the parsing timestamp to match that when we hit EOF. */ sscanf(state->buffer + state->buffer_point + 1, - "%ld", &state->end_of_file_timestamp); + "%lld", &tmp_timestamp); + state->end_of_file_timestamp = tmp_timestamp; goto next_line; } } sscanf(state->buffer + state->buffer_point, - "\"%[^\"]\" \"%*[^\"]\" %ld %s", + "\"%[^\"]\" \"%*[^\"]\" %lld %s", event_type_buffer, - &event_timestamp, + &tmp_timestamp, job_id_buffer); + event_timestamp = tmp_timestamp; if (event_timestamp < state->start_timestamp) { @@ -895,8 +900,8 @@ globus_l_lsf_parse_events( */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in PEND state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in PEND state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_PSUSP: /* @@ -904,16 +909,16 @@ globus_l_lsf_parse_events( * the LSF administrator, while pending. */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in PSUSP state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in PSUSP state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_RUN: /* * the job is currently running. */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in RUN state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in RUN state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_SSUSP: @@ -928,8 +933,8 @@ globus_l_lsf_parse_events( * bqueues(1), */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in SSUSP state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in SSUSP state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_USUSP: /* @@ -937,8 +942,8 @@ globus_l_lsf_parse_events( * the LSF administrator, while running. */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in SSUSP state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in SSUSP state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_EXIT: /* @@ -1000,16 +1005,16 @@ globus_l_lsf_parse_events( * Post job process done successfully */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in PDONE state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in PDONE state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_PERR: /* * Post job process has error */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in PERR state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in PERR state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_WAIT: /* @@ -1017,19 +1022,19 @@ globus_l_lsf_parse_events( * chunk job that are waiting to run. */ SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in WAIT state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in WAIT state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_UNKWN: SEGLsfDebug(SEG_LSF_DEBUG_TRACE, ("ignoring JOB_STATUS: job %s in UNKNWN state " - "(%ld)\n", - job_id_buffer, event_timestamp)); + "(%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; case JOB_STAT_NULL: SEGLsfDebug(SEG_LSF_DEBUG_TRACE, - ("ignoring JOB_STATUS: job %s in NULL state (%ld)\n", - job_id_buffer, event_timestamp)); + ("ignoring JOB_STATUS: job %s in NULL state (%lld)\n", + job_id_buffer, (long long) event_timestamp)); break; } } diff --git a/packaging/debian/globus-gram-job-manager-lsf/debian/changelog.in b/packaging/debian/globus-gram-job-manager-lsf/debian/changelog.in index 0a43704455..7c2af416dd 100644 --- a/packaging/debian/globus-gram-job-manager-lsf/debian/changelog.in +++ b/packaging/debian/globus-gram-job-manager-lsf/debian/changelog.in @@ -1,3 +1,9 @@ +globus-gram-job-manager-lsf (3.1-1+gct.@distro@) @distro@; urgency=medium + + * Handle 64 bit time_t on 32 bit systems + + -- Mattias Ellert Sun, 10 Mar 2024 20:41:04 +0100 + globus-gram-job-manager-lsf (3.0-1+gct.@distro@) @distro@; urgency=medium * First Grid Community Toolkit release diff --git a/packaging/fedora/globus-gram-job-manager-lsf.spec b/packaging/fedora/globus-gram-job-manager-lsf.spec index f9ca018b68..d60a6ec2c3 100644 --- a/packaging/fedora/globus-gram-job-manager-lsf.spec +++ b/packaging/fedora/globus-gram-job-manager-lsf.spec @@ -2,8 +2,8 @@ Name: globus-gram-job-manager-lsf %global _name %(echo %{name} | tr - _) -Version: 3.0 -Release: 2%{?dist} +Version: 3.1 +Release: 1%{?dist} Summary: Grid Community Toolkit - LSF Job Manager Support Group: Applications/Internet @@ -170,6 +170,9 @@ fi %config(noreplace) %{_sysconfdir}/globus/scheduler-event-generator/available/lsf %changelog +* Sun Mar 10 2024 Mattias Ellert - 3.1-1 +- Handle 64 bit time_t on 32 bit systems + * Thu Mar 12 2020 Mattias Ellert - 3.0-2 - Add BuildRequires perl-interpreter