Bug 607733

Summary: --homedir does not work if parent directory does not exist
Product: Red Hat Enterprise Linux 5 Reporter: Martin Poole <mpoole>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: mitr
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-28 14:02:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Poole 2010-06-24 16:48:04 UTC
Description of problem:

If trying to place home directories outside /home if the parent directory does not exist the create will fail.

Version-Release number of selected component (if applicable):

anaconda-11.1.2.209-1

How reproducible:


Steps to Reproduce:
1.  have kickstart file with

  user --name=test --uid=10034 --homedir=/apps/home/test

  
Actual results:

python traceback as /apps/home does not exist.

Expected results:

/apps/home is created

Additional info:

This was seen in a deployment where /apps is a file system mount created earlier in the install.

Comment 1 Chris Lumens 2010-06-24 17:04:01 UTC
What's the traceback?

Comment 3 Chris Lumens 2010-10-13 20:50:27 UTC
I believe libuser handles all the directory creation in rhel5.

Comment 4 Miloslav Trmač 2010-10-26 19:44:06 UTC
Ordinarily, UNIX tools do not automatically create a whole directory structure when given a path ("mkdir" vs. "mkdir -p"); specifying such a path is quite likely to be a typo.

In a post-installation environment, luseradd/libuser should thus not create the parent directories automatically, in my opinion.  (FWIW, useradd(8) does not create the parent directories either.)

This suggests anaconda should create the parent directories.

Comment 5 Chris Lumens 2010-10-27 14:00:32 UTC
(In reply to comment #4)
> Ordinarily, UNIX tools do not automatically create a whole directory structure
> when given a path ("mkdir" vs. "mkdir -p"); specifying such a path is quite
> likely to be a typo.
> 
> In a post-installation environment, luseradd/libuser should thus not create the
> parent directories automatically, in my opinion.  (FWIW, useradd(8) does not
> create the parent directories either.)
> 
> This suggests anaconda should create the parent directories.

Of course, this means that every single tool using libuser is going to have to check and perform these actions, which seems contrary to the entire point of using a library to me.

Comment 6 Miloslav Trmač 2010-10-27 14:18:15 UTC
(In reply to comment #5)
> Of course, this means that every single tool using libuser is going to have to
> check and perform these actions, which seems contrary to the entire point of
> using a library to me.

No - in particular luseradd uses libuser and should not perform this action IMO.

Comment 7 Chris Lumens 2010-10-27 18:16:18 UTC
> > Of course, this means that every single tool using libuser is going to have to
> > check and perform these actions, which seems contrary to the entire point of
> > using a library to me.
> 
> No - in particular luseradd uses libuser and should not perform this action
> IMO.

Just saying "no" doesn't make it so.  The fact is, every program that uses libuser is going to have to take the given home directory, chop off the username part, see if the directory exists, create it if not, and then call into libuser to have it create just the username part.  That's just what is going to happen.  That duplicates this code and it duplicates error handling.

Comment 8 Miloslav Trmač 2010-10-28 00:25:00 UTC
(In reply to comment #7)
> > > Of course, this means that every single tool using libuser is going to have to
> > > check and perform these actions, which seems contrary to the entire point of
> > > using a library to me.
> > 
> > No - in particular luseradd uses libuser and should not perform this action
> > IMO.
> 
> Just saying "no" doesn't make it so.
In this case it probably does, because I'm the maintainer of that program :)

The reasoning is in comment 4.  I might be persuaded to change my opinion, but the claim that creating parent directories automatically is expected of UNIX utilities, and in particular that every user of libuser needs to do it, is just not true I'm afraid.