I can't reproduce it on an older version either. slurm version....
2.1.15-2 redhat glibc... GNU C Library stable release version 2.5, by Roland McGrath et al. Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-48). Compiled on a Linux 2.6.9 system on 2011-09-14. -Jon On 08/24/2012 02:32 PM, Mark A. Grondona wrote: > > > 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
