Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 533786 - sys-process/fcron - /etc/init.d/fcron fails to get values from the config file
Summary: sys-process/fcron - /etc/init.d/fcron fails to get values from the config file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Deutschmann (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-12-28 13:41 UTC by Dimitrios Semitsoglou-Tsiapos
Modified: 2016-11-17 22:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch that fixes the issue. (file_533786.txt,2.72 KB, patch)
2014-12-28 13:41 UTC, Dimitrios Semitsoglou-Tsiapos
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitrios Semitsoglou-Tsiapos 2014-12-28 13:41:13 UTC
Created attachment 392562 [details, diff]
Patch that fixes the issue.

The init script of fcron has a function with a broken `sed` call that always returns emptrystring.
For the case of trying to get `pidfile` with that function, `runscript` decides that this means that it doesn't have to supply `pidfile` to `start-stop-daemon`, which, when invoked again later, assumes that fcron is running via rc if it can find a matching process.

The problem manifests itself in a chrooted environment where the host is already running fcron.

How to reproduce:
1.
# /etc/init.d/fcron start
2.
# mount /dev/sdq5743 /mnt/chroot
# mount -t proc none /mnt/chroot
# mount --rbind /sys /mnt/chroot/sys
# mount --rbind /dev /mnt/chroot/dev
3.
# chroot /mnt/chroot /bin/zsh
# /etc/init.d/fcron start
 * Setting system clock using the hardware clock [UTC] ...    [ ok ]
 * Setting hostname to contest ...                            [ ok ]
 * Starting fcron ...
 * start-stop-daemon: /usr/libexec/fcron is already running
 * Failed to start fcron                                      [ !! ]
 * ERROR: fcron failed to start
# /etc/init.d/fcron -d start
...
++ start-stop-daemon --start --exec /usr/libexec/fcron -- -c /etc/fcron/fcron.conf  # Oh no!
...

The attached patch solves this issue by correcting the quotes in the `sed` command.
It also adds other missing quotes, removes "-a" and "-o" from "[ .. ]" statements, corrects `getconfig()` to not assume that the presence of a config file indicates the presence of a variable inside it, drops an unnecessary `cat` invocation and turns `configfile()` into a variable so that it does not need to be calculated every time we need it.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2016-11-17 22:06:17 UTC
Thanks for the report and the provided patch! I merged a different runscript however some changes are based on your idea:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=531e27c45e1f413da44d8a51ece0f59e454586fb