15 Commits
Author SHA1 Message Date
Daniel Rosenberg aea95681c2 Fix diff between symlinks and fifos
diff should allow comparison between regular files and fifos
Added a few tests to help catch regressions here, and added
some cleanup for files the test creates.
2024-09-05 10:30:35 -05:00
Daniel Rosenberg 8bed55bb67 Support diff --no-dereference 2024-09-03 23:23:14 -05:00
Elliott Hughes 85a4098424 diff.test: mksh compatibility.
This test never passed on Android, but a quirk of how we were running
it meant we never noticed before.
2023-10-06 00:21:05 -05:00
James Farrell 64952cee70 Support diff -f
AKA --show-function-line
2022-10-13 02:48:02 -05:00
Rob Landley 297a9b4b79 Fix off by one error and add test case. 2022-07-19 07:37:59 -05:00
Rob Landley 2609bb80bc Minor cleanup. 2022-06-30 04:23:20 -05:00
Rob Landley c9b95f4b5e Make diff tests pass with TEST_HOST. 2022-06-30 03:40:41 -05:00
James Farrell fc98edad6e Allow empty line format flags. 2022-05-18 11:55:57 -05:00
James Farrell 7ab529557d Handle diffing FIFOs.
Also exit immediately if a seek fails.

In addition to the supplied test, also tested manually with:

./toybox diff <(echo -e "1\n2") <(echo -e "1\n3")

However, the "testing" function in runtest.sh doesn't handle such
syntax.
2022-05-18 11:55:57 -05:00
James Farrell 9f5fb9ae9a Diff line format options.
--unchanged-line-format
--old-line-format
--new-line-format

We want to use Toybox to make AOSP builds closer to hermetic, and these
flags are used here:
https://android.googlesource.com/platform/build/+/refs/tags/android-wear-9.0.0_r20/target/product/vndk/Android.mk
2022-05-07 09:36:21 -05:00
Elliott Hughes 36b1b7d1f8 diff: implement --strip-trailing-cr.
Used by some ART tests and also some LLVM tests. (The motivating example
is the latter, but I noticed the former when looking for other users.)

Bug: http://b/137298656
2019-07-12 13:19:10 -05:00
Elliott Hughes b1562a6fda diff: use TOYFLAG_ARGFAIL.
This one with a little cleanup of unnecessary duplication.
2019-03-18 23:29:59 -05:00
Rob Landley 7a46d1db95 Chmod +x tests that pass with VERBOSE=fail and -x on tests needing work. 2018-11-20 17:44:43 -06:00
Elliott Hughes 4d673c9ad4 diff: add timestamps to the ---/+++ lines and --color.
(My apologies for mixing these two unrelated changes up.)
2018-07-04 14:24:24 -05:00
Andy Chu 433296f880 Fix a buffer overflow in diff -r.
We were doing two 32-byte memset()s instead of two 16-byte memset()s.
'dir' referred to the instance (array of 2) and not the struct type.

Add some test coverage for diff, including a case that hit this bug.

The bug was found by running cp.test under AddressSanitizer, since it
happens to use diff.
2016-04-14 21:30:24 -05:00