From a81b0944415816d74c996c401168d4204e8d02b5 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Thu, 26 Jan 2023 18:49:03 -0800 Subject: [PATCH] Downgrade to TLS 1.2 in install script (#1536) Revert "Update install script and readmes to use tls v1.3 (#1481)" This reverts commit 9b6b0b7facf3e50a6cec9a82d0bd0eab8ce1e03e. --- README.md | 4 +- README.中文.md | 4 +- bin/generate-book/src/main.rs | 2 +- bin/ref-type/src/main.rs | 4 +- bin/update-contributors/src/main.rs | 4 +- src/compile_error.rs | 14 ++----- src/error.rs | 62 +++++++++++------------------ src/expression.rs | 3 +- src/function.rs | 6 +-- src/lexer.rs | 3 +- src/subcommand.rs | 3 +- src/token.rs | 3 +- tests/command.rs | 4 +- tests/functions.rs | 2 +- tests/interrupts.rs | 4 +- tests/invocation_directory.rs | 12 ++---- tests/test.rs | 10 +---- www/install.sh | 6 +-- 18 files changed, 55 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index e03591f..b06f6f1 100644 --- a/README.md +++ b/README.md @@ -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, diff --git a/README.中文.md b/README.中文.md index 54ed0f0..37b005b 100644 --- a/README.中文.md +++ b/README.中文.md @@ -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`: diff --git a/bin/generate-book/src/main.rs b/bin/generate-book/src/main.rs index 3076f20..51d7ceb 100644 --- a/bin/generate-book/src/main.rs +++ b/bin/generate-book/src/main.rs @@ -183,7 +183,7 @@ fn main() -> Result { )?; } - fs::write(format!("{}/SUMMARY.md", src), summary).unwrap(); + fs::write(format!("{src}/SUMMARY.md"), summary).unwrap(); } Ok(()) diff --git a/bin/ref-type/src/main.rs b/bin/ref-type/src/main.rs index f0e6407..aafd66c 100644 --- a/bin/ref-type/src/main.rs +++ b/bin/ref-type/src/main.rs @@ -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}"); } diff --git a/bin/update-contributors/src/main.rs b/bin/update-contributors/src/main.rs index 0027412..2c95792 100644 --- a/bin/update-contributors/src/main.rs +++ b/bin/update-contributors/src/main.rs @@ -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(); diff --git a/src/compile_error.rs b/src/compile_error.rs index 5a90b52..cc81d7d 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -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 } => { diff --git a/src/error.rs b/src/error.rs index 54bebc8..413076d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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 } => { diff --git a/src/expression.rs b/src/expression.rs index f7e9598..58f1441 100644 --- a/src/expression.rs +++ b/src/expression.rs @@ -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()), diff --git a/src/function.rs b/src/function.rs index 768db98..e646efb 100644 --- a/src/function.rs +++ b/src/function.rs @@ -121,8 +121,7 @@ fn env_var(context: &FunctionContext, key: &str) -> Result { 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), } diff --git a/src/lexer.rs b/src/lexer.rs index 899fc71..ebc04e5 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -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}`", ))) } } diff --git a/src/subcommand.rs b/src/subcommand.rs index e95a3fe..0dbaaed 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -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}" ))) } } diff --git a/src/token.rs b/src/token.rs index af4f818..3a339c4 100644 --- a/src/token.rs +++ b/src/token.rs @@ -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}" )?; } } diff --git a/tests/command.rs b/tests/command.rs index 6080e66..0529958 100644 --- a/tests/command.rs +++ b/tests/command.rs @@ -31,12 +31,12 @@ test! { error: The argument '--command ' requires a value but none was supplied USAGE: - just{} --color --dump-format --shell \ + just{EXE_SUFFIX} --color --dump-format --shell \ <--changelog|--choose|--command |--completions |--dump|--edit|\ --evaluate|--fmt|--init|--list|--show |--summary|--variables> For more information try --help - ", EXE_SUFFIX), + "), status: EXIT_FAILURE, } diff --git a/tests/functions.rs b/tests/functions.rs index 14ec4e2..4503243 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -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) diff --git a/tests/interrupts.rs b/tests/interrupts.rs index 4abe82c..6df78c2 100644 --- a/tests/interrupts.rs +++ b/tests/interrupts.rs @@ -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)); diff --git a/tests/invocation_directory.rs b/tests/invocation_directory.rs index 58b4609..b62790e 100644 --- a/tests/invocation_directory.rs +++ b/tests/invocation_directory.rs @@ -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; } diff --git a/tests/test.rs b/tests/test.rs index 1963b8f..dabb520 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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:?}/"); } } diff --git a/www/install.sh b/www/install.sh index 418c6f1..f932554 100755 --- a/www/install.sh +++ b/www/install.sh @@ -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