This repository was archived by the owner on Jan 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Add a couple of small features to dhcpcd recipe #485
Open
kimrhh
wants to merge
3
commits into
oe-lite:master
Choose a base branch
from
kimrhh:dhcpcd-features
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? You still have
set -e, so if the first start-stop-daemon fails, you should never get around to testing $?. At least that how a quick test in bash behaves. If you make the do_stop part of a conditional chain, the set -e behaviour is suppressed, so it seems (again, tested in bash) that one can do "do_stop || true" in the restart) case. But then you don't need to change do_stop itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does work, since the -o just "checking if work is to be done" according to the docs, which means we only really stop it if there is something to stop. It is surely not the most obvious way to solve this, but dropping set -e means we need to change it a lot more to handle errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs say "-o,--oknodo Exit with status 0 if nothing is done", which I read as saying that the first start-stop-daemon does attempt to stop $DAEMON - it just also returns 0 if it doesn't succeed in doing so. And it seems that this means "/etc/init.d/dhcpcd stop" will always return 0, which I don't like (but I'm fine with making restart mean "restart or start"). But regardless of the semantics of -o, the last three lines are dead code, because if the first start-stop-daemon exits with 0, we do nothing, and if it exits non-zero, the script exits right there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right the three lines are dead code, but I don't think you are right that stop will always return 0 when we add the -o , there is surely a difference between "no work done" and "there was an error when stopping", but will verify tomorrow to be sure.
I don't think it is a great idea to throw away an error when stopping with || true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would be absolutely ideal to have the action "stop" exit non-zero if an error occured or no daemon was running, while "restart" would ignore the latter case and proceed to the start part. However, the source doesn't suggest that's how it works: