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

Without sudo the trap handler may loop #1

Open
S0AndS0 opened this issue Jul 12, 2021 · 0 comments
Open

Without sudo the trap handler may loop #1

S0AndS0 opened this issue Jul 12, 2021 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@S0AndS0
Copy link
Member

S0AndS0 commented Jul 12, 2021

Describe the bug

If torrific-lynx script is run without --disable-socat flag, and sudo permissions are denied, the trap handler may trigger. When exiting on some systems this may cause a loop where sudo permissions are requested until a passphrase is entered.


To Reproduce

Steps to reproduce the behavior:

  1. Run torrific-lynx without --disable-socat flag

  2. Press Ctrl^c when prompted for passphrase

  3. Continue pressing Ctrl^c when prompted for passphrase


Expected behavior

Script should terminate after pressing Ctrl^c

Desktop (please complete the following information):

  • OS: Manjaro Linux

  • Version: 21.0.7


Additional context

Instead of --disable-socat flag it may be better to use an enable prefix for opting-in to DNS over Tor features.

This bug may be caused by scripted logic operators, check shellcheck reports [SC2015]

Note that A && B || C is not if-then-else. C may run when A is true. [SC2015]

Example (generate SC2015)

[[ "${HOME}" == '/root' ]] && ! (( 1 + 1 )) && {
  echo 'yep'
} || {
  echo 'nope'
}

Example (fix SC2015)

if [[ "${HOME}" == '/root' ]] && ! (( 1 + 1 )); then
  echo 'yep'
else
  echo 'nope'
fi
@S0AndS0 S0AndS0 added bug Something isn't working good first issue Good for newcomers labels Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant