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

Improve download-latest.sh to return error when is using MUSL or bionic C library #4386

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mathias-vandaele
Copy link

Adapt the script to terminate on error in case the system is using bionic or MUSL

Pull Request

Related issue

Fixes #4379

What does this PR do?

  • It adds a function that retrieve the C library host system is using.
  • For now only check with bionic, glibc and musl , with glibc being the only one working

PR checklist

Please check if your PR fulfills the following requirements:

  • [ x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • [x ] Have you read the contributing guidelines?
  • [ x] Have you made sure that the title is accurate and descriptive of the changes?

If there is anything you want me to rework on, just let me know!

adapt the script to terminate on error in case the system is using bionic or MUSL
@curquiza curquiza self-requested a review February 5, 2024 09:12
@curquiza curquiza changed the title Issue 4379: correct download-latest.sh to make it return error when system is using MUSL or bionic C library Improve download-latest.sh to return error when is using MUSL or bionic C library Feb 5, 2024
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Hello @mathias-vandaele

thank you very much for this PR, I will test it soon

Before I test it, can you ensure we display the workarounds to users when getting the error?
The possible workarounds are compiling from the source files or using the Docker image (https://www.meilisearch.com/docs/learn/getting_started/installation#local-installation)

download-latest.sh Outdated Show resolved Hide resolved
@mathias-vandaele
Copy link
Author

Hi @curquiza,

I will do it later this evening

@curquiza curquiza self-requested a review February 13, 2024 10:44
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Hello @mathias-vandaele

On my mac I got the following errors (before downloading correctly the binary)

Capture d’écran 2024-02-14 à 18 38 35

@curquiza
Copy link
Member

And on Alpine I get a lot of necessary logs + I get a message saying the binary is downloaded + the binary is downloaded (but does not work, of course, as expected)

Capture d’écran 2024-02-15 à 12 38 07

@mathias-vandaele
Copy link
Author

@curquiza I will correct it.

@mathias-vandaele mathias-vandaele force-pushed the enhancement-4379-script-correction-when-musl-present branch from e09f80f to 9cd4378 Compare February 26, 2024 19:59
@mathias-vandaele
Copy link
Author

mathias-vandaele commented Feb 26, 2024

Hey @curquiza
It should be ok now, let me know if there is anything else to be done

Linux (POP OS)

image

Linux (Alpine)

image

MAC OS

image

@curquiza
Copy link
Member

Hello @mathias-vandaele
I try to review this next week. But I don't forget you 😊

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Thank you for the improvement

Can you remove the useless commands output?

Capture d’écran 2024-03-07 à 14 18 29

You can use &> /dev/null

Comment on lines +86 to +89
else
return 1
fi
return 0
Copy link
Member

Choose a reason for hiding this comment

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

we will never reach the final return 0 because of the else return 1, so let's replace it by return 1

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
else
return 1
fi
return 0
fi
return 1

c_lib='glibc'
return 0
elif ldd --version | grep -qi musl; then
c_library_failure_usage
Copy link
Member

Choose a reason for hiding this comment

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

you already display the failure usage in the function in main, so don't display it here.

c_lib='glibc'
return 0
elif ldd --version | grep -qi musl; then
c_library_failure_usage
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
c_library_failure_usage

c_library_failure_usage
return 1
elif ldd --version | grep -qi bionic; then
c_library_failure_usage
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
c_library_failure_usage

@@ -65,6 +65,30 @@ get_os() {
return 0
}

# Gets the C lib the system is using by setting the $c_lib variable.
Copy link
Member

Choose a reason for hiding this comment

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

we don't use $c_lib in the script, so no point in storing it.
Can you remove it?

download-latest.sh Outdated Show resolved Hide resolved
@mathias-vandaele
Copy link
Author

Thank you for coming back to me,
getting on it

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.

download-latest.sh: return an error when the musl C library is present on the machine
2 participants