{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/18841","labels_url":"https://api.github.com/repos/saltstack/salt/issues/18841/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/18841/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/18841/events","html_url":"https://github.com/saltstack/salt/issues/18841","id":51447076,"number":18841,"title":"file.replace -> creates backups and touches the file, even if there are no changes at all","user":{"login":"DanielZuck","id":10047383,"avatar_url":"https://avatars.githubusercontent.com/u/10047383?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielZuck","html_url":"https://github.com/DanielZuck","followers_url":"https://api.github.com/users/DanielZuck/followers","following_url":"https://api.github.com/users/DanielZuck/following{/other_user}","gists_url":"https://api.github.com/users/DanielZuck/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielZuck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielZuck/subscriptions","organizations_url":"https://api.github.com/users/DanielZuck/orgs","repos_url":"https://api.github.com/users/DanielZuck/repos","events_url":"https://api.github.com/users/DanielZuck/events{/privacy}","received_events_url":"https://api.github.com/users/DanielZuck/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Low%20Severity","name":"Low Severity","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":1877,"closed_issues":1463,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-01-29T13:48:56Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2014-12-09T16:18:48Z","updated_at":"2015-01-29T16:14:48Z","closed_at":null,"body":"The following state:\r\n```\r\n{% set files = salt['file.find']('/etc/xinetd.d', name='*', type='f') %}\r\n\r\n{% for file in files %}\r\netc_xinetd_d_{{ file }}:\r\n  file.replace:\r\n    - name: {{ file }}\r\n    - pattern: '\\bdisable\\s*=\\s*no\\b'\r\n    - repl: 'disable = yes'\r\n    - show_changes: True\r\n    - flags: ['IGNORECASE']\r\n    - backup: False\r\n{% endfor %}\r\n```\r\n\r\ncorrectly renders expected as \"No changes were made\":\r\n```\r\n          ID: etc_xinetd_d_/etc/xinetd.d/chargen\r\n    Function: file.replace\r\n        Name: /etc/xinetd.d/chargen\r\n      Result: True\r\n     Comment: No changes were made\r\n     Started: 16:56:26.569695\r\n    Duration: 6.057 ms\r\n     Changes:\r\n```\r\nHowever, unexpected is that all files are touched (note the identical time stamp):\r\n```\r\nhost:/etc/xinetd.d # la\r\n-rw-r--r-- 1 root root  313 Dec  9 16:56 chargen\r\n-rw-r--r-- 1 root root  333 Dec  9 16:56 chargen-udp\r\n-rw-r--r-- 1 root root  409 Dec  9 16:56 cvs\r\n....\r\n```\r\n\r\nThe expected behavior is: if there was no change: to leave the file alone and untouched.\r\n\r\nFurthermore: if  ```backup: False``` is omitted in the state, there are backup files to every file created (as well if salt reports \"No changes were made\"). As well I noted that  \"append_if_not_found\" will append if the match was found, so this sounds linked to #18612 (grows infinitely on append_if_not_found).\r\n\r\nIt appears to me, that the handling of a \"no change\" is not handled as expected.\r\n\r\n```\r\nhost:/etc/xinetd.d # salt-call --versions-report\r\n           Salt: 2014.7.0\r\n         Python: 2.7.7 (default, Jun 23 2014, 13:38:05) [GCC]\r\n         Jinja2: 2.7.3\r\n       M2Crypto: 0.22\r\n msgpack-python: 0.4.2\r\n   msgpack-pure: Not Installed\r\n       pycrypto: 2.6.1\r\n        libnacl: Not Installed\r\n         PyYAML: 3.11\r\n          ioflo: Not Installed\r\n          PyZMQ: 14.3.1\r\n           RAET: Not Installed\r\n            ZMQ: 4.0.5\r\n           Mako: Not Installed\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/72052483","html_url":"https://github.com/saltstack/salt/issues/18841#issuecomment-72052483","issue_url":"https://api.github.com/repos/saltstack/salt/issues/18841","id":72052483,"user":{"login":"rallytime","id":6547906,"avatar_url":"https://avatars.githubusercontent.com/u/6547906?v=3","gravatar_id":"","url":"https://api.github.com/users/rallytime","html_url":"https://github.com/rallytime","followers_url":"https://api.github.com/users/rallytime/followers","following_url":"https://api.github.com/users/rallytime/following{/other_user}","gists_url":"https://api.github.com/users/rallytime/gists{/gist_id}","starred_url":"https://api.github.com/users/rallytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rallytime/subscriptions","organizations_url":"https://api.github.com/users/rallytime/orgs","repos_url":"https://api.github.com/users/rallytime/repos","events_url":"https://api.github.com/users/rallytime/events{/privacy}","received_events_url":"https://api.github.com/users/rallytime/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T16:14:48Z","updated_at":"2015-01-29T16:14:48Z","body":"Thanks for the update @HontoNoRoger! \r\n\r\n@DanielZuck Are you able to give this another try with the new release?"}}