Open maciejsszmigiero opened 1 year ago
I can't seem to reproduce this issue you describe.
do you have the following enabled /etc/laptop-mode/laptop-mode.conf
?
ENABLE_LAPTOP_MODE_ON_AC
LM_BATT_MAX_LOST_WORK_SECONDS
LM_AC_MAX_LOST_WORK_SECONDS
The minimal test case is probably just calling this grep directly:
$ echo ",rw,noatime,commit=60," | grep ",commit=[0123456789]+,"
versus:
$ echo ",rw,noatime,commit=60," | grep ",commit=[0123456789]\+,"
,rw,noatime,commit=60,
For reference:
$ grep --version
grep (GNU grep) 3.8
Copyright (C) 2022 Free Software Foundation, Inc.
I don't have ENABLE_LAPTOP_MODE_ON_AC
enabled, but I do have ENABLE_LAPTOP_MODE_ON_BATTERY
enabled and LM_BATT_MAX_LOST_WORK_SECONDS
left at the default 600.
The issue happens in the following scenario:
commit=60
),LM_BATT_MAX_LOST_WORK_SECONDS
(like 600 in my case),commit=60
value, but rather overwrite it with commit=0
(the kernel default one).
grep without "-E" option uses basic regular expressions, where "+" repetition operator needs to be backslashed as "+", but replace_numeric_mount_option() function in the laptop-mode module used just a plain "+".
This resulted in this function being unable to find a commit interval option in the saved mount options and so substituting it with the default "commit=0" instead.
Due to this mistake any non-default commit interval would get reset to the filesystem-specific default value (as provided by "commit=0") when laptop mode was deactivated (like when the AC supply was plugged).