History log of /src/usr.bin/split/split.c (Results 1 – 25 of 174)
Revision Date Author Comments
# 95032b58 03-May-2024 Shawn Bayern <sbayern@law.fsu.edu>

Tighten boundary check in split(1) to prevent a potential buffer overflow.

Before increasing sufflen, make sure the current name plus two (including
the terminating NUL character and the to-be-added

Tighten boundary check in split(1) to prevent a potential buffer overflow.

Before increasing sufflen, make sure the current name plus two (including
the terminating NUL character and the to-be-added character) does not
exceed the fixed buffer length, and stop immediately if this would occur.

In worst case scenario the code would write an nul character beyond the
boundary, however it would be caught by open(2) and based on the memory
layout, we do not believe this would constitute a security vulnerability.

MFC after: 3 days

show more ...


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals.

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

show more ...


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# d9d69a6f 28-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Improve GNU compatibility.

* Like GNU split, turn autoextend back on if given -a0.
* Add a test case that verifies that -a<non-zero> turns autoextend off.
* Add a test case that verifies that

split: Improve GNU compatibility.

* Like GNU split, turn autoextend back on if given -a0.
* Add a test case that verifies that -a<non-zero> turns autoextend off.
* Add a test case that verifies that -a0 turns autoextend back on.

Sponsored by: Klara, Inc.
Reviewed by: christos, kevans
Differential Revision: https://reviews.freebsd.org/D42011

show more ...


# d7399551 28-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Further option parsing improvements.

* Whenever possible, use strtonum() to parse numeric arguments.
* Improve usefulness and consistency of error messages.
* While here, fix some type and st

split: Further option parsing improvements.

* Whenever possible, use strtonum() to parse numeric arguments.
* Improve usefulness and consistency of error messages.
* While here, fix some type and style issues.

Sponsored by: Klara, Inc.
Reviewed by: christos, kevans
Differential Revision: https://reviews.freebsd.org/D42010

show more ...


# 117c54a7 06-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Fix linecount parsing.

The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount wh

split: Fix linecount parsing.

The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set. Fix these issues and add regression tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41757

show more ...


# 851bf856 06-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Code cleanup.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41756


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# cccdaf50 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dea

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735

show more ...


# ac17fc81 30-May-2023 Jan Schaumann <jschauma@netmeister.org>

split(1): add '-c' to continue creating files

Currently, split(1) will clobber any existing output files:

$ split file; ls
xaa xab xac xad
$ split second-file; ls
xaa xab xac xad xae xaf

This patc

split(1): add '-c' to continue creating files

Currently, split(1) will clobber any existing output files:

$ split file; ls
xaa xab xac xad
$ split second-file; ls
xaa xab xac xad xae xaf

This patch adds a flag "-c" (mnemonic "create, don't overwrite" or
"continue where you left off"):

$ split file; ls
xaa xab xac xad
$ split -c second-file; ls
xaa xab xac xad xae xaf xag xah xai xaj

Reviewed by: christos
Approved by: kevans
Different Revision: https://reviews.freebsd.org/D38553

show more ...


# c4f7198f 30-May-2023 Jan Schaumann <jschauma@netmeister.org>

split(1): auto-extend suffix length if required

If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather
than bai

split(1): auto-extend suffix length if required

If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather
than bailing out with 'too many files'.

Suffixes are extended such that the resulting files continue to sort
lexically and "cat *" would reproduce the input. For example, splitting
a 1M lines file into (default) 1000 lines per file would yield files
named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'.

If '-a' is specified, the suffix length is not auto-extended.

This behavior matches GNU sort(1) since around version 8.16.

Reviewed by: christos
Approved by: kevans
Different Revision: https://reviews.freebsd.org/D38279

show more ...


# fb499259 14-Apr-2023 Mateusz Piotrowski <0mp@FreeBSD.org>

split: Update synopsis and usage; fix examples

- Mark -d as an optional flag
- Add a prompt to one of the examples for consistency
- Add -d to the usage message

Sponsored by: Klara Inc.


# 172be864 27-Oct-2022 Math Ieu <sigsys@gmail.com>

split: reset errno prior to getline()

Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error. This was initially noted in
a jail on a system t

split: reset errno prior to getline()

Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error. This was initially noted in
a jail on a system that has HPET, in a jail that does not expose
/dev/hpet0 -- we see an earlier error in libc's vdso bits.

Fixes: 5c053aa3c5e90 ("split: switch to getline() [...]")

show more ...


# 5c053aa3 23-Aug-2022 Kyle Evans <kevans@FreeBSD.org>

split: switch to getline() for line/pattern matching

Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wigg

split: switch to getline() for line/pattern matching

Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wiggle room. Additionally, we'll actually fail out entirely if we can't
fit a line, which makes noticing this class of problem much easier.

Reviewed by: bapt, emaste, pauamma
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36323

show more ...


# bcd34af4 02-Oct-2019 Alexander Kabaev <kan@FreeBSD.org>

Revert r352953: Convert pnmatch to single element array in regexec calls

Requested by: cem


# c5672dd7 02-Oct-2019 Alexander Kabaev <kan@FreeBSD.org>

Convert pnmatch to single element array in regexec calls

The regexec function is declared as taking an array of regmatch_t
elements, and passing in the pointer to singleton element, while
correct, t

Convert pnmatch to single element array in regexec calls

The regexec function is declared as taking an array of regmatch_t
elements, and passing in the pointer to singleton element, while
correct, triggers a Coverity warning. Convert the singleton into
an array of one to silence the warning.

Reported by: Coverity
Coverity CID: 1009732, 1009733
MFC after: 2 weeks

show more ...


# 95032b58 03-May-2024 Shawn Bayern <sbayern@law.fsu.edu>

Tighten boundary check in split(1) to prevent a potential buffer overflow.

Before increasing sufflen, make sure the current name plus two (including
the terminating NUL character and the to-be-added

Tighten boundary check in split(1) to prevent a potential buffer overflow.

Before increasing sufflen, make sure the current name plus two (including
the terminating NUL character and the to-be-added character) does not
exceed the fixed buffer length, and stop immediately if this would occur.

In worst case scenario the code would write an nul character beyond the
boundary, however it would be caught by open(2) and based on the memory
layout, we do not believe this would constitute a security vulnerability.

MFC after: 3 days

show more ...


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals.

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

show more ...


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# d9d69a6f 28-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Improve GNU compatibility.

* Like GNU split, turn autoextend back on if given -a0.
* Add a test case that verifies that -a<non-zero> turns autoextend off.
* Add a test case that verifies that

split: Improve GNU compatibility.

* Like GNU split, turn autoextend back on if given -a0.
* Add a test case that verifies that -a<non-zero> turns autoextend off.
* Add a test case that verifies that -a0 turns autoextend back on.

Sponsored by: Klara, Inc.
Reviewed by: christos, kevans
Differential Revision: https://reviews.freebsd.org/D42011

show more ...


# d7399551 28-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Further option parsing improvements.

* Whenever possible, use strtonum() to parse numeric arguments.
* Improve usefulness and consistency of error messages.
* While here, fix some type and st

split: Further option parsing improvements.

* Whenever possible, use strtonum() to parse numeric arguments.
* Improve usefulness and consistency of error messages.
* While here, fix some type and style issues.

Sponsored by: Klara, Inc.
Reviewed by: christos, kevans
Differential Revision: https://reviews.freebsd.org/D42010

show more ...


# 117c54a7 06-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Fix linecount parsing.

The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount wh

split: Fix linecount parsing.

The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set. Fix these issues and add regression tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41757

show more ...


# 851bf856 06-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

split: Code cleanup.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41756


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# cccdaf50 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dea

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735

show more ...


1234567