Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547230 - sys-apps/openrc - recursive checkpath
Summary: sys-apps/openrc - recursive checkpath
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-20 22:08 UTC by Bertrand Jacquin
Modified: 2015-10-12 20:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Jacquin 2015-04-20 22:08:38 UTC
Would it make sense to support a recursive checkpath in openrc for init script that let user define random directory like for /etc/init.d/iptables.

As of today, if one of the parent directory does not exist, an error is returned :

$ rm -rf /tmp/1 
$ /lib64/rc/bin/checkpath -v -d /tmp/1/2/3
 * /tmp/1/2/3: creating directory
 * checkpath: mkdir: No such file or directory


Reproducible: Always
Comment 1 William Hubbs gentoo-dev 2015-04-26 21:00:44 UTC
(In reply to Bertrand Jacquin from comment #0)
> Would it make sense to support a recursive checkpath in openrc for init
> script that let user define random directory like for /etc/init.d/iptables.

The iptables service script has two checkpath commands because they do two different things. checkpath -d deals with a directory, then checkpath -f deals with a file inside the directory.

> As of today, if one of the parent directory does not exist, an error is
> returned :
> 
> $ rm -rf /tmp/1 
> $ /lib64/rc/bin/checkpath -v -d /tmp/1/2/3
>  * /tmp/1/2/3: creating directory
>  * checkpath: mkdir: No such file or directory

I would be very concerned about a recursive checkpath, because combining it with mode and permission settings would lead to a possible dangerous situation.

How should the ownership and permissions be applied if someone does this?

$ rm -rf /tmp/1 
$ /lib64/rc/bin/checkpath -m 0755 -o user:group -v -d /tmp/1/2/3
Comment 2 Bertrand Jacquin 2015-04-26 21:10:15 UTC
(In reply to William Hubbs from comment #1)
> (In reply to Bertrand Jacquin from comment #0)
> > Would it make sense to support a recursive checkpath in openrc for init
> > script that let user define random directory like for /etc/init.d/iptables.
> 
> The iptables service script has two checkpath commands because they do two
> different things. checkpath -d deals with a directory, then checkpath -f
> deals with a file inside the directory.
> 
> > As of today, if one of the parent directory does not exist, an error is
> > returned :
> > 
> > $ rm -rf /tmp/1 
> > $ /lib64/rc/bin/checkpath -v -d /tmp/1/2/3
> >  * /tmp/1/2/3: creating directory
> >  * checkpath: mkdir: No such file or directory
> 
> I would be very concerned about a recursive checkpath, because combining it
> with mode and permission settings would lead to a possible dangerous
> situation.
> 
> How should the ownership and permissions be applied if someone does this?
> 
> $ rm -rf /tmp/1 
> $ /lib64/rc/bin/checkpath -m 0755 -o user:group -v -d /tmp/1/2/3

I understand your concern, but should all created directory have the same permission and owners as the leaf directory ?
Comment 3 William Hubbs gentoo-dev 2015-04-26 21:55:54 UTC
(In reply to Bertrand Jacquin from comment #2)
> (In reply to William Hubbs from comment #1)
> > (In reply to Bertrand Jacquin from comment #0)
> > I would be very concerned about a recursive checkpath, because combining it
> > with mode and permission settings would lead to a possible dangerous
> > situation.
> > 
> > How should the ownership and permissions be applied if someone does this?
> > 
> > $ rm -rf /tmp/1 
> > $ /lib64/rc/bin/checkpath -m 0755 -o user:group -v -d /tmp/1/2/3
> 
> I understand your concern, but should all created directory have the same
> permission and owners as the leaf directory ?

That's the problem; this could be argued multiple ways depending on the application, the path, and how secure users want their setup to be.
Comment 4 William Hubbs gentoo-dev 2015-10-12 20:10:25 UTC
I am marking this wontfix because I'm not comfortable enough with the
design of it to move forward. There are ambiguities in how a recursive
checkpath would operate that I'm not sure how to resolve. If you want to
continue the discussion, feel free to re-open the bug.