Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1031084

Summary: augeas does not save changes in the included file paths containing double slash
Product: Red Hat Enterprise Linux 7 Reporter: Jakub Filak <jfilak>
Component: augeasAssignee: Dominic Cleal <dcleal>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: bfan, jberan, leiwang, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: augeas-1.1.0-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:53:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Filak 2013-11-15 15:14:13 UTC
Description of problem:
Changes made to $HOME/.ssh/config file through augtool are not saved.

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

How reproducible:
Always

Steps to Reproduce:
1. rm -f /home/jfilak/.ssh/config
2. augtool -r / -s set home/jfilak/.ssh/config/Host[0] github.com
3. cat /home/jfilak/.ssh/config

Actual results:
cat: /home/jfilak/.ssh/config: No such file or directory

Expected results:
Host github.com

Additional info:
The problem is in filter_matches() function[1]. The function uses fnmatch(,,FNM_PATHNAME)[2][3] to check whether a tree path is a file. FNM_PATHNAME requires to have the exactly matching slashes[4] and this is problematic when a lens filter uses a construction like this 'incl (Sys.getenv("HOME") . "/.ssh/config")'[5]. On my system $HOME variable holds "/home/jfilak/", so the include is expanded to "/home/jfilak//.ssh/config".
A fnmatch("/home/jfilak//.ssh/config", "/home/jfilak/.ssh/config", FNM_PATHNAME) call returns no match, therefore /files/home/jfilak/.ssh/config/Host[0] path has no matching file and the changes are not saved.


1: https://github.com/hercules-team/augeas/blob/master/src/transform.c#L254
2: https://github.com/hercules-team/augeas/blob/master/src/transform.c#L257
3: https://github.com/hercules-team/augeas/blob/master/src/transform.c#L42
4: http://linux.die.net/man/3/fnmatch
5: https://github.com/hercules-team/augeas/blob/master/lenses/ssh.aug#L79

Comment 2 bfan 2013-11-18 10:40:03 UTC
Can reproduce with augeas-1.1.0-3.el7.x86_64

1. set $HOME end with '/'
$ echo $HOME
/home/mockbuild
$ export HOME=/home/mockbuild/

2. execute augtool command
$ rm -f /home/mockbuild/.ssh/config 
$ augtool -r / -s set home/mockbuild/.ssh/config/Host[0] github.com
$ cat /home/mockbuild/.ssh/config 
cat: /home/mockbuild/.ssh/config: No such file or directory

Comment 3 Dominic Cleal 2013-11-19 10:08:34 UTC
Thanks for the detailed bug report Jakub.

Upstream as 361adbf9e520d695ae13efe6084cbcdebe4779e2.

Comment 5 bfan 2013-11-19 13:14:42 UTC
Verified with augeas-1.1.0-4.el7

[mockbuild@]$ export HOME=/home/mockbuild/
[mockbuild@]$ echo $HOME
/home/mockbuild/
[mockbuild@]$ rm -f /home/mockbuild/.ssh/config
[mockbuild@]$ augtool -r / -s set home/mockbuild/.ssh/config/Host[0] github.com
Saved 1 file(s)
[mockbuild@]$ cat /home/mockbuild/.ssh/config 
Host github.com

So, change the status to verified

Comment 6 Ludek Smid 2014-06-13 12:53:50 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.