Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exiting with status 2 only if we actually failed to lock #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattkae
Copy link

@mattkae mattkae commented Mar 4, 2024

This is a suggested fix for: #346

Because we can distinguish between a failure to lock the screen and a simple request from the compositor to "go away now", we can exit(2) in the former case and exit(0) in the latter.

@emersion
Copy link
Member

emersion commented Mar 4, 2024

I would prefer to keep 0 for "user unlocked" and pick something else for "compositor unlocked".

@mattkae
Copy link
Author

mattkae commented Mar 5, 2024

I would prefer to keep 0 for "user unlocked" and pick something else for "compositor unlocked".

This depends on whether or not the compositor telling the lockscreen to go away is an error case. In my opinion, it isn't because the compositor may internally decide that it's time to unlock, which means that it wants to relate that info to the client.

@emersion
Copy link
Member

emersion commented Mar 5, 2024

No, it's a question of the semantics of the exit code. To me, it's a good design to specify that 0 is returned if and only if credentials were successfully verified. No credentials are verified when the compositor decides to close the lock screen.

@AlanGriffiths
Copy link

The question is what are the most useful semantics for the exit code. Usually, zero indicates success and non-zero indicates a failure. Being dismissed by the compositor is not an error.

Note that the case that is motivating @mattkae is when the credentials are validated elsewhere, e.g. by the greeter, which notifies the compositor and the compositor notifies the lockscreen (by sending "finished"). In this scenario swaylock indicates an error when no error has occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants