Commit Graph

8542 Commits

Author SHA1 Message Date
Juli Mallett
26cfaf71bb Fix typo. 2007-05-17 00:19:56 +00:00
Juli Mallett
36c5e18daa o) Correct for missing whitespace.
o) We don't need to check if ifp == stdin to give the filename, since we already
   know that ifn will be "stdin" if it is.
2007-05-17 00:18:01 +00:00
Juli Mallett
2fdb65fd82 Fix confusing misindentation of a closing-brace. (It goes with the switch, not
with the while.)
2007-05-17 00:11:58 +00:00
Diomidis Spinellis
e91843d40a Backout revisions 1.16-1.14.
Backwards compatibility with the new acct(5) format will be
implemented through the explicit versioning of acct records,
not through an export/import procedure.
2007-05-14 09:05:22 +00:00
Andre Oppermann
612d21296c 'netstat -A -p tcp' doesn't print the Socket but the Tcpcb pointer in the
first column.
2007-05-13 22:32:32 +00:00
Pav Lucistnik
67a09fffe1 Replace rev. 1.9 with patch from OpenBSD.
Submitted by:	Ray Lai <ray@cyth.net>
Obtained from:	http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/tip/acu.c.diff?r1=1.13&r2=1.14
MFC after:	1 week
2007-05-12 23:29:33 +00:00
Pav Lucistnik
bae1345b9d Fix crash when using 'du' capability: NULL return of strpbrk was not handled
PR:		bin/108368
Reported by:	Ivo Hazmuk <ivo@vutbr.cz>
Submitted by:	rdivacky
MFC after:	2 weeks
2007-05-12 13:36:13 +00:00
Pav Lucistnik
0e2dd92370 Expand documentation of -f option
PR:		docs/66265
Submitted by:	Michel Lavondes <fox@vader.aacc.cc.md.us>
MFC after:	1 week
2007-05-12 12:23:40 +00:00
Tim Kientzle
6a955a7506 Set the program return value non-zero if we enounter
an error while skipping the body of an entry during
"tar -t" processing.

Thanks to: Spencer Minear
PR: misc/112521
2007-05-08 15:22:21 +00:00
David Malone
61d8eede29 Cast to intmax_t to print tv_sec in struct timeval.
Avoid shadowing a global variable with a function argument.
Set WARNS to 6.
2007-05-07 12:23:23 +00:00
David Malone
2ffe6bbf0f Use [u]intmax_t to printf unknown integer types.
Make timeprt always allocate memory, to make things a little simpler.
Remove an unused variable.
2007-05-07 12:10:06 +00:00
David Malone
6f62d86388 Make logmsg take const char * arguments.
Set WARNS to 6.
2007-05-07 11:28:01 +00:00
David Malone
e4cedda807 ANSIfy function definitions.
Move some extern declarations to a header file.
Remove an unneeded extern declaration for optarg.
2007-05-07 11:18:30 +00:00
David Malone
bc7e443092 Fix some warnings by making things const, adding missing headers,
removing some unused variables and making a variable unsigned.

MFC after:	3 weeks
2007-05-07 11:01:36 +00:00
David Malone
61f31ed6cf Initialise variable size so that reading stdin works deterministically.
Add missing include.

Default to WARNS=6.
2007-05-03 13:57:19 +00:00
Benjamin Close
d7a1f74bec Add myself
Approved by:	mlaier (mentor)
2007-05-03 11:34:36 +00:00
Colin Percival
c85ac10468 If lstat(2) fails, have bsdtar return a non-zero exit code if the
failed path is one which was specified on the command line.

This is a compromise between the situation prior to revision 1.57
(where a race between tar(1) and rm(1) could cause tar(1) to
spuriously report an error) and the situation after revision 1.57
(where "tar -c /no/such/path" prints a warning but returns with
an exit code of zero).

Inspired by:	rafan
MFC after:	1 week
2007-05-03 04:33:11 +00:00
Andrey A. Chernov
ba174a5e38 Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
2007-05-01 16:02:44 +00:00
Andrey A. Chernov
35e4f24d23 limits calls setenv("name=value", "value", 1); which violates POSIX:
"The setenv( ) function shall fail if:
[EINVAL] The name argument is a null pointer, points to an empty string,
or points to a string containing an '=' character."
The fix (like all others in this subject) is backward-compatible.
2007-04-30 20:10:10 +00:00
Andrey A. Chernov
ed4bcacfde env calls setenv("name=value", "value", 1); which violates POSIX:
"The setenv( ) function shall fail if:
[EINVAL] The name argument is a null pointer, points to an empty string,
or points to a string containing an '=' character."
The fix (like all others in this subject) is backward-compatible.
2007-04-30 19:25:00 +00:00
Andrey A. Chernov
8673ed1565 Slightly tune previous fix: free memory if !export 2007-04-30 12:54:02 +00:00
Andrey A. Chernov
9e461e53cc Prepare for upcoming POSIXed putenv() rewrite:
don't free memory after putenv()
2007-04-30 12:51:02 +00:00
Andrey A. Chernov
2efaac818f Prepare for upcoming POSIXed putenv() rewrite:
don't free memory after putenv()
2007-04-30 12:44:04 +00:00
Maxim Konovalov
4063583a62 o Fill the list of icmp types; make its size depend on ICMP_MAXTYPE.
o Print "unknown ICMP" instead of "(null)" if we don't have a description         for a icmp type.

Based on code

Submitted by:	Christoph Weber-Fahr
PR:		misc/112126
MFC after:	2 weeks
2007-04-30 12:27:04 +00:00
Andrey A. Chernov
97e49dd4b5 Eliminate error with -W* strict flags and make putenv() calls conforming to
standard and portable in the same way as f.e. gcc internal portable code does.
2007-04-30 05:14:29 +00:00
David Malone
3e6dcadf52 Change the date for Daylight Savings in the US.
PR:		111102
Submitted by:	Sean Farley <sean-freebsd@farley.org>
Obtained from:	OpenBSD
2007-04-29 20:03:06 +00:00
Brian Somers
2e7b6bff38 Add some more examples. It always takes me a long time to find the S
modifier (-t is ignored without it).

MFC after:	1 week
2007-04-27 18:23:32 +00:00
Marcelo Araujo
e27c581538 - Added entry for Marcelo S. Araujo.
Approved by:	itetcu (comentor)
2007-04-27 18:17:41 +00:00
Tong LIU
e5b725c271 add myself.
Approved by:	delphij (mentor)
2007-04-25 11:59:10 +00:00
Yaroslav Tykhiy
f3aad16b88 Insert explicit space between the output fields to prevent them
from running together when a field overflows.

MFC after:	1 week
2007-04-23 11:43:22 +00:00
Yaroslav Tykhiy
70b36fc0c8 Don't forget to bump document date after changing the content. 2007-04-21 01:22:51 +00:00
Yaroslav Tykhiy
f6703c9c0a Change the semantics of -i (in-place editing) so that it treats
each file independently from other files.  The new semantics are
desired in the most of practical cases, e.g.: delete lines 5-9
from each file.

Keep the previous semantics of -i under a new option, -I, which
uses a single continuous address space covering all files to edit
in-place -- they are too cool to just drop them.

Add regression tests for -i and -I.

Approved by:	dds
Compared with:	GNU sed
Discussed on:	-hackers
MFC after:	2 weeks
2007-04-21 01:21:36 +00:00
Max Khon
45352bae07 Improve logging when -dm is specified: if the node is considered
out-of-date print not only "modified before source" message
but also the path of youngest source.
2007-04-20 06:33:25 +00:00
Max Khon
bc5748e31f When remaking makefiles check that mtime has actually changed.
This fixes infinite restart in the following case:

Makefile: foo

foo: bar
	do-something

Unlike GNU make, BSD make considers "Makefile" node as remade even
if "foo" is up-to-date and was not actually rebuilt.
GNU make does not consider nodes without commands as remade if child nodes
were not actually rebuilt.

Most probably, more proper fix would be to bring BSD make behaviour in-line
with GNU make but this would be more intrusive change.
2007-04-20 06:25:45 +00:00
Diomidis Spinellis
b7dd80b843 Change the export option from -w (write) to -X.
While implementing import it became apparent that write as a mnemonic
is ambiguous and confusing.

MFC after:	8 days
2007-04-18 16:43:21 +00:00
Diomidis Spinellis
3f863a9ae4 Complain on write errors.
Use correct type for write_text.

MFC after:	8 days
2007-04-18 09:39:47 +00:00
Diomidis Spinellis
947ef7f187 Add export capability through the new -w flag.
Discussed in: -arch
MFC after:	8 days
2007-04-18 08:55:54 +00:00
Tim Kientzle
8d36aa79ef Ignore trailing '/' when comparing pathnames, so that
"tar -u" works again.  Otherwise, "tar -u" wants to
treat every dir as new and re-adds it.
2007-04-18 04:36:11 +00:00
Tim Kientzle
007c50304b When testing basic functionality, strip trailing '/' from
dir names, so they match the names generated by 'find'.
2007-04-18 04:35:17 +00:00
Rong-En Fan
6000ced11b - Add a new 'j' switch and runtime option to toggle display jail id for
each process.
- While I'm here, keep help message sorted by keys

PR:		98489, 98975
Submitted by:	clsung
Approved by:	delphij (mentor)
MFC after:	2 weeks
2007-04-17 03:12:39 +00:00
Colin Percival
6fc0ea8474 In libarchive: Downgrade ARCHIVE_FATAL and ARCHIVE_FAILED errors which
occur on the write side of extracting a file to ARCHIVE_WARN errors
when returning them from archive_read_extract.

In bsdtar: Use the return code from archive_read_data_into_fd and
archive_read_extract to determine whether we should continue trying to
extract an archive after one of the entries fails.

This commit makes extracting a truncated tarball complain once about
the archive being truncated, instead of complaining twice (once when
trying to extract an entry, and once when trying to seek to the next
entry).

Discussed with:	kientzle
2007-04-16 04:04:50 +00:00
Andrey A. Chernov
b79aefd3e9 Use proper type cast for ctype macro 2007-04-14 14:32:48 +00:00
Stanislav Sedov
faac60c8fc - Add new 'a' switch and runtime option that allows 'top' to display process
titles extracted from argv vector instead of the real executable names.
  This is useful when you want to watch applications that set their status
  information via setproctitle(3).

Approved by:	alfred
MFC after:	2 weeks
2007-04-14 10:16:52 +00:00
Tim Kientzle
94a2a4ad3d Portability.
Thanks to: Martin Koeppe for testing on Interix
2007-04-13 16:08:23 +00:00
Ruslan Ermilov
edd57853f5 In .error and .warning, prefer command-line variables
to globals, as per documentation.

Nudged by:	Jeremie Le Hen
2007-04-12 18:14:00 +00:00
Ruslan Ermilov
1e5f1c29ea Restore the ".Sh BUGS" line that was accidentally removed
in the previous commit.
2007-04-12 08:22:49 +00:00
Tim Kientzle
f6df491097 Make it easier to support more platforms.
Thanks to: Joerg Sonnenberger for pointing out the need and the technique.
2007-04-12 04:45:32 +00:00
Dag-Erling Smørgrav
ae16dc8817 Remove irrelevant comment about T/TCP in BUGS.
Spotted by:	ru@
2007-04-11 20:32:59 +00:00
Dag-Erling Smørgrav
b49339d790 Remove -T from getopt() spec and usage string.
Submitted by:	ru@
2007-04-11 20:32:09 +00:00
Dag-Erling Smørgrav
e705dbe22c Bump Dd. 2007-04-11 19:20:42 +00:00
Dag-Erling Smørgrav
f8871cc86d Remove T/TCP support, and the -T option which was needed to disable it.
MFC after:	3 weeks
2007-04-11 19:11:54 +00:00
Ed Maste
affde8a968 Eliminate memory leak from an accidental malloc(). 2007-04-10 17:37:53 +00:00
Greg Lehey
5abc1de430 Update to match revision 1.23 of touch.c.
Clarify some details.
2007-04-10 07:24:47 +00:00
Greg Lehey
1b54381b5a Usage: print base name of program.
-A flag: respect the -a and -m flags.
	 imply the -c flag.

Requested in principle by: brian
2007-04-10 07:22:30 +00:00
Xin LI
5d2d083c92 Make use of ptrace(2) instead of procfs in truss(1), eliminating
yet another need of an available /proc/ mount.

Tested with:	make universe
Submitted by:	howardsu
Reviewed by:	alfred
2007-04-10 04:03:34 +00:00
Bruce M Simpson
b9cb107e3a Mark netstat -g host-mode output as deprecated.
MFC after:	2 weeks
2007-04-10 00:30:26 +00:00
Ed Maste
5cfe203fbf Add prototype for generated ptraceopname function. 2007-04-09 22:04:27 +00:00
Pawel Jakub Dawidek
0c6b66bd70 Move uuidgen(1) from /usr/bin/ to /bin/. It will be used in rc.d/hostid
script, which will be executed before /usr/ mount.

Reviewed by:	mlaier, rink, brooks, rwatson
2007-04-09 19:16:48 +00:00
Ed Maste
24be4e6248 Remove static ptrace_ops array and extract ptrace op names from
sys/ptrace.h with mksubr.
2007-04-09 19:16:24 +00:00
Colin Percival
35c2dd3d05 Clean up error handling in archive_append to match how errors are
handled in write_hierarchy.

Approved by:	kientzle
2007-04-09 08:22:34 +00:00
Greg Lehey
3481910d32 Add -A flag to adjust existing time stamps.
Print name by which program was started in usage() message.

MFC after:  2 weeks
2007-04-09 02:19:37 +00:00
Tim Kientzle
c2c19b10c7 Simplify the logic for handling header read
errors.
2007-04-07 05:56:40 +00:00
Yaroslav Tykhiy
9cfc96edd7 style(9):
Use a single space before $FreeBSD$ to avoid terminal line overflow.

Pointed out by:		ru (The All-Seeing Eye)
2007-04-06 08:43:30 +00:00
Pawel Jakub Dawidek
f3a8d2f93c Add security.jail.mount_allowed sysctl, which allows to mount and
unmount jail-friendly file systems from within a jail.
Precisely it grants PRIV_VFS_MOUNT, PRIV_VFS_UNMOUNT and
PRIV_VFS_MOUNT_NONUSER privileges for a jailed super-user.
It is turned off by default.

A jail-friendly file system is a file system which driver registers
itself with VFCF_JAIL flag via VFS_SET(9) API.
The lsvfs(1) command can be used to see which file systems are
jail-friendly ones.

There currently no jail-friendly file systems, ZFS will be the first one.
In the future we may consider marking file systems like nullfs as
jail-friendly.

Reviewed by:	rwatson
2007-04-05 21:03:05 +00:00
Yaroslav Tykhiy
4ebdfcd2e1 Add an important detail to paragraph 12: the range is reset only if its
second address is a line number.
2007-04-05 17:12:01 +00:00
Yaroslav Tykhiy
0d68e7fead Reflect the change in rev. 1.44 of process.c.
Add $FreeBSD$ to please commit_prep.pl.
2007-04-05 13:31:17 +00:00
Diomidis Spinellis
44c900afd7 A dash as an argument to the -f option will now cause lastcomm to
read data from the standard input.  This allows tail -f to pipe
data to lastcomm, and thereby real-time monitoring of executed
commands.  The manual page includes the exact incantation.

MFC after:	2 weeks
2007-04-04 16:04:58 +00:00
Colin Percival
17c0c70552 Add test to confirm that piping a tar archive created by bsdtar through
'bsdtar -cf- @-' doesn't alter it.
2007-04-04 03:12:15 +00:00
Li-Wen Hsu
506f0b8148 Add myself.
Approved by:     clsung (mentor)
2007-04-04 02:34:33 +00:00
Brian Somers
b29cf88e96 Fix a typo 2007-04-03 19:14:39 +00:00
Chin-San Huang
5b4c58dff5 - Add myself.
Approved by:	delphij@ (mentor)
2007-04-03 06:02:49 +00:00
Yaroslav Tykhiy
e9a0eed451 Don't forget to close the range if we branched over its end
and had no chance to match it by the 2nd address precisely.
Otherwise the unclosed range would bogusly extend to the end
of stream.

Add a basic regression test for the bug fixed.  (This change
also fixes the more complex case 5.3 from `multitest.t'.)

Compared with:	SUN and GNU seds
Tested by:	regression tests
MFC after:	1 week
2007-04-02 08:14:46 +00:00
Yaroslav Tykhiy
b1b46280cb Prevent foot-shooting in advance: Put the MATCH() macro's value
in parentheses.  The ?: operator has a remarkably low precedence, so
expressions like (MATCH(foo) && bar) would have an unexpected meaning
w/o the parentheses around MATCH().

Tested with:	md5(1)
2007-04-02 06:47:48 +00:00
Yaroslav Tykhiy
6b8ef68111 This trivial change should fix at least 3 similar bugs. All of
them are related to the `c' function's need to know if we are at
the actual end of the address range.  (It must print the text not
earlier than the whole pattern space was deleted.)  It appears the
only sed function with this requirement.

There is `lastaddr' set by applies(), which is to notify the `c'
function, but it can't always help because it's false when we are
hitting the end of file early.  There is also a bug in applies()
due to which `lastaddr' isn't set to true on degenerate ranges such
as `$,$' or `N,$' if N appears the last line number.

Handling early EOF condition in applies() could look more logical,
but it would effectively revert sed to the unreasonable behaviour
rev. 1.26 of main.c fought against, as it would require lastline()
be called for each line within each address range.  So it's better
to call lastline() only if needed by the `c' function.

Together with this change to sed go regression tests for the bugs
fixed (c1-c3).  A basic test of `c' (c0) is also added as it helped
me to spot my own error.

Discussed with:		dds
Tested by:		the regression tests
MFC after:		1 week
2007-04-01 13:25:03 +00:00
Colin Percival
a92fcfb26e Add tests for "bsdtar -t". These are useful primarily because they test
the archive_read_data_skip code.
2007-03-31 22:04:36 +00:00
Colin Percival
0260ab4f4e Split the append_archive function (used for processing @<archive> directives)
into separate append_archive and append_archive_filename functions; the first
takes a "struct archive *" as input, while the second takes a filename, opens
the archive, and calls the first.

There should be no changes in behaviour as a result of this commit; it simply
reorganizes code to make more sense.  At some point in the future it may be
possible to share code between append_archive and read_archive, but not yet.

Discussed with:	kientzle
2007-03-31 10:14:03 +00:00
Yaroslav Tykhiy
c691c0ed18 Make the comment for cspace() match reality. 2007-03-31 09:08:22 +00:00
Xin LI
095385a17b Update for bzip2 1.0.4 import. 2007-03-28 07:48:03 +00:00
Maxim Konovalov
7f61ad1c2b o Really commit typo fixes to HEAD.
PR:		docs/110809
Submitted by:	naddy
2007-03-25 18:37:59 +00:00
Tim Kientzle
033583fc78 Issue a warning if there's a non-zero exit value. 2007-03-24 03:25:49 +00:00
Jung-uk Kim
778ee3c639 Add '-s' option and update the manual page. With this option, it prints
little more style(9) friendly output.  For example:

%file2c -n 8 -s -x 'const char data[] = {' '};' < /etc/motd
const char data[] = {
	0x46, 0x72, 0x65, 0x65, 0x42, 0x53, 0x44, 0x20,
	0x37, 0x2e, 0x30, 0x2d, 0x43, 0x55, 0x52, 0x52,
	0x45, 0x4e, 0x54, 0x20, 0x28, 0x42, 0x45, 0x41,
	0x53, 0x54, 0x49, 0x45, 0x29, 0x20, 0x23, 0x30,
	0x3a, 0x20, 0x57, 0x65, 0x64, 0x20, 0x4d, 0x61,
	0x72, 0x20, 0x32, 0x31, 0x20, 0x31, 0x39, 0x3a,
	0x30, 0x34, 0x3a, 0x33, 0x36, 0x20, 0x45, 0x44,
	0x54, 0x20, 0x32, 0x30, 0x30, 0x37, 0x0a
};
2007-03-23 00:00:22 +00:00
Ed Maste
f487a6a811 Use proc name (ki_comm) instead of thread name (ki_ocomm) as these may now
be different.
2007-03-22 17:47:58 +00:00
Colin Percival
fa21517ed8 Remove pathlen argument from write_entry function. It has never been used.
Approved by:	kientzle
MFC after:	3 days
2007-03-17 19:18:29 +00:00
Colin Percival
486641fcc5 Fix logic bug; we want to do_chdir if arg doesn't start with / _and_ it
doesn't start with @/ either.

This unbreaks "tar -c -C /no/such/directory @/path/to/archive".

MFC after:	3 days
2007-03-17 16:17:14 +00:00
Xin LI
2bab61b0b4 Mention a limitation that was inherted from RFC1952, making
it impossible to obtain correct file size from a file that
is larger than 4GB before compression.

PR:		bin/110329
MFC after:	1 week
2007-03-16 03:50:53 +00:00
Colin Percival
5e85b65e97 Don't consider an lstat(2) failure to be an error (in the sense of
affecting the return value from bsdtar), since (a) it usually occurs
due to a perfectly innocent (and unavoidable) race condition where a
user deletes a file in the window between bsdtar reading a directory
and attempting to read the file; and (b) aside from printing a warning
message, bsdtar behaves exactly as if the file had been deleted prior
to bsdtar reading its parent directory.

Reviewed by:	kientzle
MFC after:	6 days
2007-03-15 10:11:38 +00:00
Diomidis Spinellis
d6eb3444a3 Test files repo-copied into tools/regression/usr.bin/sed and integrated
into the regression testing framework.
2007-03-14 13:43:32 +00:00
Colin Percival
4d41b13b4e Reduce the risk of inducing heart attacks, by printing the right path when
complaining about lstat(2) failing.  It's a bit scary to find the message
  tar: /: Cannot stat: No such file or directory
printed while doing a backup.

MFC after:	1 week
2007-03-14 07:30:51 +00:00
Tim Kientzle
1267d00111 Clarify the test comments in test-basic.sh. Have config.sh do a
better job searching for the bsdtar binary to test and the gtar binary
to use for inter-operability testing.  It should now find the built
(but not installed) binary if there is one, then search for an
installed binary in a number of standard locations.
2007-03-11 19:33:45 +00:00
Tim Kientzle
45d4d7ac8c bsdtar 2.0.23:
* New test scripts exercise some basic functionality
   * Most header inclusions are now protected (portability)
   * read.c now relies on security checks in libarchive instead
     of trying to do its own (optimization)
   * -p now enabled by default for root, add --no-same-permissions
     to disable it
   * Comments, minor style fixes.
2007-03-11 10:36:42 +00:00
Michael Bushkov
5f6af5a919 Add myself.
Approved by:	brooks (mentor)
2007-03-11 06:44:37 +00:00
Martin Blapp
5c550a8a5f Uppercase FreeBSD, sigh. 2007-03-10 18:31:33 +00:00
Martin Blapp
29f12f6e3f Add myself 2007-03-10 18:30:12 +00:00
Christian Brueffer
4806fea24e Uppercase FreeBSD. 2007-03-10 12:45:46 +00:00
Ruslan Ermilov
bdf3513904 Bump the original revision of c89(1). 2007-03-10 07:11:20 +00:00
Ruslan Ermilov
bf78e6dabb Reduce diffs with c99(1). 2007-03-10 07:10:01 +00:00
Kirk McKusick
67562496ad Add myself. 2007-03-10 05:56:05 +00:00
Ruslan Ermilov
228978c1b8 Sort (once again) by month/day/year/login. 2007-03-09 20:31:46 +00:00
Johann Kois
ddf3a67d31 Add my record.
Discussed with and approved by: remko@
2007-03-09 20:14:59 +00:00
Ed Maste
f9feee175b KERN_PROC_ALL produces a kinfo_proc for each thread in a process, which
caused fstat to produce duplicated output for threaded processes.  Instead
use KERN_PROC_PROC to get just one kinfo_proc per process.

MFC After:	2 weeks
2007-03-09 16:21:40 +00:00