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`: 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 ```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`: For example, to install `just` to `~/bin`:
@ -263,7 +263,7 @@ For example, to install `just` to `~/bin`:
mkdir -p ~/bin mkdir -p ~/bin
# download and extract just to ~/bin/just # 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 # add `~/bin` to the paths that your shell searches for executables
# this line should be added to your shells initialization file, # 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` 的目录即可: 你也可以在 Linux、MacOS 或 Windows 上使用下面的命令来下载最新的版本,只需将 `DEST` 替换为你想安装 `just` 的目录即可:
```sh ```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` 目录: 例如,安装 `just``~/bin` 目录:
@ -261,7 +261,7 @@ curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -
mkdir -p ~/bin mkdir -p ~/bin
# 下载并解压 just 到 ~/bin/just # 下载并解压 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 搜索可执行文件的路径中添加`~/bin`
# 这一行应该被添加到你的 Shell 初始化文件中e.g. `~/.bashrc` 或者 `~/.zshrc` # 这一行应该被添加到你的 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(()) Ok(())

View File

@ -19,7 +19,7 @@ fn main() {
}; };
eprintln!("ref: {}", arguments.reference); 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 { fn author(pr: u64) -> String {
eprintln!("#{}", pr); eprintln!("#{pr}");
let output = Command::new("sh") let output = Command::new("sh")
.args([ .args([
"-c", "-c",
&format!("gh pr view {} --json author | jq -r .author.login", pr), &format!("gh pr view {pr} --json author | jq -r .author.login"),
]) ])
.output() .output()
.unwrap(); .unwrap();

View File

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

View File

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

View File

@ -65,8 +65,7 @@ impl<'src> Display for Expression<'src> {
operator, operator,
} => write!( } => write!(
f, f,
"if {} {} {} {{ {} }} else {{ {} }}", "if {lhs} {operator} {rhs} {{ {then} }} else {{ {otherwise} }}"
lhs, operator, rhs, then, otherwise
), ),
Expression::StringLiteral { string_literal } => write!(f, "{string_literal}"), Expression::StringLiteral { string_literal } => write!(f, "{string_literal}"),
Expression::Variable { name } => write!(f, "{}", name.lexeme()), 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) { match env::var(key) {
Err(NotPresent) => Err(format!("environment variable `{key}` not present")), Err(NotPresent) => Err(format!("environment variable `{key}` not present")),
Err(NotUnicode(os_string)) => Err(format!( Err(NotUnicode(os_string)) => Err(format!(
"environment variable `{}` not unicode: {:?}", "environment variable `{key}` not unicode: {os_string:?}"
key, os_string
)), )),
Ok(value) => Ok(value), Ok(value) => Ok(value),
} }
@ -142,8 +141,7 @@ fn env_var_or_default(
match env::var(key) { match env::var(key) {
Err(NotPresent) => Ok(default.to_owned()), Err(NotPresent) => Ok(default.to_owned()),
Err(NotUnicode(os_string)) => Err(format!( Err(NotUnicode(os_string)) => Err(format!(
"environment variable `{}` not unicode: {:?}", "environment variable `{key}` not unicode: {os_string:?}"
key, os_string
)), )),
Ok(value) => Ok(value), Ok(value) => Ok(value),
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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