This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1032562 - Augeas save does not create directory when needed
Augeas save does not create directory when needed
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: augeas (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Dominic Cleal
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-20 06:57 EST by Jakub Filak
Modified: 2016-11-30 19:45 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-10 03:01:31 EDT
Type: Bug
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 Jakub Filak 2013-11-20 06:57:00 EST
Description of problem:
When saving a file (in this case /etc/ssh/sshd_config), augeas is able
to create the sshd_file file, but not the ssh directory.

Version-Release number of selected component (if applicable):
augeas-1.1.0-3.el7

How reproducible:
Always

Steps to Reproduce:
$ mkdir -p /tmp/root/etc
$ augtool -r /tmp/root/
augtool> set  /files/etc/ssh/sshd_config/X11Forwarding yes
augtool> save
Saving failed
augtool> print /augeas/files/etc/ssh/sshd_config/
/augeas/files/etc/ssh/sshd_config
/augeas/files/etc/ssh/sshd_config/error = "open_augnew"
/augeas/files/etc/ssh/sshd_config/error/message = "No such file or directory"
augtool> quit
$ mkdir -p /tmp/root/etc/ssh
$ augtool -r /tmp/root/
augtool> set  /files/etc/ssh/sshd_config/X11Forwarding yes
augtool> save
Saved 1 file(s)
augtool> quit

Actual results:
The intermediate directories are not created and the configuration files is not saved.

Expected results:
The intermediate directories are created and the configuration files is saved.

Additional info:
http://www.redhat.com/archives/augeas-devel/2008-November/msg00012.html
Comment 2 Lingfei Kong 2014-01-07 21:20:50 EST
Can reproduce with augeas-1.1.0-6.el7

Steps to reproduce:
[host-b]#mkdir -p /tmp/root/etc
[host-b]# augtool -r /tmp/root/
augtool> set  /files/etc/ssh/sshd_config/X11Forwarding yes
augtool> save
error: Failed to execute command
saving failed (run 'print /augeas//error' for details)
augtool>  print /augeas/files/etc/ssh/sshd_config/
/augeas/files/etc/ssh/sshd_config
/augeas/files/etc/ssh/sshd_config/path = "/files/etc/ssh/sshd_config"
/augeas/files/etc/ssh/sshd_config/mtime = "0"
/augeas/files/etc/ssh/sshd_config/lens = "@Sshd"
/augeas/files/etc/ssh/sshd_config/lens/info = "/usr/share/augeas/lenses/dist/sshd.aug:123.12-125.36:"
/augeas/files/etc/ssh/sshd_config/error = "mk_augtemp"
/augeas/files/etc/ssh/sshd_config/error/message = "No such file or directory"
augtool> quit
[host-b]#mkdir -p /tmp/root/etc/ssh
[host-b]#augtool -r /tmp/root/
augtool> set  /files/etc/ssh/sshd_config/X11Forwarding yes
augtool> save
Saved 1 file(s)
augtool> quit
[host-b]#cat /tmp/root/etc/ssh/sshd_config 
X11Forwarding yes
Comment 3 Dominic Cleal 2014-01-30 04:35:08 EST
After discussing with SRT, I'm unsure now that there's any precedence for doing this, so am inclined to reject the request.

Usually text editors (thinking vim etc), shells (I/O redirection) or utilities (touch) won't create parent directories if you request that they create a file in a directory that doesn't yet exist.  Just on this point, I don't think that Augeas should be any different.

The only case that SRT could think of was perhaps Webmin, but I wouldn't compare Augeas to Webmin.

Unlike SELinux contexts, we don't have a database of any sort to know what the correct permissions and ownership should be.  The umask would be a fairly safe bet, but I'd say this behaviour would still be unusual and possibly unexpected.  The thread linked in the description does detail many of the risks.

The only outcome that David suggests to be reasonable is adding metadata to the tree for ownership, mode etc, but this feels a bit complex to me, and probably wouldn't be used in practice (at least not in your simple example).
Comment 4 RHEL Product and Program Management 2014-03-22 02:29:55 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

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