Bug 607733 - --homedir does not work if parent directory does not exist
--homedir does not work if parent directory does not exist
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: anaconda (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Anaconda Maintenance Team
Release Test Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-24 12:48 EDT by Martin Poole
Modified: 2010-10-28 10:02 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-10-28 10:02:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Poole 2010-06-24 12:48:04 EDT
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 13:04:01 EDT
What's the traceback?
Comment 3 Chris Lumens 2010-10-13 16:50:27 EDT
I believe libuser handles all the directory creation in rhel5.
Comment 4 Miloslav Trmač 2010-10-26 15:44:06 EDT
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 10:00:32 EDT
(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 10:18:15 EDT
(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 14:16:18 EDT
> > 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-27 20:25:00 EDT
(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.

Note You need to log in before you can comment on or make changes to this bug.