Ticket #1477: 0001-Prevent-SGE_BINDING-variable-having-a-spurious-space.patch

File 0001-Prevent-SGE_BINDING-variable-having-a-spurious-space.patch, 1.4 KB (added by markdixon, 6 years ago)

Added by email2trac

  • source/daemons/shepherd/shepherd_binding.c

    From 708e15311a1c7d8794cafa8b3973abdd7c0a4d2c Mon Sep 17 00:00:00 2001
    From: Mark Dixon <m.c.dixon@leeds.ac.uk>
    Date: Thu, 3 Oct 2013 12:49:58 +0100
    Subject: [PATCH] Prevent SGE_BINDING variable having a spurious space at start
    
    Where a job was not allocated cpu 0, the SGE_BINDING string always
    started with a space.
    
    Other than being untidy and potentially causing head-scratches for users
    trying to interpret this variable, it also caused the Linux cpuset code
    to prefix a comma to strings used to configure cpusets - which were then
    ignored by the kernel.
    ---
     source/daemons/shepherd/shepherd_binding.c |    7 +++++--
     1 files changed, 5 insertions(+), 2 deletions(-)
    
    diff --git a/source/daemons/shepherd/shepherd_binding.c b/source/daemons/shepherd/shepherd_binding.c
    index 2426d65..3a0a754 100644
    a b create_binding_env(hwloc_const_bitmap_t set) 
    773773   dstring sge_binding  = DSTRING_INIT;
    774774   dstring proc         = DSTRING_INIT;
    775775   unsigned i;
     776   bool first           = true;
    776777
    777778   hwloc_bitmap_foreach_begin(i, set)
    778       if (0 == i)
     779      if (first) {
     780        first = false;
    779781        sge_dstring_sprintf(&proc, "%d", i);
    780       else
     782      } else {
    781783        sge_dstring_sprintf(&proc, " %d", i);
     784      }
    782785      sge_dstring_append_dstring(&sge_binding, &proc);
    783786   hwloc_bitmap_foreach_end();
    784787