mirror of
https://github.com/uutils/diffutils.git
synced 2026-06-10 15:48:59 -07:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc9ca179f3 | |||
| f29e96cdba | |||
| a46dae68b1 | |||
| 1a8d7f96a6 | |||
| 53599ccd40 | |||
| 9bc64f03ed | |||
| d266f9b90e | |||
| ec3428b48f | |||
| 58da229c09 |
@@ -69,7 +69,7 @@ jobs:
|
||||
TERM: xterm
|
||||
|
||||
- name: Upload full json results
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: diffutils-gnu-full-result
|
||||
path: tests/test-results.json
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
if_no_artifact_found: warn
|
||||
|
||||
- name: Download full json results
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: diffutils-gnu-full-result
|
||||
path: results
|
||||
@@ -155,13 +155,13 @@ jobs:
|
||||
outputs HASH TOTAL PASS FAIL SKIP
|
||||
|
||||
- name: Upload SHA1/ID of 'test-summary'
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "${{ steps.summary.outputs.HASH }}"
|
||||
path: "${{ steps.vars.outputs.TEST_SUMMARY_FILE }}"
|
||||
|
||||
- name: Upload test results summary
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-summary
|
||||
path: "${{ steps.vars.outputs.TEST_SUMMARY_FILE }}"
|
||||
@@ -209,7 +209,7 @@ jobs:
|
||||
|
||||
- name: Upload comparison log (for GnuComment workflow)
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: comment
|
||||
path: reference/comment/
|
||||
|
||||
@@ -31,7 +31,6 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install gpatch
|
||||
echo "/opt/homebrew/opt/gpatch/libexec/gnubin" >> "$GITHUB_PATH"
|
||||
- name: set up PATH on Windows
|
||||
# Needed to use GNU's patch.exe instead of Strawberry Perl patch
|
||||
if: runner.os == 'Windows'
|
||||
@@ -85,7 +84,6 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install gpatch
|
||||
echo "/opt/homebrew/opt/gpatch/libexec/gnubin" >> "$GITHUB_PATH"
|
||||
- name: set up PATH on Windows
|
||||
# Needed to use GNU's patch.exe instead of Strawberry Perl patch
|
||||
if: runner.os == 'Windows'
|
||||
@@ -129,7 +127,7 @@ jobs:
|
||||
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --binary-path "${COVERAGE_REPORT_DIR}" --branch
|
||||
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
|
||||
- name: Upload coverage results (to Codecov.io)
|
||||
uses: codecov/codecov-action@v6
|
||||
uses: codecov/codecov-action@v7
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ${{ steps.coverage.outputs.report }}
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
shell: bash
|
||||
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh"
|
||||
- name: Cache dist
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/dist
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
cat plan-dist-manifest.json
|
||||
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||
- name: "Upload dist-manifest.json"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-plan-dist-manifest
|
||||
path: plan-dist-manifest.json
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
run: ${{ matrix.install_dist.run }}
|
||||
# Get the dist-manifest
|
||||
- name: Fetch local artifacts
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
@@ -158,7 +158,7 @@ jobs:
|
||||
|
||||
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
|
||||
path: |
|
||||
@@ -180,14 +180,14 @@ jobs:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Install cached dist
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/
|
||||
- run: chmod +x ~/.cargo/bin/dist
|
||||
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
|
||||
- name: Fetch local artifacts
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
|
||||
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-build-global
|
||||
path: |
|
||||
@@ -230,14 +230,14 @@ jobs:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Install cached dist
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/
|
||||
- run: chmod +x ~/.cargo/bin/dist
|
||||
# Fetch artifacts from scratch-storage
|
||||
- name: Fetch artifacts
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
@@ -250,14 +250,14 @@ jobs:
|
||||
cat dist-manifest.json
|
||||
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||
- name: "Upload dist-manifest.json"
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Overwrite the previous copy
|
||||
name: artifacts-dist-manifest
|
||||
path: dist-manifest.json
|
||||
# Create a GitHub Release while uploading all files to it
|
||||
- name: "Download GitHub Artifacts"
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: artifacts
|
||||
|
||||
Generated
+6
-6
@@ -120,9 +120,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.44"
|
||||
version = "0.4.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
|
||||
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
@@ -628,9 +628,9 @@ checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.3"
|
||||
version = "1.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
|
||||
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -657,9 +657,9 @@ checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.10"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
||||
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
|
||||
Generated
+2
-2
@@ -169,9 +169,9 @@ checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
version = "0.4.12"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d"
|
||||
checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"cc",
|
||||
|
||||
+12
-40
@@ -71,9 +71,7 @@ fn is_stdout_dev_null() -> bool {
|
||||
}
|
||||
|
||||
pub fn parse_params<I: Iterator<Item = OsString>>(mut opts: Peekable<I>) -> Result<Params, String> {
|
||||
let Some(executable) = opts.next() else {
|
||||
return Err("Usage: <exe> <from> <to>".to_string());
|
||||
};
|
||||
let executable = opts.next().ok_or("Usage: <exe> <from> <to>".to_string())?;
|
||||
let executable_str = executable.to_string_lossy().to_string();
|
||||
|
||||
let parse_skip = |param: &str, skip_desc: &str| -> Result<SkipU64, String> {
|
||||
@@ -293,27 +291,15 @@ fn prepare_reader(
|
||||
let mut reader: Box<dyn BufRead> = if path == "-" {
|
||||
Box::new(BufReader::new(io::stdin()))
|
||||
} else {
|
||||
match fs::File::open(path) {
|
||||
Ok(file) => Box::new(BufReader::new(file)),
|
||||
Err(e) => {
|
||||
return Err(format_failure_to_read_input_file(
|
||||
¶ms.executable,
|
||||
path,
|
||||
&e,
|
||||
));
|
||||
}
|
||||
}
|
||||
let file = fs::File::open(path)
|
||||
.map_err(|e| format_failure_to_read_input_file(¶ms.executable, path, &e))?;
|
||||
Box::new(BufReader::new(file))
|
||||
};
|
||||
|
||||
if let Some(skip) = skip {
|
||||
// cast as u64 must remain, because value of IgnInit data type could be changed.
|
||||
if let Err(e) = io::copy(&mut reader.by_ref().take(*skip), &mut io::sink()) {
|
||||
return Err(format_failure_to_read_input_file(
|
||||
¶ms.executable,
|
||||
path,
|
||||
&e,
|
||||
));
|
||||
}
|
||||
io::copy(&mut reader.by_ref().take(*skip), &mut io::sink())
|
||||
.map_err(|e| format_failure_to_read_input_file(¶ms.executable, path, &e))?;
|
||||
}
|
||||
|
||||
Ok(reader)
|
||||
@@ -360,27 +346,13 @@ pub fn cmp(params: &Params) -> Result<Cmp, String> {
|
||||
let mut compare = Cmp::Equal;
|
||||
loop {
|
||||
// Fill up our buffers.
|
||||
let from_buf = match from.fill_buf() {
|
||||
Ok(buf) => buf,
|
||||
Err(e) => {
|
||||
return Err(format_failure_to_read_input_file(
|
||||
¶ms.executable,
|
||||
¶ms.from,
|
||||
&e,
|
||||
));
|
||||
}
|
||||
};
|
||||
let from_buf = from
|
||||
.fill_buf()
|
||||
.map_err(|e| format_failure_to_read_input_file(¶ms.executable, ¶ms.from, &e))?;
|
||||
|
||||
let to_buf = match to.fill_buf() {
|
||||
Ok(buf) => buf,
|
||||
Err(e) => {
|
||||
return Err(format_failure_to_read_input_file(
|
||||
¶ms.executable,
|
||||
¶ms.to,
|
||||
&e,
|
||||
));
|
||||
}
|
||||
};
|
||||
let to_buf = to
|
||||
.fill_buf()
|
||||
.map_err(|e| format_failure_to_read_input_file(¶ms.executable, ¶ms.to, &e))?;
|
||||
|
||||
// Check for EOF conditions.
|
||||
if from_buf.is_empty() && to_buf.is_empty() {
|
||||
|
||||
+11
-7
@@ -58,7 +58,7 @@ fn main() -> ExitCode {
|
||||
let exe_path = binary_path(&mut args);
|
||||
let exe_name = name(&exe_path);
|
||||
|
||||
let util_name = if exe_name == "diffutils" {
|
||||
let util_name = if exe_name.as_encoded_bytes().ends_with(b"diffutils") {
|
||||
// Discard the item we peeked.
|
||||
let _ = args.next();
|
||||
|
||||
@@ -69,13 +69,17 @@ fn main() -> ExitCode {
|
||||
OsString::from(exe_name)
|
||||
};
|
||||
|
||||
match util_name.to_str() {
|
||||
Some("diff") => diff::main(args),
|
||||
Some("cmp") => cmp::main(args),
|
||||
Some(name) => {
|
||||
eprintln!("{name}: utility not supported");
|
||||
match util_name.as_encoded_bytes() {
|
||||
name if name.ends_with(b"diff") => diff::main(args),
|
||||
name if name.ends_with(b"cmp") => cmp::main(args),
|
||||
name => {
|
||||
use std::io::{stderr, Write as _};
|
||||
let _ = writeln!(
|
||||
stderr(),
|
||||
"{}: utility not supported",
|
||||
String::from_utf8_lossy(name)
|
||||
);
|
||||
ExitCode::from(2)
|
||||
}
|
||||
None => second_arg_error(exe_name),
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -150,7 +150,7 @@ pub mod testcmds {
|
||||
|
||||
pub static PATCH_CMD: CmdFactory = CmdFactory {
|
||||
cmd: if cfg!(target_os = "macos") {
|
||||
"gpatch" // brew install patch
|
||||
"gpatch" // brew install gpatch
|
||||
} else {
|
||||
"patch"
|
||||
},
|
||||
@@ -160,7 +160,7 @@ pub mod testcmds {
|
||||
let output = Command::new(myself.cmd)
|
||||
.arg("--version")
|
||||
.output()
|
||||
.expect("`patch --version` failed");
|
||||
.expect(format!("`{} --version` failed", myself.cmd).as_str());
|
||||
// Non-GNU versions have subtle differences. When some newlines are missing in some test
|
||||
// patches, the macOS version can even stall the whole test run.
|
||||
assert!(output.stdout.starts_with(b"GNU patch"));
|
||||
|
||||
@@ -32,7 +32,7 @@ mod common {
|
||||
"Expected utility name as second argument, got nothing.\n",
|
||||
));
|
||||
|
||||
for subcmd in ["diff", "cmp"] {
|
||||
for subcmd in ["diff", "cmp", "uu-diff", "uucmp"] {
|
||||
let mut cmd = cargo_bin_cmd!("diffutils");
|
||||
cmd.arg(subcmd);
|
||||
cmd.arg("--foobar");
|
||||
|
||||
Reference in New Issue
Block a user