The specification follows a commentary to the function parse_part()
in the source code and the code itself.
(cherry picked from commit d1797fb5bbaeb212501a72b916d647fb2e021d50)
- Cover all code paths.
- When decoding, check all output files, not just the last one.
- A simple `ferror()` check is not enough as an error may later occur
while flushing whatever remains in the output buffer.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43532
(cherry picked from commit 5cb28f7979773715615cc2131fe40e0c5879ed1d)
bintrans: Fix uninitialized variable.
`prev` may be used uninitialized if `body` starts with a newline.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D43534
(cherry picked from commit bce34cba07bcfed9cd519a658e594c9910c8f210)
bintrans: Add base64 to name list in manual page.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: 0mp, pstef
Differential Revision: https://reviews.freebsd.org/D43558
(cherry picked from commit 64028ac3ba9668cff31bfe2c79d85a3b89e10953)
bintrans: Remove unused variable.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43559
(cherry picked from commit bc2913d1736c2b299a265741a779014d001bd108)
I accidentally copied this to the wrong place, or by accident to two
places, during the merge of llvmorg-17-init-19304-gd0b54bb50e51.
Fixes: 06c3fb2749bd
MFC after: 3 days
(cherry picked from commit 4015c064200e643ab110cdf831064c3c73f31b73)
man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.
PR: 275967
Reviewed by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43453
(cherry picked from commit b8a484ec343d163a40f7cf4a6026e880f992c738)
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.
PR: 232405
Submitted by: Martijn van Duren <martijn@openbsd.org>
(cherry picked from commit 95bf75895ddcf17402b1f69dce26cb821c922476)
The globbing function in exists() needs to handle white spaces.
PR: 275978
Reviewed by: kevans, bapt, emaste
Differential Revision: https://reviews.freebsd.org/D43222
MFC after: 1 week
(cherry picked from commit e3c7b76fa8105929ae9a785e5ffc44274b1b0a81)
Add the missing -q option to the nfsstat(1) manpage SYNOPSIS (it is
already documented in DESCRIPTION), and add the missing -E and -q
options to the built-in usage output.
PR: 275912
Pull Request: https://github.com/freebsd/freebsd-src/pull/958
(cherry picked from commit 30ce26cacfd626552c647c9327dd510e7f421d97)
setjmp() requires that any stack variables modified between the setjmp
call and the longjmp() must be volatile. This means that 'saveint' in
grabh() must be volatile, since it's modified after the setjmp().
Otherwise, the signal handler is not properly restored, resulting in a
crash (SIGBUS) if ^C is typed twice while composing.
PR: 276119
Reported by: Christopher Davidson <christopher.davidson@gmail.com>
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/993
(cherry picked from commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2)
These new tests cover more functionality and are easier to extend.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43381
(cherry picked from commit e762fd81e253d4ae9b9f7d2e65cf448633bbe527)
uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have
to be output. For the basic case, this means output each line as it is
read unless it is identical to the previous one. For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given. The -D and -u cases were already fine.
Add test cases for interactive use with no options and with -d.
Explicitly ignore -d when -D is also specified.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: rew, kevans
Differential Revision: https://reviews.freebsd.org/D43382
(cherry picked from commit 11715600e626cf6cc4b4f564af97f6ae1e5fb0be)
uniq: Clean up and test obsolete options.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43402
(cherry picked from commit e2ec8ee02a33e39b8ff86a56e8a1ef5e84ac7e62)
uniq: Error out if writing to the output failed.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43407
(cherry picked from commit 899837e8f5741f9a847b63d9e7c8b76ccc033ab5)
Since we expect the entry to still be valid after calling into PAM,
which may call getpwnam() itself, we need to use getpwnam_r().
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp, allanjude, markj
Differential Revision: https://reviews.freebsd.org/D43376
(cherry picked from commit a3d80dd8aa6ac15877e00102ab174b417ac81d79)
login: Missed an instance of getpwnam().
Fixes: a3d80dd8aa6ac15877e00102ab174b417ac81d79
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43423
(cherry picked from commit 1e25eb287f3fdd763df98065dbf2e1eb201e4000)
The standard is somewhat unclear, but on the balance, I believe that the
phrase “the rest of the input line” should be interpreted to mean the
rest of the input line including the terminating newline if and only if
there is one. This means the current implementation is incorrect on two
points:
- First, it suppresses the previous line's newline in the '1' case.
- Second, it unconditionally emits a newline at the end of the output
for non-empty input, even if the input did not end with a newline.
Resolve this by rewriting the main loop. Instead of special-casing the
first line and then assuming that every line ends with a newline, we
remember how each line ends and emit that either at the beginning of
the next line or at the end of the file except in the one case ('+')
where the standard explicitly says not to.
While here, try to reduce diff to upstream a little and update their
RCS tag to reflect the fact that while we've diverged significantly
from them, we've incorporated all their changes. Remove the useless
second RCS tag.
We also update the tests to account for the change in interpretation
of the '1' case and add a test case for unterminated input.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43326
(cherry picked from commit c2356a440db91c106867d45c94b3d6d7bc0e50f0)
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.
PR: 273753
MFC after: 1 month
(cherry picked from commit 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
We only need to link against libz and libzstd when linking against the
fill libllvm, libllvmminimal doesn't use either library. Move adding
libz and libzstd to the list of libraries to link against to where
we decide to use the full libllvm.
Reported by: Cristian Marussi <Cristian.Marussi@arm.com>
Reported by: Colin S. Gordon <csgordon@fastmail.com>
Reviewed by: dim
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42528
(cherry picked from commit 83771b1914e182c6324839e05ff82ee6f4a87c98)
Adjust the lastcomm command to output timestamps with a precision of
seconds.
Reported by: Dr. Andreas Longwitz
Reviewed by: emaste
Relnotes: Yes
Sponsored by: DSS Gmbh
Pull Request: https://github.com/freebsd/freebsd-src/pull/802
(cherry picked from commit 6f4ce7e89ba4fa52566704533920352aa65c7f9b)
Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar. This hasn't been accurate
for years, since e061f95e7b ("Rework calendar(1) parser") rewrote a
lot of this.
Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag. This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.
While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.
Reviewed by: bapt
Sponsored by: Klara, Inc.
(cherry picked from commit 0a82cd4f101c5eb8533a0049aaa3f06f005cf8af)
Some callers are using print_mask_arg() when they should be using
print_mask_arg0(); the latter should be used when all flags are optional
and there's not a flag to be decoded with a 0-mask. This turns:
nmount(0x6991e009000,0x8,0<><invalid>0)
into:
nmount(0x6991e009000,0x8,0)
Reviewed by: jhb
(cherry picked from commit a206524709bdfbd577bcfe76676da80b8250f84c)
This makes code cleaner, plus fixes such nonsense as humanized JSON
and XML, making all numbers raw without quotes, spaces, suffixes, etc.
MFC after: 2 weeks
(cherry picked from commit 1f36ca5de596f7c2eb446df5b8e06877901d727a)
Raw numbers can be seen in json/xml or with --libxo=no-humanize.
MFC after: 2 weeks
(cherry picked from commit 598d1ac85e87d9312b9fd3266908ab6a6768edc6)
Convert waitsec to a long long to be able to hold the full domain of
alarm(3) timeout on all platforms, and let strtonum(3) handle the input
validation. strtonum(3) also happens to provide a neater interface for
error handling, and it already includes our pre-existing empty input
check.
Sponsored by: Klara, Inc.
(cherry picked from commit e4967d4d48b0a7d873e4f778c0a6e560e09d4dc3)
This is most useful inside a shell script, allowing one to lock just
portions of a script rather than having to wrap the entire script in a
lock.
PR: 262738
Reviewed by: 0mp, allanjude (both previous versions)
Co-authored-by: Daniel O'Connor <darius@dons.net.au>
Sponsored by: Klara, Inc.
(cherry picked from commit 09a7fe0a5523d53ff6c26ddef9a947f293e18c22)
Provide basic coverage for the existing options, nothing deeper (e.g.,
pipe closing behavior) is tested in this set.
Reviewed by: allanjude
Feedback from: des
Sponsored by: Klara, Inc.
(cherry picked from commit 296a5a4db1fc8203f5f6aa8f68321e6ab4652b56)
None of these are essential in the lockf monitor (parent post-fork), so
close them to maintain the illusion that lockf hasn't been inserted into
the pipeline. This ensures that the correct effects happen on other
programs in the pipeline if the locked command closes or redirects these
elsewhere.
The original patch used -s to close stdout/stderr rather than closing
them unconditionally, but it's not clear that we really care that much.
kevans dropped that part when taking the patch, patch is otherwise by
listed author.
PR: 112379
Reviewed by: 0mp, allanjude (both earlier version), kevans
Feedback from: des
Sponsored by: Klara, Inc.
(cherry picked from commit 18425c19cae08cbe41801845457ed67285806688)
The error message is expected, allow -s to suppress just that one since
it would loosely fall under the definition of "failure to acquire the
lock" described in the manpage for the -s option.
Reviewed by: 0mp, allanjude
Feedback from: des
Sponsored by: Klara, Inc.
(cherry picked from commit 3041e6950d07f0d11c9f91fefbf3c273cbbe4407)
The -w flag was added without being noted in the usage statement; fix
that now.
While we're here, re-sort the getopt() string.
Reviewed by: 0mp, allanjude, des
Sponsored by: Klara, Inc.
(cherry picked from commit 35095fd23f071d03633312b91a5b460eaf811efa)
POSIX defines a number of other control characters as well as
alternative aliases for some that should be provided in the default set,
so let's go ahead and add those.
Reviewed by: bapt, yuripv
Sponsored by: Klara, Inc.
(cherry picked from commit 3a7ffe206ce7e4741fae26432f6d6e5159207f45)
On MacOS, we bootstrap sort. Since ALTMON_* are not defined there, the
build blows up. Since we don't need this feature for the FreeBSD build
process, and since we won't use it unless we actually install the NL
files that have this data in it, just #ifdef it out for now. In the
extremely unlikely event that the FreeBSD bootstrap/build process grows
this dependency, we can evaluate the best solution then (which most
likely is going to be not depend on the local's month names).
Fixes: 3d44dce90a69 (MacOS builds and github CI)
Sponsored by: Netflix
Reviewed by: jrtc27, jlduran@gmail.com, markj
Differential Revision: https://reviews.freebsd.org/D42868
(cherry picked from commit bd234c0d4c8256db7e5a1fdda9ef311c9e0080e4)
The CLDR specification [1] defines three possible month formats:
- Abbreviation (e.g Jan, Ιαν)
- Full (e.g January, Ιανουαρίου)
- Standalone (e.g January, Ιανουάριος)
Many languages use different case endings depending on whether the month
is referenced as a standalone word (nominative case), or in date context
(genitive, partitive, etc.). sort(1)'s -M option currently sorts months
by testing input against only the abbrevation format, which is
essentially a substring of the full format. While this works fine for
languages like English, where there are no cases, for languages where
there is a different case ending between the abbreviation/full and
standalone formats, it is not sufficient.
For example, in Greek, "May" can take the following forms:
Abbreviation: Μαΐ (genitive case)
Full: Μαΐου (genitive case)
Standalone: Μάιος (nominative case)
If we use the standalone format in Greek, sort(1) will not able to match
"Μαΐ" to "Μάιος" and the sort will fail.
This change makes sort(1) test against all three formats. It also works
when the input contains mixed formats.
[1] https://cldr.unicode.org/translation/date-time/date-time-patterns
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42847
(cherry picked from commit 3d44dce90a6946e2ef2ab30ffbf8e2930acf888b)
These were obtained from a drive, but they agree with the IBM
documentation.
The bpi/bpmm values are the same as TS1160, but the number of
tracks is much larger (18944 tracks vs 8704 for TS1160). The tapes
are also longer, 1337m total. (According to the MAM on a sample JF
tape. I don't have a JE tape handy to compare.) The end result
is a 50TB raw capacity (150TB compressed) for TS1170 with a JF
cartridge vs 20TB raw capacity (60TB compressed) for TS1160 with
a JE cartridge.
lib/libmt/mtlib.c:
Add the TS1170 density codes to the denstiy table in libmt.
usr.bin/mt/mt.1:
Add the TS1170 density codes and specs to the density table
in the mt(1) man page. As usual for TS drives, there is an
encrypted and non-encrypted density code (0x79 and 0x59
respectively).
Sponsored by: Spectra Logic
(cherry picked from commit 83823d063ab57db8d3954c1530d036f1ccdceb41)
The number of events we track can vary over time, but we only allocate
enough space for the exact number of events we are tracking when we
first begin, resulting in a trivially reproducable heap overflow. Fix
this by allocating enough space for the greatest possible number of
events (two per file) and clean up the code a bit.
Also add a test case which triggers the aforementioned heap overflow,
although we don't currently have a way to detect it.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude, markj
Differential Revision: https://reviews.freebsd.org/D42839
(cherry picked from commit 621f45532c5887c96b708ce232c52878d0053325)
tail: Clean up error messages.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42842
(cherry picked from commit b70e57be2cfe83ec9f410e2f317ea38aaac61a98)
Loss of the trailing space in the multi-line format string has
resulted in column name being emitted as "FAILSLEEP", instead of
two columns "FAIL" and "SLEEP".
(cherry picked from commit 62d47a4db4579315d7b89002d7de696b44ae1415)
usage:
$ genl monitor <family> <multicats group>
this subcommand allows to monitor the message from a multicast group
of a given family when received.
If it knows how to parse the messages received it will dump the decoded
version, otherwise it will just inform a new message has been received
So far it only knows how to parse nlctrl notify messages, but the plan
to allow to make the parsing extensible via lua scripts
Differential Revision: https://reviews.freebsd.org/D40372
(cherry picked from commit e19b2ef976d326d34b17331c5071d9e687d0d5d5)