Commit Graph

71 Commits

Author SHA1 Message Date
kevans
f0f01aabba apply(1): Fix magic number substitution with magic character ' '
Using a space as the magic character would result in problems if the command
started with a number:

- For a 'valid' number n, n < size of argv, it would erroneously get
  replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`

- For an 'invalid' number n, n >= size of argv, it would segfault.
  e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]

This problem occurred because apply(1) would prepend "exec " to the command
string before doing the actual magic number replacements, so it would come
across "exec 2to3 1" and assume that the " 2" is also a magic number to be
replaced.

Re-work this to instead just append "exec " to the command sbuf and
workaround the ugliness. This also simplifies stuff in the process.

PR:		226948
Submitted by:	Tobias Stoeckmann <tobias@stoeckmann.org>
MFC after:	1 week
2018-08-08 21:21:28 +00:00
pfg
872b698bd4 General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
bdrewery
a598c4b809 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
ngie
d26727d972 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
ngie
734d081ed1 MFhead@r321912 2017-08-02 08:38:36 +00:00
imp
7e6cabd06e Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
ngie
92100036c8 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
gjb
1c7e318a9a MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
bdrewery
aab40fdc3d DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
gjb
a6998ad84f First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
ngie
dd1f618367 Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
sjg
008d7c831f Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
sjg
75a137820d dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
sjg
65145fa4c8 Merge sync of head 2015-05-27 01:19:58 +00:00
bapt
8d6c7a49a6 Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
sjg
5860f0d106 Updated dependencies 2014-05-16 14:09:51 +00:00
sjg
1a7e48acf1 Updated dependencies 2014-05-10 05:16:28 +00:00
sjg
ed3fc70bf5 Merge from head 2014-05-08 23:54:15 +00:00
imp
2118f42afd Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
sjg
5e568154a0 Merge head 2014-04-28 07:50:45 +00:00
jmmv
41a8d8c295 Migrate most of tools/regression/usr.bin/ to the new tests layout.
I'm starting with the easy cases.  The leftovers need to be looked at a
bit more closely.

Note that this change _does_ modify the code of the old tests.  This is
required in order to allow the code to locate the data files in the
source directory instead of the current directory, because Kyua
automatically changes the latter to a temporary directory.

Also note that at least one test is known to be broken here.  Actually,
the test is not really broken: it's marked as a TODO but unfortunately
Kyua's TAP parser currently does not understand that.  Will have to be
fixed separately.
2014-03-16 08:04:06 +00:00
sjg
6d37b86f2b Updated dependencies 2013-03-11 17:21:52 +00:00
sjg
0ee5295509 Updated dependencies 2013-02-16 01:23:54 +00:00
obrien
3028e3f8ab Sync with HEAD. 2013-02-08 16:10:16 +00:00
delphij
afd567e6cf Constify arguments. While I'm there, also add a static for usage().
MFC after:	2 weeks
2013-01-04 23:44:22 +00:00
marcel
9dd41e3647 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
joel
29af67e52c Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
jh
ba646ecd6f - Use errx(3) instead of err(3) when checking if snprintf(3) succeeded.
snprintf(3) doesn't set errno in the tested cases.
- If the same argument reference (for example %1) was specified more than
  once, the command didn't necessarily fit to the final command buffer. Fix
  this using a dynamic sbuf buffer. Add a few regression tests for the case.

PR:		bin/95079
No objections:	freebsd-hackers
2010-03-05 15:23:01 +00:00
ed
9b380e30d4 Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
ru
f4831848ed It's `apply echo *'' that is similar to ls -1'', not `apply echo a*''.
Submitted by:	sat
2006-12-13 08:13:14 +00:00
ru
7f3c7f0d46 Sort sections. 2005-01-18 13:43:56 +00:00
tjr
a4d61babee Document incorrect handling of multibyte characters. 2004-07-17 04:04:30 +00:00
charnier
f41e5c9c45 Revert previous commit, from Bruce:
This is a style bug.  err() is declared is non-returning so that every
  use of it doesn't need to be encrufted with NOTREACHED.  It's too bad
  that only gcc understands the declaration.

Asked by:	bde@
2003-06-09 19:21:35 +00:00
charnier
6dc80df9f4 Add NOTREACHED after err() inside of a switch statement. 2003-06-08 13:39:32 +00:00
alfred
c288b01e7d WARNS=4 2002-07-14 18:23:22 +00:00
charnier
a07fb1cc07 Use `The .Nm utility' 2002-04-19 23:44:58 +00:00
markm
d644505a7d Minor whitespace nit. 2002-03-23 15:20:45 +00:00
markm
ae2558974f Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
dwmalone
d9613ea383 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
markm
a7016d6ca8 Use __FBSDID(). 2001-12-02 20:40:22 +00:00
brian
c5bd8f6e5d Revert to version 1.16 which was more correct than either of my attempts. 2001-08-21 12:54:15 +00:00
brian
569bf91b79 Remove unnecessary casts.
The original (1.16) code was mostly correct, but this version is
far clearer.

Casts suggested to now be obfuscations by: bde
2001-08-21 11:24:53 +00:00
brian
5bd90784a6 Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 14:46:40 +00:00
dd
911ca14c87 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
ru
36f138439b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
brian
8636b161b3 Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
dd
d705df8034 WARNS= -> WARNS?=
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-22 21:38:30 +00:00
kris
65be28ca85 This passes WARNS=2 on alpha and i386 2001-05-20 06:15:09 +00:00
will
73de9eb2af Fix bogus checking of snprintf() by decreasing the remaining size of the
string after each successful snprintf() call.  This makes apply(1) work
*correctly*, although the whole snprintf() deal really should be redone.

Bug noted by:	nectar (about 3 weeks ago)
2001-01-25 03:40:17 +00:00
will
7e6a937974 Fix numerous style(9) bugs: Put #define's before declarations; sort the
declarations & their arguments; use only one tab after types; restore the
type of argv to sync with src tree style; sort new variables under main();
fix continuation indents; remove extra blank line before free()'s.  Still
to do: fix snprintf() handling as nectar & bde suggested to me.

Submitted by:	bde
2001-01-21 08:37:35 +00:00