Bug 607733 - --homedir does not work if parent directory does not exist
Summary: --homedir does not work if parent directory does not exist
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: anaconda
Version: 5.5
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Anaconda Maintenance Team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-06-24 16:48 UTC by Martin Poole
Modified: 2018-11-14 18:58 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-28 14:02:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


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