Comments (3)
@vasucp1207 can confirm but based on what I saw in the comments I am almost certain they are on Mac OS, which ships an ancient version of Bash by default (3.something, apparently for GPL-avoidance reasons) as well as BSD flavors of command line tools which differ from GNU versions. The missing Cargo.toml is likely due to a difference in sed
behavior between Mac and GNU, https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
Writing reliable cross-platform scripts can be a rather tedious rabbit hole to dive into but there are some easy things we can do without going too deep.
-
The
#!/usr/bin/env bash
at the top of the scripts should ensure that some version of bash is running the scripts so I don't think we need to worry about non-bash shells (zsh/fish/nushell etc) unless users go out of their way, e.g.zsh some_script.sh
instead of./some_script.sh
. -
Adding a check for Bash version 4+ is simple, basically checking that
$BASH_VERSION
exists and that${BASH_VERSINFO[0]} -ge 4
. This should also catch any non-bash shells too since they would not set those variables. -
The real tedium comes from trying to ensure that every external tool is installed and supports the required features. I took a brief look into the scripts directory and see
grep
,sort
,curl
,jq
, and of coursesed
. There may be more I missed. Not sure this level of effort is worth it for development-only scripts. Perhaps an easier approach would be to document in the Contributing guide that the scripts expect updated bash + a list of the required external programs.
from cargo-semver-checks.
Great points! If you have a few minutes, would you care to open some PRs for the bash version check and the contributing guide suggestions? I'd be thrilled to merge them.
from cargo-semver-checks.
#681 mostly addressed this — thank you @jw013! The only open question remaining is if we can do something about our incompatible use of sed
.
If I correctly understand the suggested fix at the link you shared, it seems like we might be able to make a copy of the files we intend to edit with sed
and apply our change to the copy? Perhaps we make the copy reside in /tmp
somewhere, so that a failure of the script won't pollute the git repo?
This is a bit hard for me to test since I don't have a Mac, so I'd love some help. If neither of you @jw013 and @vasucp1207 is up for trying a PR, I can try to whip something up next weekend if I have a bit of time.
from cargo-semver-checks.
Related Issues (20)
- Verbose runs should show which features were enabled in the crate versions being tested HOT 4
- Unable to enable dependency's features needed to build the crate HOT 6
- Build failure repro command may include `--features` flag without any features
- Support flags like `--color=always` and `--color=never`
- Improve error message when no library targets are found HOT 1
- Consider switching to `anstyle` for our terminal styling and color needs HOT 8
- Check if trait items with defaults may need special handling to avoid false-positives HOT 5
- Make the `make_new_lint.sh` script avoid merge conflicts when registering the new lints
- Consider either testing that lint file names match their `id` fields, or removing the field entirely.
- Add "Media coverage" section to the README, with relevant talks, podcasts, blog posts, etc.
- Support [term] configuration in Cargo config.toml for color and logging HOT 3
- `RustdocCommand` progress (when `silence` is `false`) does not respect configured `stderr`
- Check lints related to trait implementations for false-positives if the trait impl is `#[doc(hidden)]`
- Configuration methods do not have consistent naming HOT 3
- Refine lints about field and method removals to account for `Deref/DerefMut`
- `cargo semver-checks` takes much longer after upgrading to version 0.30.0 from 0.24.1 HOT 2
- Breakage related to `where Self: Sized` bounds on trait associated types and methods HOT 6
- Fail if crates.io has the same version as in Cargo.toml HOT 5
- Breakage caused by precise capturing (RFC 3617) HOT 1
- Breakage caused by refined impls (RFC 3245, RFC 3425)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-semver-checks.