Youscribe/sysfs-cookbook — pull request #3 by asmirnov (2013-07-24 19:22:38+00:00)
Title: Prevent provider from touching commented lines with matching variable names

Here is a beginning of the default sysfs.conf from debian:

```
#
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Syntax:
# attribute = value
# mode attribute = 0600 # (any valid argument for chmod)
# owner attribute = root:wheel # (any valid argument for chown)
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000
```

If you try to save the variable 'devices/system/cpu/cpu0/cpufreq/scaling_governor' using sysfs resource, it's not going to happen because insert_line_if_no_match method will actually match the comment. Same problem with search_file_delete_line method.

I have changed a file patching logic a little and it worked for me. Hope it's useful.