Commit graph

2263 commits

Author SHA1 Message Date
Jilles Tjoelker 1a62d8843d sh: Do parameter expansion on ENV before using it.
This is required by POSIX, and allows things like ENV=\$HOME/.shrc.

Note that tilde expansion is explicitly not performed.
2011-06-10 22:42:00 +00:00
Jilles Tjoelker 292e667663 sh: Do parameter expansion before printing PS4 (set -x).
The function name expandstr() and the general idea of doing this kind of
expansion by treating the text as a here document without end marker is from
dash.

All variants of parameter expansion and arithmetic expansion also work (the
latter is not required by POSIX but it does not take extra code and many
other shells also allow it).

Command substitution is prevented because I think it causes too much code to
be re-entered (for example creating an unbounded recursion of trace lines).

Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would
be quite useful.
2011-06-09 23:12:23 +00:00
Navdeep Parhar 8a6a6922d9 cxgbetool: a tool for the cxgbe(4) driver. 2011-06-09 20:21:45 +00:00
Jilles Tjoelker 725cc7854e sh: Add simple tests for set -x and PS4. 2011-06-08 21:58:19 +00:00
Jilles Tjoelker b3f892d9e0 sh: Fix $? in heredocs on simple commands.
PR:		bin/41410
2011-06-05 14:13:15 +00:00
Jilles Tjoelker b17788c1a9 sh: Add already working testcases for $? in here-document.
If the here-document is attached to a compound command or subshell, $?
already works properly. This is both a workaround for bin/41410 and a
requirement for a true fix for bin/41410.

PR:		bin/41410
MFC after:	1 week
2011-06-05 12:46:26 +00:00
Robert Watson 7fcc404b47 Add a very simple IPDIVERT test, which creates IP divert sockets and
checks for collision/non-collision properties in binding them.  This
test would have identified a bug recently reported on current@
involding my disaggregation of the pcbinfo lock.

It would be nice if this test also exercised packet diversion and
injection, but that is for another day.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-06-04 16:25:12 +00:00
Jilles Tjoelker 47a5ab295a sh: Reduce more needless differences between error messages. 2011-06-04 15:05:52 +00:00
Jilles Tjoelker 9338c85c31 sh: Honour -n while processing -c string. 2011-06-04 11:28:42 +00:00
Jilles Tjoelker 3eee62c606 sh: Add tests for -n flag. These already pass. 2011-06-03 21:17:42 +00:00
Warner Losh 1d6fbefd90 Don't need (and can't use) -L to copy links here. 2011-05-31 17:14:06 +00:00
Jilles Tjoelker 36ae1a9441 sh: Add tests for some somewhat obscure aspects of function definitions. 2011-05-30 21:49:59 +00:00
Bjoern A. Zeeb 3e622db1cb Upgrade jail(2) to latest jail(2) API to make the regression test work
again.  Eventually should switch to jail_set(2).

Reported by:	rwatson
MFC after:	10 days
2011-05-30 09:41:38 +00:00
Robert Watson 0d9535331d Rework TIMEWAIT regression test so that kernel-allocated port numbers are
used rather than a fixed userspace one, avoiding conflicts between the two
test runs.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:34:15 +00:00
Robert Watson 57431792c8 Add missing include of stdio.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:06:24 +00:00
Robert Watson e8c546028b In the tcpdrop regression test, allow the kernel to allocate us a port
rather than using a fixed port number.  This means that the regression test
can be run many times in a row without waiting on TIMEWAIT to release a
hard-coded port number.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:04:35 +00:00
Robert Watson 27d36ca1a8 Add missing #include of err.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 08:54:32 +00:00
Jilles Tjoelker 562c9f003e sh: Add test for 'set +o'. 2011-05-29 15:02:10 +00:00
Jilles Tjoelker 98102dabd3 printf: Allow multibyte characters for '<char> form, avoid negative codes.
Examples:
  LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244)
  LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344)
Both of these should print 228.

Like some other shells, incomplete or invalid multibyte characters yield the
value of the first byte without a warning.

Note that there is no general way to go back from the character code to the
character.
2011-05-28 11:37:47 +00:00
Jilles Tjoelker 64fa41f3e1 sh: Correct criterion for using CDPATH in cd.
CDPATH should be ignored not only for pathnames starting with '/' but also
for pathnames whose first component is '.' or '..'.

The man page already describes this behaviour.
2011-05-27 20:01:46 +00:00
Jilles Tjoelker 4daae0cde6 sh: Add simple CDPATH test. 2011-05-27 19:36:07 +00:00
Jilles Tjoelker 715a0dd556 sh: Fix unquoted $@/$* if IFS=''.
If IFS is null, unquoted $@/$* should still expand to separate words.
This differs from quoted $@ (which does not depend on IFS) in that pathname
generation is performed and empty words are removed.
2011-05-27 15:56:13 +00:00
Adrian Chadd 775b7a6663 Include an EEPROM dump program for the AR9287 EEPROM format. 2011-05-26 19:49:32 +00:00
David E. O'Brien 3c24f8e827 + Tighten up (and simplify) the pass_cmd_vars_1 "variable definition arrived
from the calling make" test.
+ Be more tolerant of newlines in the plus_flag "supports the '+' flag" test.
2011-05-25 23:33:49 +00:00
Ruslan Ermilov a6d11f7139 [mdoc] Fixed .Dt call. 2011-05-25 14:13:53 +00:00
David E. O'Brien a23d1c70b3 Build and install a BSD licensed grep.
If WITH_BSD_GREP is not set, it will be 'bsdgrep' and GNUgrep will be
'[ef]grep'.  Otherwise, BSD-grep will be the grep family, and GNUgrep
will be 'gnugrep'.

Discussed with: brooks
2011-05-25 01:04:12 +00:00
Warner Losh 3a58f40e09 Add the description properly... 2011-05-22 18:23:17 +00:00
Warner Losh becb5566df Add documentation for WITHOUT_KERNEL_SYMBOLS 2011-05-22 18:12:59 +00:00
Jilles Tjoelker 4d79e0296a sh: Add test for r222173. 2011-05-22 12:15:14 +00:00
Ulrich Spörlein c5917de726 Update URLs and fix regex to work with current version of the files. 2011-05-22 09:48:25 +00:00
Jilles Tjoelker 05a447d0b9 sh: Expand aliases after assignments and redirections. 2011-05-21 22:03:06 +00:00
Jilles Tjoelker 47fb896960 sh: Add test for positional parameters with more than one digit.
This also passes on stable/8.
2011-05-21 14:52:26 +00:00
Jilles Tjoelker d6ee26ad02 sh: Implement the cd -e flag proposed for the next POSIX issue.
This reflects failure to determine the pathname of the new directory in the
exit status (1). Normally, cd returns successfully if it did chdir() and the
call was successful.

In POSIX, -e only has meaning with -P; because our -L is not entirely
compliant and may fall back to -P mode, -e has some effect with -L as well.
2011-05-20 22:55:18 +00:00
Jilles Tjoelker 85307c9ed9 sh: Allow terminating a heredoc with a terminator at EOF without a newline.
This is sometimes used with eval or old-style command substitution, and most
shells other than ash derivatives allow it.

It can also be used with scripts that violate POSIX's requirement on the
application that they end in a newline (scripts must be text files except
that line length is unlimited).

Example:
v=`cat <<EOF
foo
EOF`
echo $v

This commit does not add support for the similar construct with new-style
command substitution, like
v=$(cat <<EOF
foo
EOF)
This continues to require a newline after the terminator.
2011-05-20 16:03:36 +00:00
Warner Losh 0163af2360 Implement WITH{,OUT}_{GCC,BINUTILS} to provide finer-grained control
over building gcc and binutils.  They default to true, unless
MK_TOOLCHAIN is no.

Reviewed by:	ru@
2011-05-19 05:13:25 +00:00
Ruslan Ermilov 1562ef0218 Added description for WITH_OFED. 2011-05-17 11:06:41 +00:00
Jilles Tjoelker d69e16c977 sh: Add tests for lines that look like heredoc delimiters but are not. 2011-05-14 14:19:30 +00:00
Warner Losh 9df02b5476 Restore BOOT2CFG, accidentally removed in r212938.
PR:		157020
2011-05-14 04:32:30 +00:00
Warner Losh 9a6e729a11 If there's no package directory, don't try to install packages from
it.  Instead, report that 0 packages are reported.

PR:		misc/140436
2011-05-13 19:40:02 +00:00
Warner Losh 14f9771b27 Add ${} around variable dereference...
Submitted by:	garrett coopper
2011-05-13 18:46:20 +00:00
Warner Losh 94a74d9427 Implement -f to inhibit copying s1 partition out for speed.
(-z not taken from PR, it is no longer needed since we basically always
 do that now)

PR:		misc/151698
Submitted by:	lev@
2011-05-13 18:36:24 +00:00
Warner Losh b0effdce7c Copy symbolic links as files rather than recreating the links.
PR:		misc/151697
Submitted by:	lev@
MFC after:	2 weeks
2011-05-13 18:28:25 +00:00
Ruslan Ermilov e6a714e703 Reassurance for impatient. 2011-05-10 13:01:11 +00:00
Ruslan Ermilov cae68bef11 Style. 2011-05-10 12:57:39 +00:00
Ruslan Ermilov 2701a1b7a1 - There now exist options that have different defaults depending on
the architecture, reflect this in documentation.  For such
  options, both WITH_FOO and WITHOUT_FOO description files should
  be provided.

  Prodded by:	des

- Setting a build option may enforce other build options, try harder
  to detect this case.

- Setting a build option may change other option's default value,
  try harder to detect this case.
2011-05-10 11:14:40 +00:00
Ruslan Ermilov 37730efb9a The Objective C support was removed in r220755.
Submitted by:	des
2011-05-10 11:06:14 +00:00
Adrian Chadd 9a086c6988 This is a full 32 bit field for kite. 2011-05-09 10:39:15 +00:00
Jilles Tjoelker 07eb7033a6 sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not
possible.

Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.
2011-05-08 17:40:10 +00:00
Jilles Tjoelker 7cc6b3df80 sh: Add UTF-8 support to pattern matching.
?, [...] patterns match codepoints instead of bytes. They do not match
invalid sequences. [...] patterns must not contain invalid sequences
otherwise they will not match anything. This is so that ${var#?} removes the
first codepoint, not the first byte, without putting UTF-8 knowledge into
the ${var#pattern} code. However, * continues to match any string and an
invalid sequence matches an identical invalid sequence. (This differs from
fnmatch(3).)
2011-05-08 11:32:20 +00:00
Jilles Tjoelker 4c244ed255 sh: Add UTF-8 support to ${#var}.
If the current locale uses UTF-8, ${#var} counts codepoints (more precisely,
bytes b with (b & 0xc0) != 0x80).
2011-05-07 14:32:16 +00:00