Hide Forgot
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
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
Thanks for the detailed bug report Jakub. Upstream as 361adbf9e520d695ae13efe6084cbcdebe4779e2.
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
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.