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

sed command in helper scripts breaks on some platforms #301

Closed
ckadner opened this issue Feb 16, 2022 · 2 comments
Closed

sed command in helper scripts breaks on some platforms #301

ckadner opened this issue Feb 16, 2022 · 2 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ckadner
Copy link
Member

ckadner commented Feb 16, 2022

The sed command is used in many of our helper scripts. However sed preinstalled on macOS is not POSIX compliant (works differently than on most Linux distributions). But testing for the OS on which the script is being run on is not a good proxy to find out which version of sed is going to be available since macOS users can easily reinstall it (Homebrew, symlink, ...). On top of that, some Bash emulators used on Windows do not present as an operating system.

We need to replace this test for specific operating systems (or specific Bash emulator):

if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
alias gsed="sed -i"
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
alias gsed="sed -i ''"
elif [[ "$OSTYPE" == "cygwin" ]]; then # POSIX compatible emulation for Windows
alias gsed="sed -i"
elif [[ "$OSTYPE" == "msys"* ]]; then # Git Bash (Windows)
alias gsed="sed -i"
else
echo "FAILED. OS not compatible with script '${BASH_SOURCE[0]}'"
exit 1
fi
export gsed

With this more generic test:

if ! sed -i '1s/^/test/' $(mktemp) 2> /dev/null; then
    # macOS (BSD) version of sed
    alias gsed="sed -i ''" 
else
    # POSIX compliant version of sed 
    alias gsed="sed -i"
fi

sed is used in various script in the mlx and katalog repo where the platform check needs to be replaced:

  • in the mlx repo:
    • mlx/api/codegen.sh
    • mlx/tools/bash/add_license_headers.sh
  • in the katalog repo:
    • katalog/tools/bash/upgrade_notebook_requirements.sh
    • katalog/tools/bash/add_license_headers.sh
@ckadner ckadner added good first issue Good for newcomers help wanted Extra attention is needed labels Feb 16, 2022
@krishnakumar27
Copy link
Contributor

@ckadner I can look into this..

@ckadner
Copy link
Member Author

ckadner commented Feb 22, 2022

Thanks @krishnakumar27 -- let me know if you need more information

mlx-bot-app bot pushed a commit that referenced this issue Oct 28, 2022
* Add dev doc links to CONTRIBUTING.md (#312)

Resolves a task from #304

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

* Fixes the references to latest kfctl release (#311)

Resolves a task from #304

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

* Do not verify links in project dependencies (#320)

Resolves #319

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>

* Add navigation and description table of docs (#314)

* Create readme for docs
* Add description table to readme
* Add links to table
* update relative links
* Change documentation to document

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

* Add script to update the docs table  (#317)


Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

* Modified the way sed version is set (#315)

Instead of checking the operating system or shell emulator,
test which version of `sed` is actually installed in the local
environment.

Resolves #301

Signed-off-by: Krishna Kumar <krishnakumar@ibm.com>

* Bump waitress from 2.0.0 to 2.1.1 in /api/server (#321)

Bumps [waitress](https://github.com/Pylons/waitress) from 2.0.0 to 2.1.1.
- [Release notes](https://github.com/Pylons/waitress/releases)
- [Changelog](https://github.com/Pylons/waitress/blob/master/CHANGES.txt)
- [Commits](Pylons/waitress@v2.0.0...v2.1.1)

---
updated-dependencies:
- dependency-name: waitress
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump jupyter-server from 1.13.4 to 1.15.4 in /api/server (#324)

Bumps [jupyter-server](https://github.com/jupyter/jupyter_server) from 1.13.4 to 1.15.4.
- [Release notes](https://github.com/jupyter/jupyter_server/releases)
- [Changelog](https://github.com/jupyter-server/jupyter_server/blob/main/CHANGELOG.md)
- [Commits](jupyter-server/jupyter_server@v1.13.4...v1.15.4)

---
updated-dependencies:
- dependency-name: jupyter-server
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump minimist from 1.2.5 to 1.2.6 in /dashboard/origin-mlx (#326)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump notebook from 6.4.8 to 6.4.10 in /api/server (#327)

Bumps [notebook](http://jupyter.org) from 6.4.8 to 6.4.10.

---
updated-dependencies:
- dependency-name: notebook
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update API developer docs (#325)

* Add codegen workflow diagram
* Describe codegen workflow
* Describe API server package modules

Closes #325

Signed-off-by: Pavan Pss <psspavan96@gmail.com>

Co-authored-by: Christian Kadner <ckadner@us.ibm.com>

* Update UI developer docs (#323)

Closes #323

Signed-off-by: RRM123 <rithikmamidi@gmail.com>

* Correct description for make update_doc_table (#329)

Signed-off-by: ezinneanne <onwukaezinneanne@gmail.com>

* Update Kubernetes high version in deployment docs (#318) (#332)

* Add Troubleshooting section
* Limit K8s version for KIND cluster using `--image` flag

Resolves #318

Signed-off-by: Kiran-Patel <kiran.patel@ibm.com>
Signed-off-by: Kiran Patel 104844270+kiranp2396@users.noreply.github.com
Signed-off-by: Christian Kadner <ckadner@us.ibm.com>

Co-authored-by: Kiran-Patel <kiran.patel@ibm.com>
Co-authored-by: Christian Kadner <ckadner@us.ibm.com>

* fix errors in mlx-ui startup (#338)

* Run mlx-ui as non-root user (#339)

Closes #337

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>

* Update MLX setup instructions for KF 1.5 (#346)

* Update MLX setup instructions for KF 1.5

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>

* fix selected assets show up in different menus (#342)

Signed-off-by: Jiaxuan-Yang <jiaxuan.yang@ibm.com>

* Consolidate readme (#356)

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>
Co-authored-by: Rafael Vasquez <rafael.vasquez@ryerson.com>

* Document MLX Models Workshop (#352)

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>

* Add GitHub action to verify doc links (#357)

Signed-off-by: Rafael Vasquez <raf.vasquez@ibm.com>

Signed-off-by: Rafael Vasquez <rafael.vasquez@ryerson.com>
Signed-off-by: Christian Kadner <ckadner@us.ibm.com>
Signed-off-by: Krishna Kumar <krishnakumar@ibm.com>
Signed-off-by: RRM123 <rithikmamidi@gmail.com>
Signed-off-by: ezinneanne <onwukaezinneanne@gmail.com>
Signed-off-by: Jiaxuan-Yang <jiaxuan.yang@ibm.com>
Signed-off-by: Rafael Vasquez <raf.vasquez@ibm.com>
Co-authored-by: Rafael Vasquez <rafael.vasquez@ryerson.ca>
Co-authored-by: Krishna Kumar Ramachandran <krishnakumar@gatech.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pavan Pss <psspavan96@gmail.com>
Co-authored-by: RRM123 <40575227+rrm123@users.noreply.github.com>
Co-authored-by: Ezinne Anne Emilia <onwukaezinneanne@gmail.com>
Co-authored-by: Kiran Patel <104844270+kiranp2396@users.noreply.github.com>
Co-authored-by: Kiran-Patel <kiran.patel@ibm.com>
Co-authored-by: jbusche <101845348+jbusche@users.noreply.github.com>
Co-authored-by: Joanna <Jiaxuan.Yang@ibm.com>
Co-authored-by: Rafael Vasquez <rafael.vasquez@ryerson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants