Re: [ROOT] Request for iteration on TSystemDirectory

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Mon Mar 12 2001 - 23:21:47 MET


Hello Philippe,

> Hi Valery,
> 
> TFileSet::TFileSet current has to receveive a first argument
> containing a '/'.
> I.e. your example would works with
>    TString name("./ATLAS")
>    TFileSet fs(name)
> 
> This is due to the lines:
> 

 It is not correct since "setname"  is second parameter.
That is omitted above. By this reason it is "default"
However I agree with your comment.
The code must be protected against of such things properly.

>     if (!setname) {setname = strrchr(name,'/')+1;}
>     if (setname) SetName(setname);
>     else SetName(name);
> 
> The test on the second line is incorrect because the
> first line sets 'setname' to 1 when there are no '/'.

Anyway this bug should not cause the behaviour I am observing 
under Root 3.00.06 at CERN and doesn'r explain the problem 
that Christian found.
 
  Thank you,
                       Valeri


> Philippe.
> 
> A possible patch is:
> 
> 
> cvs diff star/src/TFileSet.cxx
> Index: star/src/TFileSet.cxx
> ===================================================================
> RCS file: /user/cvs/root/star/src/TFileSet.cxx,v
> retrieving revision 1.2
> diff -r1.2 TFileSet.cxx
> 63c63,66
> <     if (!setname) {setname = strrchr(name,'/')+1;}
> ---
> >     if (!setname) {
> >        setname = strrchr(name,'/');
> >        if (setname) setname++;
> >     }
> 
> 
> 
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Valeri Fine (Faine)
> Sent: Monday, March 12, 2001 3:07 PM
> To: Christian Holm Christensen
> Cc: roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] Request for iteration on TSystemDirectory
> 
> 
> 
> > >
> > > Uh. When I do
> > >
> > >   root> gSystem->Load("libStar.so");
> > >   root> TString home("/home/group/user")
> > >   root> TFileSet myHome(home)
> > >
> > > it hangs! That is, nothing happens. ROOT/CINT doen't do anything (I
> > > let it sit there for at least ~30 minutes). Even if I do
> > >
> > >   root> TFileSet myhome("/home/group/user", "foo", kFALSE)
> > >
> > > nothing (and I really mean nothing!) happens. What's up?
> > >
> >
> > I still have no 3.00.06 locally. Mean time I tried 3.00.05
> > and found no problem:
> 
>  I've tried this example at CERN under ROOT 3.00.06 and found:
> 
> Starting program:
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//bin/root.exe -b
>   *******************************************
>   *                                         *
>   *        W E L C O M E  to  R O O T       *
>   *                                         *
>   *   Version   3.00/06     12 March 2001   *
>   *                                         *
>   *  You are welcome to visit our Web site  *
>   *          http://root.cern.ch            *
>   *                                         *
>   *******************************************
> 
> Compiled with thread support.
> 
> CINT/ROOT C/C++ Interpreter version 5.14.79, Feb 24 2001
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] gSystem->Load("libStar")
> root [1] TString name("ATLAS")
> root [2] TFileSet fs(name)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400fde3b in TString::operator= ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libCore.so
> (gdb) where 5
> #0  0x400fde3b in TString::operator= ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libCore.so
> #1  0x400ed130 in TNamed::SetName ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libCore.so
> #2  0x40cfd21e in TFileSet::TFileSet ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libStar.so
> #3  0x40d344dc in G__TFileSet_TFileSet_1_0__FP8G__valuePCcP8G__parami ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libStar.so
> #4  0x404722f3 in G__call_cppfunc ()
>    from
> /afs/cern.ch/na49/library.4/ROOT/new/i386_redhat60/root//lib/libCint.so
> (More stack frames follow...)
> (gdb)
> 
>            Any idea ?
> 
> >
> > [rcf] ~/public/expert/root > root.exe -b
> >   *******************************************
> >   *                                         *
> >   *                                         *
> >   *   Version   3.00/05      5 March 2001   *
> >   *                                         *
> >   *                                         *
> >   *******************************************
> > root [0] gSystem->Load("libStar")
> > (int)0
> > root [1] TString a("~/public/expert")
> > root [2] TFileSet fs(a)
> > root [3] fs.ls(8)
> >   0 - expert    directory
> >   1 - expert/Jeff       directory
> >   2 - expert/Jeff/SavePrim.C    file
> >   2 - expert/Jeff/myTestFile.C  file
> >   1 - expert/C++Fun     directory
> >
> >
> > How deep is your ("/home/group/user") ?
> > Are you sure it is not running around the globe follow the symbolic
> > links for example.It may take a while I think.
> > I have found  one has to protect this class against of "black hole deep"
> > directories.
> >
> >  Some thing like this:
> >
> > Replace ctor:
> >
> > TFileSet(const TString &dirname,const Char_t *setname,Bool_t expand)
> >
> > with
> >
> > TFileSet(const TString &dirname,const Char_t *setname,Bool_t expand, Int_t
> maxDeep=10)
> > {
> >       if (!maxDeep) return;
> >      . . .
> >
> >
> > and  replace:
> >
> >          Add(new TFileSet(nextdir,name,kFALSE));
> > with
> >          Add(new TFileSet(nextdir,name,kFALSE,maxDeep-1));
> >
> >  Thank you,
> >                                         Valeri
> >
> >
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET