Ticket 18988 - Setting SLURM_BCAST overwrites first entry of job argv as reported by spank_get_item
Summary: Setting SLURM_BCAST overwrites first entry of job argv as reported by spank_g...
Status: RESOLVED DUPLICATE of ticket 16673
Alias: None
Product: Slurm
Classification: Unclassified
Component: User Commands (show other tickets)
Version: 23.02.3
Hardware: Linux Linux
: 3 - Medium Impact
Assignee: Director of Support
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2024-02-14 16:11 MST by Andrew D'Angelo
Modified: 2024-02-14 16:14 MST (History)
1 user (show)

See Also:
Site: CRAY
Slinky Site: ---
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: Cray Internal
DS9 clusters: ---
Google sites: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita Sites: ---
Linux Distro: ---
Machine Name:
CLE Version:
Version Fixed:
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments

Note You need to log in before you can comment on or make changes to this ticket.
Description Andrew D'Angelo 2024-02-14 16:11:11 MST
A SPANK plugin that gets `S_JOB_ARGV` will have the first entry overwritten by the value for the environment variable `SLURM_BCAST` if set in the environment.

I have also reproduced this same issue on Slurm 22.05.5. We use a SPANK plugin for one of our products, ATP. It relies on this functionality to get the path to the target binary.

```
$ srun ls ~
srun: argv[0]: ls
srun: argv[1]: /home/users/adangelo

$ SLURM_BCAST=/tmp/ srun ls ~
srun: argv[0]: /tmp/
srun: argv[1]: /home/users/adangelo
```

Plugin source:

```
#include <stdlib.h>
#include <stdio.h>

#include <slurm/spank.h>

#define MAJOR_VER 1
#define MINOR_VER 0
#define FULL_VERSION ((MAJOR_VER * 1000) + MINOR_VER)
SPANK_PLUGIN(launch/repro, FULL_VERSION)

int slurm_spank_local_user_init(spank_t sHandle, int argc, char **argv)
{
        int binary_argc = 0;
        char const** binary_argv = NULL;
        if (spank_get_item(sHandle, S_JOB_ARGV, &binary_argc, &binary_argv)) {
                slurm_info("Failed to get binary argv\n");
                return 0;
        }

        for (int i = 0; i < binary_argc; i++) {
                slurm_info("argv[%d]: %s\n", i, binary_argv[i]);
        }
        return 0;
}
```

```
$ cc -shared -lslurm librepro.c -o librepro.so
```

Added `optional .../librepro.so` to Plugstack config file.
Comment 2 Andrew D'Angelo 2024-02-14 16:14:59 MST
Looks like I already opened a bug on this (issue fixed in later release)

*** This ticket has been marked as a duplicate of ticket 16673 ***