diff --git a/.github/workflows/draft-release-automatic-trigger.yml b/.github/workflows/draft-release-automatic-trigger.yml index 24b45fc..c43d0eb 100644 --- a/.github/workflows/draft-release-automatic-trigger.yml +++ b/.github/workflows/draft-release-automatic-trigger.yml @@ -3,7 +3,7 @@ name: Automatic trigger draft release on: push: tags: - - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" jobs: call-workflow-build-artifacts-and-run-tests: diff --git a/CHANGELOG.md b/CHANGELOG.md index dd50ea8..a80d90c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,13 +18,17 @@ Categories Used: **Bullet points in chronological order by PR** -## [Unreleased](https://github.com/ouch-org/ouch/compare/0.6.0...HEAD) +## [Unreleased](https://github.com/ouch-org/ouch/compare/0.6.1...HEAD) ### New Features ### Improvements ### Bug Fixes ### Tweaks +## [0.6.1](https://github.com/ouch-org/ouch/compare/0.6.0...0.6.1) + +- Fix .zip crash when file mode isn't present [\#804](https://github.com/ouch-org/ouch/pull/804) ([marcospb19](https://github.com/marcospb19)) + ## [0.6.0](https://github.com/ouch-org/ouch/compare/0.5.1...0.6.0) ### New Features diff --git a/Cargo.lock b/Cargo.lock index 59bd16a..c95299d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1066,7 +1066,7 @@ checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "ouch" -version = "0.6.0" +version = "0.6.1" dependencies = [ "assert_cmd", "atty", diff --git a/Cargo.toml b/Cargo.toml index 1fe8b82..835e55f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ouch" -version = "0.6.0" +version = "0.6.1" authors = [ "João Marcos ", "Vinícius Rodrigues Miguel ", diff --git a/scripts/package-release-assets.sh b/scripts/package-release-assets.sh index 84d635e..621f28e 100755 --- a/scripts/package-release-assets.sh +++ b/scripts/package-release-assets.sh @@ -8,7 +8,7 @@ cd downloaded_artifacts echo "entered 'downloaded_artifacts/'" ls -lA -w 1 -TARGETS=( +PLATFORMS=( "aarch64-pc-windows-msvc" "aarch64-unknown-linux-gnu" "aarch64-unknown-linux-musl" @@ -20,42 +20,40 @@ TARGETS=( "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-musl" ) -# Temporary, we'll remove allow_piped_choice later +# TODO: remove allow_piped_choice later DEFAULT_FEATURES="allow_piped_choice+unrar+use_zlib+use_zstd_thin" -for target in "${TARGETS[@]}"; do - input_dir="ouch-${target}-${DEFAULT_FEATURES}" +for platform in "${PLATFORMS[@]}"; do + path="ouch-${platform}" + echo "Processing $path" - if [ ! -d "$input_dir" ]; then - echo "ERROR: Could not find artifact directory for $target with default features ($input_dir)" + if [ ! -d "${path}-${DEFAULT_FEATURES}" ]; then + echo "ERROR: Could not find artifact directory for $platform with default features ($path)" exit 1 fi + mv "${path}-${DEFAULT_FEATURES}" "$path" # remove the annoying suffix - echo "Processing $input_dir" + cp ../{README.md,LICENSE,CHANGELOG.md} "$path" + mkdir -p "$path/man" + mkdir -p "$path/completions" - cp ../{README.md,LICENSE,CHANGELOG.md} "$input_dir" - mkdir -p "$input_dir/man" - mkdir -p "$input_dir/completions" + mv "$path"/man-page-and-completions-artifacts/*.1 "$path/man" + mv "$path"/man-page-and-completions-artifacts/* "$path/completions" + rm -r "$path/man-page-and-completions-artifacts" - mv "$input_dir"/man-page-and-completions-artifacts/*.1 "$input_dir/man" - mv "$input_dir"/man-page-and-completions-artifacts/* "$input_dir/completions" - rm -r "$input_dir/man-page-and-completions-artifacts" + if [[ "$platform" == *"-windows-"* ]]; then + mv "$path/target/$platform/release/ouch.exe" "$path" + rm -rf "$path/target" - output_name="ouch-${target}" - - if [[ "$target" == *"-windows-"* ]]; then - mv "$input_dir/target/$target/release/ouch.exe" "$input_dir" - rm -rf "$input_dir/target" - - zip -r "../output_assets/${output_name}.zip" "$input_dir" - echo "Created output_assets/${output_name}.zip" + zip -r "../output_assets/${path}.zip" "$path" + echo "Created output_assets/${path}.zip" else - mv "$input_dir/target/$target/release/ouch" "$input_dir" - rm -rf "$input_dir/target" - chmod +x "$input_dir/ouch" + mv "$path/target/$platform/release/ouch" "$path" + rm -rf "$path/target" + chmod +x "$path/ouch" - tar czf "../output_assets/${output_name}.tar.gz" "$input_dir" - echo "Created output_assets/${output_name}.tar.gz" + tar czf "../output_assets/${path}.tar.gz" "$path" + echo "Created output_assets/${path}.tar.gz" fi done diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 52d16f3..28546a1 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -83,10 +83,8 @@ where )); } - let mode = file.unix_mode().ok_or_else(|| { - std::io::Error::new(std::io::ErrorKind::InvalidData, "Cannot extract file's mode") - })?; - let is_symlink = (mode & 0o170000) == 0o120000; + let mode = file.unix_mode(); + let is_symlink = mode.is_some_and(|mode| mode & 0o170000 == 0o120000); if is_symlink { let mut target = String::new();