[rhel7/master/f21 1/2 V2] Create missing parent directories for user's home directory (#1163775)

Vratislav Podzimek vpodzime at redhat.com
Tue Nov 18 21:16:39 UTC 2014


On Tue, 2014-11-18 at 11:54 -0800, Brian C. Lane wrote:
> On Mon, Nov 17, 2014 at 07:44:14AM -0500, Anne Mulhern wrote:
> > > the home directories parents, suitable for passing to mkdirChain.
> > 
> > "the home directories parents" would be better as "the directory's parent's path"
> > 
> > or something like that.
> 
> Fixed.
> 
> > > +def parent_dir(directory):
> > > +    """Return the parent directories"""
> > 
> > "parent directories" -> "parent's path"
> 
> Fixed too.
> 
> > > +                if not self._user.homedir.startswith("/"):
> > 
> > Would be nicer to use os.path.isabs() here.
> 
> Oh hey, it would. Fixed.
> 
> > 
> > > +                    self._user.homedir = "/" + self._user.homedir
> > 
> > Would be nicer to use os.path.join() here.
> 
> I hate os.path.join, it doesn't do what you expect when trailing
> elements start with a / (not the case here, but still shouldn't be
> used).
+1000 here. I even have this in oscap-anaconda-addon's sources:

> def join_paths(path1, path2):
>     """                                                                                                                                                                                                            
>     Joins two paths as one would expect -- i.e. just like the os.path.join                                                                                                                                         
>     function except for doing crazy things when the second argument is an                                                                                                                                          
>     absolute path.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list