What version of SLURM and glibc?
I can't get this to reproduce with slurm-2.3 and RHEL6 version of glibc. I think getlogin() is looking at the utmp entry for the tty connected to fd 0 (stdin) of the process calling getlogin(3). I am surprised it returns anything for normal jobs (no tty), and I'm surprised it works for me since I doubt slurm adds a utmp entry. However, checking utmp for a running job might be interesting, and a workaround might involve setting a utmp entry for slurm jobs via a plugin. mark Andy Riebs <[email protected]> writes: > The following trivial program returns "root" when run under SLURM, even > though neither SlurmUser nor the current user is root. (Predictably, > this is in user code that we can't change.) Is there a configuration > setting that we could be using to avoid letting getlogin() think we are > root? > > The program: > > ----------- > #include <stdio.h> > #include <unistd.h> > > int > main() > { > printf("getlogin() returns \"%s\"\n", getlogin()); > return 0; > } > ---------- > > Andy > > -- > Andy Riebs > Hewlett-Packard Company > High Performance Computing > +1-786-263-9743 > My opinions are not necessarily those of HP
