| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The -r flag is not required to compare two directories; it is only
required to compare them recursively, i.e. descend into their common
subdirectories. Adjust tests that use -r needlessly, and adjust the
dirloop test to verify that these two cases remain distinct.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55262
(cherry picked from commit b2532432971fbd9339a9a49eca1b532978bb6d48)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX uses the terms “positive decimal integer” for -C and “non-negative
decimal integer” for -U, which translates into lower bounds of 1 for -C
and 0 for -U.
POSIX does not specify a minimum upper bound for either mode, but as of
5fc739eb5949 both our backends support context sizes up to and including
INT_MAX, so use that.
Having had the opportunity to consult the Unix System Test Suite, the
diff test cases found therein happen to precisely match these bounds.
While here, switch to using strtonum() to parse numerical arguments, and
try to be more consistent in how we report usage errors.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55261
(cherry picked from commit 790f1d1cc5fa892ba59fd7f239b22064c8ab14c7)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we're done processing a directory, remove its entry from the tree
of visited inodes, ensuring that we only report a loop when we encounter
a descendant-to-ancestor link, not when we encounter a cousin-to-cousin
or sibling-to-sibling link.
MFC after: 1 week
Reported by: Bakul Shah <bakul@iitbombay.org>
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D55248
(cherry picked from commit 71569594d860a59d8362770a56d806e1d31fb946)
|
| |
|
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Fixes: 5fc739eb5949 ("diff: Fix integer overflows in Stone algorithm")
Fixes: 270492602b9b ("diff: Add test case for pagination resource leak")
Fixes: 590126789c84 ("diff: Don't compare a file or directory to itself")
(cherry picked from commit 157d6664aeb815db3b758bd3038fd1512a0f4e2c)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While here, stop abusing struct dirent for something we don't even need
to store.
PR: 254455
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj, kevans
Differential Revision: https://reviews.freebsd.org/D55113
(cherry picked from commit 590126789c841d80655869bc075c8980c173dd1c)
diff: Fix build
rc must be defined first.
Fixes: 590126789c84
MFC after: 1 week
X-MFC with: 590126789c84
(cherry picked from commit ee44ab936e84bacaa49847d36aabdf280f9fecce)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Drop an unnecessary variable and rename pidfd to procd.
* Rewinding stdout serves no purpose, so stop doing it.
* Don't bother freeing memory or setting the global status right
before erroring out.
* Error out if dup(2) or dup2(2) fail.
* In the unlikely case that our pipe is equal to stdout, we need to
record that information so we don't close it when cleaning up.
* Don't bother closing a descriptor before dup2(2)ing to it.
* Don't forget to close the the process descriptor after reaping the
child process.
PR: 266592
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, markj
Differential Revision: https://reviews.freebsd.org/D55112
(cherry picked from commit c3904a7de78ca1ca15fcdf4c09f9d4be7f6fe6f5)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The pagination code leaks either processes or descriptors or both,
depending on the exact version of the code you have. Add a test case
which exercises this leak to facilitate fixing it.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj, kevans
Differential Revision: https://reviews.freebsd.org/D55111
(cherry picked from commit 270492602b9bd8b8fce4f021f055804978bf3f23)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fix integer overflows that may occur when the context window is very
large and add tests to exercise those conditions.
PR: 267032
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj, kevans
Differential Revision: https://reviews.freebsd.org/D55110
(cherry picked from commit 5fc739eb5949620da911db2f87ca8faedc549d3a)
|
| |
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50936
(cherry picked from commit 42092e1b6625b8226de5f34d22b9a96c713626cb)
|
| |
|
|
|
|
|
|
|
| |
PR: 278988
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45220
(cherry picked from commit fb623aab3927a6825ff7731198ec2e33426f7607)
|
| |
|
|
| |
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous logic conflated some things... in this block:
- j: input characters rendered so far
- nc: number of characters in the line
- col: columns rendered so far
- hw: column width ((h)ard (w)idth?)
Comparing j to hw or col to nc are naturally wrong, as col and hw are
limits on their respective counters and nc is already brought down to hw
if the input line should be truncated to start with.
Right now, we end up easily truncating lines with tabs in them as we
count each tab for $tabwidth lines in the input line, but we really
should only be accounting for them in the column count. The problem is
most easily demonstrated by the two input files added for the tests,
the two tabbed lines lose at least a word or two even though there's
plenty of space left in the row for each side.
Reviewed by: bapt, pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37676
|
| |
|
|
|
|
|
|
|
|
| |
This test cannot run without an unprivileged_user being specified
anyways, so just run as the unprivileged user. Revoking read permisions
works just as well if you're guaranteed non-root.
Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34950
|
| |
|
|
|
|
|
|
| |
This reverts commit 85eeb6ea62d45c5df893a16b87969bd7313a3dbb.
The issue has been fixed by 4be7d087c2b566f4910683836be279d55c1a81c6.
PR: 262086
|
| |
|
|
|
| |
PR: 262086
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
| |
With --ignore-file-name-case we need to compare files regardless of
case. We need to propigate both names down to diffit so we can look up
the correct file when the names differ based on case, otherwise we try
to look up the file using the case from the a tree which might not be
discoverable if its case is different in the b tree.
Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34201
|
| |
|
|
|
|
|
|
| |
Must have left this when I was testing the test invocation for
8f79bd9b85716c495c2741ac25db37e8d71f22f7
Pointy hat: thj
Sponsored by: Klara Inc.
|
| |
|
|
|
|
|
|
|
| |
When diffing files and directories, don't follow symbolic links, instead
compare where the links point to.
Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34203
|
| |
|
|
|
|
|
|
|
|
| |
When searching back for function definitions, consider lines starting
with '+' and '-', this allows us to pick up Objective-C methods as well
as C style function definitions.
Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34202
|
| |
|
|
|
|
|
| |
Before this change, only the first BUFSIZE bytes were checked.
Reviewed by: bapt (previous version)
Differential Revision: https://reviews.freebsd.org/D31639
|
| |
|
|
|
| |
--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.
|
| |
|
|
|
|
|
|
| |
This test switches users and either hangs or fails when run as an
unprivileged user.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
| |
Approved by: bapt
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28466
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace). Avoid the D_BRIEF short-circuit when flags are
in effect.
PR: 252515
Reported by: Scott Aitken
Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28064
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's currently unclear to me how this could have worked previously; \n here
is not a literal newline but actual '\' 'n', and was getting passed to the
underlying regex engine as such. regex(3) does not translate this to a
newline, and this became an error because we don't really allow escaping
of arbitrary ordinary characters anymore.
Run the pattern strings through printf to make sure we're dealing with real
newlines before passing them through to atf_check, which ultimately feeds
them directly to regcomp(3).
This fix is different than that will be needed for sed, in that this is the
proper way to inject newlines into search strings as long as regex(3)
won't combine \ + n as folks might expect.
Reported by: Jenkins via lwhsu
MFC after: 1 week
Notes:
svn path=/head/; revision=363692
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When -N is used the missing files are treated as empty.
PR: 233402
Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
Reported by: Roman Neuhauser <roman@sigpipe.cz>
MFC after: 3 days
Differential Revision: D25081
Notes:
svn path=/head/; revision=361689
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various options to "diff(1)" show filenames, and traditionally make use of the
"--label" parameter, if set.
Restore this behaviour in BSD diff.
While here add a regression test
PR: 244533
Submitted by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 3 days
Notes:
svn path=/head/; revision=361688
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This may happen, for instance, if one happens to have an alias of diff to
diff -up and attempts to specify the amount of context on top of that.
Aliases like this may cause other problems, but if they're really not ever
generating non-unified diffs then we should at least not break that
use-case.
In addition, we'll now pick up a format mismatch if -p is specified with
!contextual && !unified && !unset.
Fix up a small trailing whitespace nit in the tests while we're here, and
add tests to make sure that we can double up all the formatting options.
Reported by: jbeich
MFC after: 3 days
Notes:
svn path=/head/; revision=360437
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This matches GNU diff(1) behavior and, more importantly, eliminates any
source of confusion if multiple formatting options are specified.
Note that the committed diff differs slightly from the submitted: I've
modified it so that we initialize diff_format to something that isn't an
accepted format option so that we can also reject --normal -c and -c
--normal, which would've otherwise been accepted because the default was
--normal. After option parsing we default it to D_NORMAL if it's still
unset.
PR: 243975
Submitted by: fehmi noyan isi
MFC after: 1 week
Notes:
svn path=/head/; revision=360125
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--tabsize was previously listed as optional_argument, but didn't account for
the optionality of it in the argument handling. This is irrelevant -- the
manpage doesn't indicate that the argument is optional, and indeed there's
no clear interpretation of omitting the argument because there's no other
side effect of --tabsize.
The "malformed" argument part of the header on this message is simply
referring to usage like this:
% diff --tabsize 4 A B
With an optional_argument, the argument must be attached to the parameter
directly (e.g. --tabsize=4), so the argument is effectively NULL with the
above invocation as if no argument had been passed.
PR: 243974
Submitted by: fehmi noyan isi <fnoyanisi yahoo com> (diff.c portion)
MFC after: 3 days
Notes:
svn path=/head/; revision=357875
|
| |
|
|
|
|
|
|
|
| |
PR: 219933
Submitted by: fehmi noyan isi <fnoyanisi@yahoo.com>
MFC after: 3 weeks
Notes:
svn path=/head/; revision=357648
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff
Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.
MFC after: 2 weeks
Notes:
svn path=/head/; revision=338039
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Advance ctold for f1 and ctnew for f2
- ungetc() if the character is unexpected
- Don't break early when we hit the combination on one side
PR: 230049
Reported by: maskray <emacsray gmail com>
Reviewed by: bapt, maskray
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16451
Notes:
svn path=/head/; revision=336754
|
| |
|
|
|
|
|
| |
Sponsored by: Dell EMC Isilon
Notes:
svn path=/head/; revision=325187
|
| |
|
|
|
|
|
|
|
|
|
| |
contrib/netbsd-tests/usr.bin/diff/t_diff.sh with the name of the script via
`basename $0`.
This was a change I forgot to port over from
^/head/gnu/usr.bin/diff/tests/Makefile@r272787.
Notes:
svn path=/head/; revision=321227
|
| |
|
|
|
|
|
|
| |
MFC after: 2 months
MFC with: r321076, r321077, r321078
Notes:
svn path=/head/; revision=321079
|
| |
|
|
|
|
|
|
| |
MFC after: 2 months
MFC with: r321076
Notes:
svn path=/head/; revision=321077
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
These are were created proactively, in anticipation of the support being
fully implemented sometime in the future.
The tests currently fail on ^/head@r319845, however. Expect them to fail.
PR: 219933
Tested with: gdiff
Notes:
svn path=/head/; revision=319847
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
etcupdate(8) requires that option, while GNU diff supports many more variation
of that options, their behaviour beside the simple verion implemented here are
quite inconsistent as such I do not plan to implement those.
The only special keyword supported by this implementation are: %< and %>
%= is not implemented as the documentation of GNU diff says: common lines, but
it actually when tested print the changes from the first file
Notes:
svn path=/head/; revision=317194
|
| |
|
|
| |
Notes:
svn path=/head/; revision=317187
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Show nanoseconds in the -u/-c header line.
The present portability conditionals cannot handle the POSIX standard
st_mtim, so remove them and unconditionally use st_mtim.
PR: 218018
Reported by: jbeich
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10145
Notes:
svn path=/head/; revision=316002
|
| |
|
|
|
|
|
|
|
| |
PR: 218018
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10140
Notes:
svn path=/head/; revision=315985
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
naming scheme
usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Notes:
svn path=/head/; revision=315776
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
.../usr.bin/diff/diff_test
Some minor adjustment needed to be done for :same as it currently
has the test script hardcoded into the test, instead of using an
idiom like $(dirname $0)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Notes:
svn path=/head/; revision=315293
|
|
|
Some of the modifications from the previous summer of code has been integrated
Modification for compatibility with GNU diff output has been added
Main difference with OpenBSD:
Implement multiple GNU diff options:
* --ignore-file-name-case
* --no-ignore-file-name-case
* --normal
* --tabsize
* --strip-trailing-cr
Make diff -p compatible with GNU diff
Implement diff -l
Make diff -r compatible with GNU diff
Capsicumize diffing 2 regular files
Add a simple test suite
Approved by: AsiaBSDcon devsummit
Obtained from: OpenBSD, GSoC
Relnotes: yes
Notes:
svn path=/head/; revision=315051
|