Is UNIX home directory really needed to run root?

From: Dimitri Bourilkov <bourilkov_at_phys.ufl.edu>
Date: Fri, 24 Aug 2007 20:19:32 -0400


Hi,

     Having succeeded to use condor flocking to submit (my) batch jobs, I am trying to submit _root_ batch jobs (root -b -q xxx.C) to a remote farm where I do not have a unix account (condor is taking care of this), just an NFS mounted working space. The jobs are running into problems, terminating with the message:

     Fatal in <TROOT::InitSystem>: HOME directory not set

Looking in the root source this comes from the snippets enclosed below. If I read them correctly, things are more or less hardcoded to look for the unix user and get the home dir from the passwd file.

     My questions are:
     1) Is this really needed to run root?
     2) Or defining a dir where root can read/write could be enough, and how to 
achieve this (if needed, modifying the code)?

     Thanks, Dimitri

PS Actually if mydir[kMAXPATHLEN] is initialized before calling TUnixSystem::UnixHomedirectory maybe things will behave differently, is this feasible and a viable solution?



void TROOT::InitSystem()
{

    // Initialize operating system interface.

    if (gSystem == 0) {
#if defined(R__UNIX)

       gSystem = new TUnixSystem;
#elif defined(R__WIN32)

       gSystem = new TWinNTSystem;
#elif defined(R__VMS)

       gSystem = new TVmsSystem;
#else

       gSystem = new TSystem;
#endif

       if (gSystem->Init())
          fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating 
system layer\n");
       if (!gSystem->HomeDirectory())
          fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
.....

     and in TUnixSystem


//______________________________________________________________________________
const char *TUnixSystem::HomeDirectory(const char *userName) {

    // Return the user's home directory.

    return UnixHomedirectory(userName);
}

//---- directories -------------------------------------------------------------

//______________________________________________________________________________
const char *TUnixSystem::UnixHomedirectory(const char *name) {

    // Returns the user's home directory.

    static char path[kMAXPATHLEN], mydir[kMAXPATHLEN];     struct passwd *pw;

    if (name) {

       pw = getpwnam(name);
       if (pw) {
          strncpy(path, pw->pw_dir, kMAXPATHLEN);
          return path;
       }
    } else {
       if (mydir[0])
          return mydir;
       pw = getpwuid(getuid());
       if (pw) {
          strncpy(mydir, pw->pw_dir, kMAXPATHLEN);
          return mydir;
       }

    }
    return 0;
}
-- 
        _/_/_/                             _/_/_/
       _/    _/   Dimitri  BOURILKOV      _/    _/
      _/    _/   University of Florida   _/_/_/
     _/    _/   bourilkov_at_phys.ufl.edu  _/    _/
    _/_/_/                             _/_/_/
Received on Sat Aug 25 2007 - 02:19:46 CEST

This archive was generated by hypermail 2.2.0 : Sun Aug 26 2007 - 05:50:02 CEST