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

fix: remove hostname from uname output in OS detection #1440

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

VAISHAKH-GK
Copy link
Contributor

@VAISHAKH-GK VAISHAKH-GK commented Oct 13, 2024

fix: remove hostname from uname output in OS detection

Type of change

  • Bug fix
  • Feature
  • Documentation update

Description

Using $(uname -a | awk '{$2=""; print $0}') instead of just uname -a helps remove the hostname from the output. since hostname can vary between systems it may lead to incorrect OS detection. By stripping out the hostname case statement accurately matches the relevant OS identifiers.

In my system script not work properly because my hostname is "vaishakh" , because it contains "ish" the case identify my linux device as ios device and ani-cli failed to play the video.

Checklist

  • any anime playing
  • bumped version

  • next, prev and replay work
  • -c history and continue work
  • -d downloads work
  • -s syncplay works
  • -q quality works
  • -v vlc works
  • -e select episode works
  • -S select index works
  • -r range selection works
  • --skip ani-skip works
  • --skip-title ani-skip title argument works
  • --no-detach no detach works
  • --dub and regular (sub) mode both work
  • all providers return links (not necessarily on a single anime, use debug mode to confirm)

  • -h help info is up to date
  • Readme is up to date
  • Man page is up to date

Additional Testcases

  • The safe bet: One Piece
  • Episode 0: Saenai Heroine no Sodatekata ♭
  • Unicode: Saenai Heroine no Sodatekata ♭
  • Non-whole episodes: Tensei shitara slime datta ken (ep. 24.5, ep. 24.9)

@HirschBerge
Copy link
Contributor

  check-no-awk:
    name: No Awk Allowed
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: verify that noone added awk
      run: '! grep awk "./ani-cli"'

awk is frowned upon. I would probably suggest cut something like uname -a | cut -d ' ' -f 1,3- at first blush does the job better even than awk since it doesn't leave two spaces in the output

@port19x
Copy link
Collaborator

port19x commented Oct 17, 2024

@HirschBerge is exactly right. We have a no awk policy over here

Copy link
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my suggestions for how to get rid of the awk dependency.

Your change itself is well reasoned and a good contribution

@VAISHAKH-GK
Copy link
Contributor Author

Thanks for the suggestion i will remove awk and will update the pull request

Copy link
Collaborator

@port19x port19x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the contrib 👑

@port19x port19x merged commit d82b787 into pystardust:master Oct 17, 2024
9 checks passed
@VAISHAKH-GK
Copy link
Contributor Author

thx for the contrib 👑

Happy to be helpful and thanks for the understanding

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

Successfully merging this pull request may close these issues.

3 participants