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

Keep export.sh Bourne Shell compatible (IDFGH-11073) #12247

Merged
merged 1 commit into from
Oct 9, 2023
Merged

Keep export.sh Bourne Shell compatible (IDFGH-11073) #12247

merged 1 commit into from
Oct 9, 2023

Conversation

panduit-mik
Copy link
Contributor

The '[[' operator is not supported by /bin/sh
Use '[' instead to keep it compatible.

@CLAassistant
Copy link

CLAassistant commented Sep 14, 2023

CLA assistant check
All committers have signed the CLA.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 14, 2023
@github-actions github-actions bot changed the title Keep export.sh Bourne Shell compatible Keep export.sh Bourne Shell compatible (IDFGH-11073) Sep 14, 2023
@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Sep 22, 2023
@mfialaf
Copy link
Collaborator

mfialaf commented Sep 22, 2023

Hi @panduit-mik ,

Thank you for your contribution.
I've tried your suggestion, and it won't work. The double square brackets with == and * are used for string comparison. Your suggestion would work without the * in the end, but this quantifier serves the same as in regular expressions, so $OSTYPE names like darwin18.7.0 would also pass the condition.

In addition, $OSTYPE is not recognized by the original Bourne shell, so it would not fix your problem.

Please use newer shells like bash, dash, zsh etc..

Let me know, if you find better working solution.

@panduit-mik
Copy link
Contributor Author

panduit-mik commented Sep 22, 2023

Some build environments (like yocto), use bourne shell for widest compatibility which is why it would be better to continue to keep this script bourne shell compatible.
To get the equivalent pattern match in bourne shell:

if [ "${OSTYPE##darwin}" != "${OSTYPE}" ]; then

Note also that $OSTYPE is also not recognized by dash on some platforms
On MacOS, /bin/sh defines $OSTYPE so at least for this case of checking for MacOS, that will work

But uname is really the best most portable way to differentiate Unix OS flavors.

if [ `uname -s` = "Darwin" ];

@mfialaf
Copy link
Collaborator

mfialaf commented Sep 26, 2023

@panduit-mik Could you update this pull request in accordance with your latest comment? This will enable me to carry out testing and proceed with the merge.

If not, we will close this pull request and revisit your changes at a later time.

@github-actions
Copy link

github-actions bot commented Sep 26, 2023

Warnings
⚠️ The PR description looks very brief, please check if more details can be added.

👋 Welcome panduit-mik, thank you for your first contribution to espressif/esp-idf project!

📘 Please check Contributions Guide for the contribution checklist, information regarding code and documentation style, testing and other topics.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for espressif/esp-idf project.

Pull request review and merge process you can expect

Espressif develops the ESP-IDF project in an internal repository (Gitlab). We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved, we synchronize it into our internal git repository
  4. In the internal git repository we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  5. If the change is approved and passes the tests it is merged into the master branch
  6. On next sync from the internal git repository merged change will appear in this public Github repository

🔁 You can re-run automatic PR checks by retrying the DangerJS action

Generated by 🚫 dangerJS against c4da3d4

@mfialaf
Copy link
Collaborator

mfialaf commented Sep 26, 2023

@panduit-mik Thank you!

And last, please squash all commits into one since it is one change.
Thanks for the contribution.

@espressif-bot espressif-bot added Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable Resolution: Done Issue is done internally and removed Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Oct 3, 2023
@espressif-bot espressif-bot merged commit c4da3d4 into espressif:master Oct 9, 2023
7 checks passed
espressif-bot pushed a commit that referenced this pull request Oct 9, 2023
@panduit-mik panduit-mik deleted the exportBourneShellCompatible branch October 9, 2023 11:36
movsb pushed a commit to movsb/esp-idf that referenced this pull request Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants