1
1
mirror of https://github.com/casey/just.git synced 2024-09-11 05:55:31 +03:00

Downgrade to TLS 1.2 in install script (#1536)

Revert "Update install script and readmes to use tls v1.3 (#1481)"

This reverts commit 9b6b0b7fac.
This commit is contained in:
Casey Rodarmor 2023-01-26 18:49:03 -08:00 committed by GitHub
parent baa2dfcc6f
commit a81b094441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 55 additions and 95 deletions

View File

@ -253,7 +253,7 @@ Pre-built binaries for Linux, MacOS, and Windows can be found on [the releases p
You can use the following command on Linux, MacOS, or Windows to download the latest release, just replace `DEST` with the directory where you'd like to put `just`:
```sh
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to DEST
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to DEST
```
For example, to install `just` to `~/bin`:
@ -263,7 +263,7 @@ For example, to install `just` to `~/bin`:
mkdir -p ~/bin
# download and extract just to ~/bin/just
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
# add `~/bin` to the paths that your shell searches for executables
# this line should be added to your shells initialization file,

View File

@ -251,7 +251,7 @@ Linux、MacOS 和 Windows 的预制二进制文件可以在 [发布页](https://
你也可以在 Linux、MacOS 或 Windows 上使用下面的命令来下载最新的版本,只需将 `DEST` 替换为你想安装 `just` 的目录即可:
```sh
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to DEST
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to DEST
```
例如,安装 `just``~/bin` 目录:
@ -261,7 +261,7 @@ curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -
mkdir -p ~/bin
# 下载并解压 just 到 ~/bin/just
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
# 在 Shell 搜索可执行文件的路径中添加`~/bin`
# 这一行应该被添加到你的 Shell 初始化文件中e.g. `~/.bashrc` 或者 `~/.zshrc`

View File

@ -183,7 +183,7 @@ fn main() -> Result {
)?;
}
fs::write(format!("{}/SUMMARY.md", src), summary).unwrap();
fs::write(format!("{src}/SUMMARY.md"), summary).unwrap();
}
Ok(())

View File

@ -19,7 +19,7 @@ fn main() {
};
eprintln!("ref: {}", arguments.reference);
eprintln!("value: {}", value);
eprintln!("value: {value}");
println!("::set-output name=value::{}", value);
println!("::set-output name=value::{value}");
}

View File

@ -4,11 +4,11 @@ use {
};
fn author(pr: u64) -> String {
eprintln!("#{}", pr);
eprintln!("#{pr}");
let output = Command::new("sh")
.args([
"-c",
&format!("gh pr view {} --json author | jq -r .author.login", pr),
&format!("gh pr view {pr} --json author | jq -r .author.login"),
])
.output()
.unwrap();

View File

@ -114,11 +114,7 @@ impl Display for CompileError<'_> {
)?;
}
DuplicateParameter { recipe, parameter } => {
write!(
f,
"Recipe `{}` has duplicate parameter `{}`",
recipe, parameter
)?;
write!(f, "Recipe `{recipe}` has duplicate parameter `{parameter}`")?;
}
DuplicateRecipe { recipe, first } => {
write!(
@ -187,9 +183,8 @@ impl Display for CompileError<'_> {
Internal { ref message } => {
write!(
f,
"Internal error, this may indicate a bug in just: {}\n\
consider filing an issue: https://github.com/casey/just/issues/new",
message
"Internal error, this may indicate a bug in just: {message}\n\
consider filing an issue: https://github.com/casey/just/issues/new"
)?;
}
InvalidEscapeSequence { character } => {
@ -232,8 +227,7 @@ impl Display for CompileError<'_> {
RequiredParameterFollowsDefaultParameter { parameter } => {
write!(
f,
"Non-default parameter `{}` follows default parameter",
parameter
"Non-default parameter `{parameter}` follows default parameter"
)?;
}
UndefinedVariable { variable } => {

View File

@ -279,26 +279,22 @@ impl<'src> ColorDisplay for Error<'src> {
match io_error.kind() {
io::ErrorKind::NotFound => write!(
f,
"Backtick could not be run because just could not find the shell:\n{}",
io_error
"Backtick could not be run because just could not find the shell:\n{io_error}"
),
io::ErrorKind::PermissionDenied => write!(
f,
"Backtick could not be run because just could not run the shell:\n{}",
io_error
"Backtick could not be run because just could not run the shell:\n{io_error}"
),
_ => write!(
f,
"Backtick could not be run because of an IO error while launching the shell:\n{}",
io_error
"Backtick could not be run because of an IO error while launching the shell:\n{io_error}"
),
}?;
}
OutputError::Utf8(utf8_error) => {
write!(
f,
"Backtick succeeded but stdout was not utf8: {}",
utf8_error
"Backtick succeeded but stdout was not utf8: {utf8_error}"
)?;
}
},
@ -356,8 +352,7 @@ impl<'src> ColorDisplay for Error<'src> {
if let Some(n) = line_number {
write!(
f,
"Recipe `{}` failed on line {} with exit code {}",
recipe, n, code
"Recipe `{recipe}` failed on line {n} with exit code {code}"
)?;
} else {
write!(f, "Recipe `{recipe}` failed with exit code {code}")?;
@ -404,40 +399,35 @@ impl<'src> ColorDisplay for Error<'src> {
OutputError::Code(code) => {
write!(
f,
"Cygpath failed with exit code {} while translating recipe `{}` shebang interpreter \
path",
code, recipe
"Cygpath failed with exit code {code} while translating recipe `{recipe}` shebang interpreter \
path"
)?;
}
OutputError::Signal(signal) => {
write!(
f,
"Cygpath terminated by signal {} while translating recipe `{}` shebang interpreter \
path",
signal, recipe
"Cygpath terminated by signal {signal} while translating recipe `{recipe}` shebang interpreter \
path"
)?;
}
OutputError::Unknown => {
write!(
f,
"Cygpath experienced an unknown failure while translating recipe `{}` shebang \
interpreter path",
recipe
"Cygpath experienced an unknown failure while translating recipe `{recipe}` shebang \
interpreter path"
)?;
}
OutputError::Io(io_error) => {
match io_error.kind() {
io::ErrorKind::NotFound => write!(
f,
"Could not find `cygpath` executable to translate recipe `{}` shebang interpreter \
path:\n{}",
recipe, io_error
"Could not find `cygpath` executable to translate recipe `{recipe}` shebang interpreter \
path:\n{io_error}"
),
io::ErrorKind::PermissionDenied => write!(
f,
"Could not run `cygpath` executable to translate recipe `{}` shebang interpreter \
path:\n{}",
recipe, io_error
"Could not run `cygpath` executable to translate recipe `{recipe}` shebang interpreter \
path:\n{io_error}"
),
_ => write!(f, "Could not run `cygpath` executable:\n{io_error}"),
}?;
@ -445,9 +435,8 @@ impl<'src> ColorDisplay for Error<'src> {
OutputError::Utf8(utf8_error) => {
write!(
f,
"Cygpath successfully translated recipe `{}` shebang interpreter path, but output was \
not utf8: {}",
recipe, utf8_error
"Cygpath successfully translated recipe `{recipe}` shebang interpreter path, but output was \
not utf8: {utf8_error}"
)?;
}
},
@ -517,9 +506,8 @@ impl<'src> ColorDisplay for Error<'src> {
Internal { message } => {
write!(
f,
"Internal runtime error, this may indicate a bug in just: {} \
consider filing an issue: https://github.com/casey/just/issues/new",
message
"Internal runtime error, this may indicate a bug in just: {message} \
consider filing an issue: https://github.com/casey/just/issues/new"
)?;
}
InvalidDirective { line } => {
@ -529,18 +517,15 @@ impl<'src> ColorDisplay for Error<'src> {
match io_error.kind() {
io::ErrorKind::NotFound => write!(
f,
"Recipe `{}` could not be run because just could not find the shell: {}",
recipe, io_error
"Recipe `{recipe}` could not be run because just could not find the shell: {io_error}"
),
io::ErrorKind::PermissionDenied => write!(
f,
"Recipe `{}` could not be run because just could not run the shell: {}",
recipe, io_error
"Recipe `{recipe}` could not be run because just could not run the shell: {io_error}"
),
_ => write!(
f,
"Recipe `{}` could not be run because of an IO error while launching the shell: {}",
recipe, io_error
"Recipe `{recipe}` could not be run because of an IO error while launching the shell: {io_error}"
),
}?;
}
@ -637,8 +622,7 @@ impl<'src> ColorDisplay for Error<'src> {
Unstable { message } => {
write!(
f,
"{} Invoke `just` with the `--unstable` flag to enable unstable features.",
message
"{message} Invoke `just` with the `--unstable` flag to enable unstable features."
)?;
}
WriteJustfile { justfile, io_error } => {

View File

@ -65,8 +65,7 @@ impl<'src> Display for Expression<'src> {
operator,
} => write!(
f,
"if {} {} {} {{ {} }} else {{ {} }}",
lhs, operator, rhs, then, otherwise
"if {lhs} {operator} {rhs} {{ {then} }} else {{ {otherwise} }}"
),
Expression::StringLiteral { string_literal } => write!(f, "{string_literal}"),
Expression::Variable { name } => write!(f, "{}", name.lexeme()),

View File

@ -121,8 +121,7 @@ fn env_var(context: &FunctionContext, key: &str) -> Result<String, String> {
match env::var(key) {
Err(NotPresent) => Err(format!("environment variable `{key}` not present")),
Err(NotUnicode(os_string)) => Err(format!(
"environment variable `{}` not unicode: {:?}",
key, os_string
"environment variable `{key}` not unicode: {os_string:?}"
)),
Ok(value) => Ok(value),
}
@ -142,8 +141,7 @@ fn env_var_or_default(
match env::var(key) {
Err(NotPresent) => Ok(default.to_owned()),
Err(NotUnicode(os_string)) => Err(format!(
"environment variable `{}` not unicode: {:?}",
key, os_string
"environment variable `{key}` not unicode: {os_string:?}"
)),
Ok(value) => Ok(value),
}

View File

@ -639,8 +639,7 @@ impl<'src> Lexer<'src> {
ParenR => self.close_delimiter(Paren)?,
_ => {
return Err(self.internal_error(format!(
"Lexer::lex_delimiter called with non-delimiter token: `{}`",
kind,
"Lexer::lex_delimiter called with non-delimiter token: `{kind}`",
)))
}
}

View File

@ -285,8 +285,7 @@ impl Subcommand {
Ok(())
} else {
Err(Error::internal(format!(
"Failed to find text:\n{}\n…in completion script:\n{}",
needle, haystack
"Failed to find text:\n{needle}\n…in completion script:\n{haystack}"
)))
}
}

View File

@ -70,8 +70,7 @@ impl<'src> ColorDisplay for Token<'src> {
if self.offset != self.src.len() {
write!(
f,
"internal error: Error has invalid line number: {}",
line_number
"internal error: Error has invalid line number: {line_number}"
)?;
}
}

View File

@ -31,12 +31,12 @@ test! {
error: The argument '--command <COMMAND>' requires a value but none was supplied
USAGE:
just{} --color <COLOR> --dump-format <FORMAT> --shell <SHELL> \
just{EXE_SUFFIX} --color <COLOR> --dump-format <FORMAT> --shell <SHELL> \
<--changelog|--choose|--command <COMMAND>|--completions <SHELL>|--dump|--edit|\
--evaluate|--fmt|--init|--list|--show <RECIPE>|--summary|--variables>
For more information try --help
", EXE_SUFFIX),
"),
status: EXIT_FAILURE,
}

View File

@ -413,7 +413,7 @@ test! {
fn assert_eval_eq(expression: &str, result: &str) {
Test::new()
.justfile(format!("x := {}", expression))
.justfile(format!("x := {expression}"))
.args(["--evaluate", "x"])
.stdout(result)
.unindent_stdout(false)

View File

@ -32,11 +32,11 @@ fn interrupt_test(arguments: &[&str], justfile: &str) {
let elapsed = start.elapsed();
if elapsed > Duration::from_secs(2) {
panic!("process returned too late: {:?}", elapsed);
panic!("process returned too late: {elapsed:?}");
}
if elapsed < Duration::from_millis(100) {
panic!("process returned too early : {:?}", elapsed);
panic!("process returned too early : {elapsed:?}");
}
assert_eq!(status.code(), Some(130));

View File

@ -62,25 +62,19 @@ fn test_invocation_directory() {
let status = output.status.code().unwrap();
if status != expected_status {
println!("bad status: {} != {}", status, expected_status);
println!("bad status: {status} != {expected_status}");
failure = true;
}
let stdout = str::from_utf8(&output.stdout).unwrap();
if stdout != expected_stdout {
println!(
"bad stdout:\ngot:\n{:?}\n\nexpected:\n{:?}",
stdout, expected_stdout
);
println!("bad stdout:\ngot:\n{stdout:?}\n\nexpected:\n{expected_stdout:?}");
failure = true;
}
let stderr = str::from_utf8(&output.stderr).unwrap();
if stderr != expected_stderr {
println!(
"bad stderr:\ngot:\n{:?}\n\nexpected:\n{:?}",
stderr, expected_stderr
);
println!("bad stderr:\ngot:\n{stderr:?}\n\nexpected:\n{expected_stderr:?}");
failure = true;
}

View File

@ -234,19 +234,13 @@ impl Test {
if let Some(ref stdout_regex) = self.stdout_regex {
if !stdout_regex.is_match(output_stdout) {
panic!(
"Stdout regex mismatch:\n{:?}\n!~=\n/{:?}/",
output_stderr, stdout_regex
);
panic!("Stdout regex mismatch:\n{output_stderr:?}\n!~=\n/{stdout_regex:?}/");
}
}
if let Some(ref stderr_regex) = self.stderr_regex {
if !stderr_regex.is_match(output_stderr) {
panic!(
"Stderr regex mismatch:\n{:?}\n!~=\n/{:?}/",
output_stderr, stderr_regex
);
panic!("Stderr regex mismatch:\n{output_stderr:?}\n!~=\n/{stderr_regex:?}/");
}
}

View File

@ -102,7 +102,7 @@ if [ -z ${dest-} ]; then
fi
if [ -z ${tag-} ]; then
tag=$(curl --proto =https --tlsv1.3 -sSf https://api.github.com/repos/casey/just/releases/latest |
tag=$(curl --proto =https --tlsv1.2 -sSf https://api.github.com/repos/casey/just/releases/latest |
grep tag_name |
cut -d'"' -f4
)
@ -147,10 +147,10 @@ td=$(mktemp -d || mktemp -d -t tmp)
if [ "$extension" = "zip" ]; then
# unzip on windows cannot always handle stdin, so download first.
curl --proto =https --tlsv1.3 -sSfL $archive > $td/just.zip
curl --proto =https --tlsv1.2 -sSfL $archive > $td/just.zip
unzip -d $td $td/just.zip
else
curl --proto =https --tlsv1.3 -sSfL $archive | tar -C $td -xz
curl --proto =https --tlsv1.2 -sSfL $archive | tar -C $td -xz
fi
for f in $(ls $td); do