RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1032562 - Augeas save does not create directory when needed
Summary: Augeas save does not create directory when needed
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: augeas
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Dominic Cleal
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-20 11:57 UTC by Jakub Filak
Modified: 2016-12-01 00:45 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-10 07:01:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jakub Filak 2013-11-20 11:57:00 UTC
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-08 02:20:50 UTC
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 09:35:08 UTC
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 Program Management 2014-03-22 06:29:55 UTC
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.