Just saw the changes here: author Michał Kępień <github@kempniu.pl> 2016-10-05 09:08:55 (GMT) committer: Justin Bronder <jsbronder@gentoo.org> 2016-10-28 12:57:14 (GMT) commit 975400d5765f7405f611ddf66a3ad717cb21a203 (patch) tree 63af103d41e9e10781cb92af4b7ed040b4052eff /net-nntp/sabnzbd This change is dangerous: get_var() { - echo $(sed -n \ - '/^\[misc]/,/^'$1'/ s/^'$1' = \([[:alnum:].]\+\)[\r|\n|\r\n]*$/\1/p' \ - "${SABNZBD_CONFIGFILE}") + grep -P -o -m 1 "(?<=^${1} = ).*" "${SABNZBD_CONFIGFILE}" || echo 0 } The script previously was only looking for values (deliberately) in [misc] section which allowed for that [misc] section to appear anywhere in the file. The new code is now wrongly assuming the [misc] section will always be the first section in the file which may change in the future. This would break horribly if it did. The key "port" appears multiple times in the file for example.
The issue you describe only pertains to "host" and "port" variables, so if by "break horribly", you mean "fall back to SIGTERM and do what it is supposed to do", then yeah, I guess it will "break horribly" in such a case :) As I wrote in the line comment at GitHub [1], SABnzbd+ does not reorder sections when writing the configuration file. As the [misc] section is the first section in both the configuration file used by the Gentoo ebuild and the one generated by SABnzbd+ itself in case no configuration file is present, the situation you describe would only happen when the user rearranges sections by hand (e.g. using an editor). Sure, it is possible, but how many people have actually done that? Again, even if it happens, the script will still do what it is supposed to. This is obviously a maintainer's call to make and I will not blindly defend my position. Quite frankly, I do not care enough, I just happen to like keeping things simple when possible. Though if get_var() ends up using sed again, it would be nice if the other issues [2] got ironed out. [1] https://github.com/gentoo/gentoo/pull/2477#discussion_r82557099 [2] https://github.com/gentoo/gentoo/pull/2477#discussion_r82556994
Personally, and I very well could be wrong, I'm going to stick with Michał's changes. However, I'd happily accept a patch that also make sure to check the right section is being parsed just in case the user decided to move things around assuming it does still address the other bugs brought up on github.
# rc-service sabnzbd start sabnzbd | * Starting SABnzbd ... sabnzbd | * start-stop-daemon: failed to start `/usr/share/sabnzbd/SABnzbd.py' [ !! ]d | sabnzbd | * ERROR: sabnzbd failed to start test changes before merging into tree.
Whatever the issue that you are affected by is, I fail to see its connection with the issue discussed in this bug (i.e. what get_var() does - note that get_var() is not used when SABnzbd+ is started). Could you please open another bug report with an error log attached and CC me?
@Oleg There is another issue due to https://gitweb.gentoo.org/repo/gentoo.git/commit/net-nntp/sabnzbd?id=23150df6ad2364e1d4de4438f8ef1379c20257c9.
#600356
Greetings from 6 years in the future! This format hasn't changed even after a refactor to python3 and no reports have been about issues caused since this bug was raised. All the other things discussed in comments are python2 issues that are obsoleted by sabnzbd moving to py3. I realize you may not like this resolution but history has shown it's not currently a problem. IF that ever changes, file a new bug and I'll revisit this.