Commit Graph

2018 Commits

Author SHA1 Message Date
kristerw
7b4c88f831 Correct which _usage function to use for some pax/cpio error cases. 2003-01-15 21:56:46 +00:00
christos
51457e8842 Make sure that UPEOF is compared to the right type on the left hand
side. Sometimes it was compared to int, which was -1 on EOF, and on
unsigned char machines UPEOF was (unsigned char)-1. This worked
by chance because isalpha((unsigned char)-1) returns false usually,
but it does not when the locale is invalid!
2003-01-12 20:26:53 +00:00
christos
096c9d6313 remove debugging printf's I accidentally committed. 2003-01-09 18:24:08 +00:00
christos
a86cae9911 PR/19757: Andreas Wrede: make tar's -h behave like pax's -L 2003-01-09 17:26:21 +00:00
christos
e1a41a0e25 print a bit more info about checksum mismatches. 2003-01-09 17:22:26 +00:00
christos
a17201f05e allow this to be compiled with unsigned-chars. 2003-01-09 13:57:26 +00:00
wiz
1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz
a2278794f4 descriptor, not decriptor. 2003-01-06 13:19:51 +00:00
wiz
7e681f7063 interrupt with two rs. 2003-01-06 13:04:54 +00:00
pooka
732f4c9fa5 Add ${MACROS} to ${ROFF} usage to make output readable
from jbernard@mines.edu in misc/19685
2003-01-05 12:24:22 +00:00
wiz
617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
wiz
42ff734863 Restore word that got removed when -v was added. 2002-12-28 21:16:49 +00:00
wiz
5673b28631 Whitespace nits. 2002-12-28 21:15:24 +00:00
uebayasi
80a4544dcd trap '' SIGINT -> trap '' INT. 2002-12-28 05:08:27 +00:00
jrf
46164a8a95 The previious ln commit did not have the change for -v in the source. Here is the working code. 2002-12-27 03:50:05 +00:00
jrf
1f6c14f0d6 Added verbose extension and updated manual pages. Changes approved by Klaus Klein. 2002-12-26 21:37:17 +00:00
wiz
99bdb6a773 For each, not Foreach; from Adrian Mrva. Begin new sentence on new line. 2002-12-21 13:09:57 +00:00
kleink
1bb01b56ab Catch up with gen_subs.c rev. 1.27: the verbose output for symbolic links
is plain ls -l.
2002-12-19 22:54:44 +00:00
kleink
1c8b4d7b62 Change verbose output for symbolic links from "%s => %s" to "%s -> %s",
which matches ls(1) (per POSIX), as well as GNU tar output.
2002-12-19 22:44:31 +00:00
kleink
9273e5b038 Another it's -> its. 2002-12-19 18:04:41 +00:00
grant
5a72c72255 Fix oops in last, chown() failure should be fatal.
Noted by Charles Hannum.
2002-12-19 14:23:53 +00:00
grant
3ac4c54a34 Don't attempt to chown files if euid != 0, and make chown() non-fatal
if it does fail.

This addresses my PR bin/18912 (running pkg_info as non-root user on a
binary package).
2002-12-19 14:02:54 +00:00
wiz
5911fe5347 Drop trailing whitespace. 2002-12-18 20:28:51 +00:00
kleink
c8ae14b05c Add -v to SYNOPSIS, clean up STANDARDS a little. Also, bump date for -v. 2002-12-18 12:15:41 +00:00
jrf
4e81454aa9 Added a -v verbose option to the cp(1) command. Updated man page and utils as well. This applies to PR bin/16834. This change was approved by Christos. 2002-12-16 14:44:14 +00:00
provos
4ff1bfdbd5 allow logging for untranslated syscalls; from anil@recoil.org 2002-12-15 19:05:31 +00:00
uebayasi
60ad876a43 `` [n1]>&n2 Duplicate standard output (or n1) _TO_ n2.'' 2002-12-12 11:50:40 +00:00
christos
d4ba6227bf fix horrible side effect introduced by changing the append mode into archive.
The append mode already did that, so we always ended up overwriting the archive.
2002-12-12 05:00:42 +00:00
christos
aa0e549885 PR/19453: Christopher Richards: Call setlocale() in /bin/sh 2002-12-11 19:12:18 +00:00
christos
8461b5b85f PR/19339: Martin Weber: Tar fails to append on empty files and exits with
0. Revert previous change for PR/18689. We always want to exit with
an error if we could not determine the archive format. Instead,
treat empty files specially. On list/extract we turn into no/op.
On append, we turn into archive.
2002-12-10 18:33:26 +00:00
mrg
bad4b3376e oops, remove a debug statement from the previous. 2002-12-08 02:00:10 +00:00
mrg
c3510d1409 add --exclude support.
XXX:  --exclude & --exclude-from are still not 100% compatible, but since
rafal fixed --exclude-from's most annoying bug, they mostly work now.
2002-12-08 01:35:12 +00:00
scw
f7aebc0017 Cast from register_t to void * via intptr_t. 2002-12-06 09:49:36 +00:00
thorpej
5759456a18 Avoid confict with reserved identifier "log". 2002-12-06 01:43:18 +00:00
thorpej
c87e2cf550 Avoid conflict with reserved identifier "exp". 2002-12-06 01:39:10 +00:00
provos
fec70f4a84 typos; fgsch@olimpo.com.br 2002-12-05 19:33:39 +00:00
wiz
90c017d88f Fix typo. 2002-12-05 16:52:07 +00:00
grant
de04ce3463 don't print archive summary twice. 2002-12-05 01:38:05 +00:00
provos
e9f87b6c2c better parsing of # comments 2002-12-04 03:19:05 +00:00
lukem
764c86e2b1 don't need -lutil here 2002-11-30 03:16:14 +00:00
lukem
e825428033 don't need -lutil any more 2002-11-30 03:12:55 +00:00
lukem
550a64a8e9 convert to using strsuftoll(3) from libc 2002-11-29 13:11:10 +00:00
rafal
7d4cb139a3 Fix lossage with the GNU-tar -X compatibility code: the replacement pattern
code did not properly deal with the fact that the replacement patterns built
by the -X code were on the stack, happily saving pointers into last weeks'
stack into the REPLACE structures.

Now, the replacement string is strdup'ed so it doesn't matter where the
original expression came from or it's lifetime.
2002-11-29 04:54:48 +00:00
grant
3c0fae1fef void functions should not return a value. 2002-11-27 18:40:34 +00:00
agc
1aafd1a470 Include <stdio.h> to get the prototype for sprintf(3) - macppc needs this. 2002-11-25 21:55:58 +00:00
christos
34100a1996 sent cont to jobs so that they can exit without an fg when killed. 2002-11-25 14:23:07 +00:00
agc
ea1d615943 Make this compile on some of the more esoteric architectures (e.g. those
which are not i386)
2002-11-25 12:13:03 +00:00
provos
da50ee4397 prevent attempt to use in-kernel fastpath for aliased system calls. 2002-11-25 06:25:09 +00:00
chs
e5d34beb3e in mkpath(), don't try to stat() the to-be-created directory beforehand,
just try to create it and interpret any error appropriately.
this fixes a problem where multiple "mkdir -p" processes can race,
with the loser returning a spurious error.
2002-11-24 23:40:07 +00:00
christos
c02b3bbdf4 Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)
2002-11-24 22:35:38 +00:00
provos
048da773ed error messages need to go to stderr 2002-11-23 17:42:45 +00:00
ragge
0ccd7cbd86 It's a very bad habit to store file sizes in int's, so change it to off_t
instead. Obviously noone has tried to rcp files larger than 2GB.
2002-11-22 21:46:02 +00:00
kim
1645c7e955 Use shell glob expansion in the csh example, instead of ls with glob.
Reported by Jerry Peek <jpeek@jpeek.com>.
2002-11-21 15:02:03 +00:00
itojun
6bf8c47b32 we can't do {} while (0) for TEST() macro since it has "break" which
goes out of the switch statement.  from shin-ichi kaneta.
2002-11-16 13:42:36 +00:00
provos
49d6b23841 check for trans_size is not needed. 2002-11-15 21:36:25 +00:00
jdolecek
0c1316b88d default to "$HOME/.kshrc" if ENV is not set 2002-11-11 19:03:57 +00:00
enami
0cb758feb5 Default .Ar arugment is sufficient. 2002-11-09 12:27:53 +00:00
enami
54a944c353 Cosmetic changes. 2002-11-09 12:27:08 +00:00
wiz
4b956b29cf Drop a trailing space. 2002-11-06 14:56:48 +00:00
enami
71fcff6ce3 Let the roff to process the end of sentence. 2002-11-06 04:03:25 +00:00
enami
230caefde1 - Remove the last __P.
- Don't put space between function name and () op.
2002-11-05 04:49:05 +00:00
provos
695ad5ee17 add support for regular expressions to be more flexible with policy string
matching.
2002-11-02 20:04:20 +00:00
provos
c27faa29c9 performance improvement by omitting a redundant getcwd. 2002-11-02 19:57:02 +00:00
provos
98c03e54fd register pidname and signame translation for kill(2) 2002-11-02 19:49:21 +00:00
provos
c989923700 rename exported variables to avoid name space polution. 2002-11-02 19:43:27 +00:00
provos
e93fe1e2ba NULL to 0; from navin@gdit.iiit.net 2002-11-02 16:27:46 +00:00
itojun
8b5e86873c typo, reported by avsm@openbsd 2002-10-31 23:01:27 +00:00
wrstuden
5b0a9938fd Use signed char to replace int8_t, not just char. Should fix macppc
cross-build problems introduced in rev 1.59.

Pointed out by Valeriy E. Ushakov uwe at ptc dot spbu dot ru on
tech-toolchain.
2002-10-31 17:14:46 +00:00
kleink
ade418e6fd Revert rev. 1.16, as per PR kern/17411.
While a hard link to a symbolic link is not ruled out by POSIX-2001,
the ln(1) utility (sans -s) is to perform equivalent to the link(2)
function on its operands, which includes the resolution of symbolic
links in source_file arguments.
2002-10-30 22:52:10 +00:00
provos
5f7d4eab6c fix bug in determining execve name 2002-10-30 17:39:34 +00:00
provos
e9ac78c504 allow empty string 2002-10-29 15:44:38 +00:00
provos
4df7def23e missing break; from grange@rt.mipt.ru 2002-10-28 16:50:05 +00:00
christos
0ec6ea57f7 PR/18831: Andreas Wrede: Don't exit with an error when we are reading a gnu
tar archive.
2002-10-27 20:48:15 +00:00
christos
dde7426849 From David Laight
> The wrong process is aborting when variable assignment fails
> in the vfork path.  So the following command fails to execute
> the second echo (shown here with the correct output).
>
> $ (readonly r; r= /bin/echo a; echo b)
> r: is read only
> b
>
> fix: defer the mklocal() to the child shell.
2002-10-23 19:46:34 +00:00
christos
f3dfd6e686 From David Laight:
> Also 'jobs' fails in a non-interactive shell.
> In showjobs(), the code that puts the process back into its
> own process group should only be run if the shell is actually
> doing job control - eg if 'mflag' is set.
2002-10-23 19:46:06 +00:00
christos
18c0c9959d ignore files that contain "..", not symlink sources. 2002-10-23 19:39:42 +00:00
christos
6166cc6e93 Fix interrupt problam from David Laight
$ /fred # non existant command
$ ^C # stops working

He says:
    Ok the extra INTOFF is the one in exverror().
    In almost all cases this doesn't matter because the longjmp()s
    all end up in main() and the FORCEINTON call sorts it out
    for the next command.
    (There are a significant number of INTON/OFF mismatches through
    the error paths...)

    In any case the above failure can be 'fixed' by changing 2 (I think
    they are both needed) INTON calls to FORCEINTON within evalcommand.
    The following patch seems to work:

We should really look in the code and fix the INTON->INTOFF pairs.
2002-10-23 13:25:24 +00:00
jdolecek
196f994fd8 use .Nx 2.0 consistently in HISTORY section
add .\" NEXTRELEASE tag before the .Nx to make it possible to quickly
  find version references in case this would need to be changed
2002-10-23 09:44:35 +00:00
lukem
ad24ec889c don't bother with cpio/tar links or compat symlinks for HOSTPROGs 2002-10-21 06:26:46 +00:00
thorpej
cf6763873c Install compatibility symlinks for /usr/bin/tar (-> /bin/tar)
and /usr/bin/cpio (/bin/cpio).  The pathname of tar(1) is hard-coded
into things like binary packages, and thus must be kept around
for backward compatibility.
2002-10-20 21:20:13 +00:00
christos
44303cad48 PR/18733: Jed Davis: stderr is not constant under linux and this is a host
tool.
2002-10-20 00:40:29 +00:00
provos
32b88027c7 use readlink with bufsize - 1; approved thorpej. 2002-10-19 20:33:17 +00:00
christos
2665f9c68c Only warn the user once about gnu extensions. From Eric Gillespie. 2002-10-18 15:55:08 +00:00
christos
ff3d818d91 Handle -C\ndir\n in a file containing a file list. From Eric Gillespie. 2002-10-18 13:45:05 +00:00
itojun
8eb125554b exit with 0 if the input is empty of not a tar file. matches GNU tar behavior.
solves PR 18689.
2002-10-18 11:54:22 +00:00
itojun
68603e5242 correct use of format string (signedness, %ldd). PR 18679 2002-10-17 23:50:17 +00:00
provos
04a469212b cleanup 2002-10-17 04:45:04 +00:00
christos
ed254499e5 Factor out some more code, and don't expand names in ././@LongLink records. 2002-10-17 01:08:22 +00:00
christos
860d26c69b Fix DEFOP botch. DEFOP == LIST so tar -tvf stopped working. (hi soren) 2002-10-17 00:42:02 +00:00
christos
4472ef1520 Add proper longlink support. Previously we handled longname support, and
the longlink support was completely wrong.
2002-10-17 00:32:36 +00:00
christos
69ea8215e0 add commas between options. Suggested by wiz. 2002-10-16 23:52:06 +00:00
soren
4ba08d1776 Tweak tar_usage(). 2002-10-16 23:37:49 +00:00
soren
af892f930e Have tar require a specific action as documented. 2002-10-16 23:22:59 +00:00
soren
f9d5774005 Sync cpio_usage() with cpio.1 as with pax and tar. 2002-10-16 22:38:36 +00:00
christos
4dbb5fa93c grr, I put these in the wrong spot. 2002-10-16 21:49:08 +00:00
christos
24dd1a7d61 Document the long options. 2002-10-16 21:47:13 +00:00
christos
169f625866 we need to have -force-local on pax. 2002-10-16 21:45:31 +00:00
christos
f830cb1865 turn gnu tar off by pax and cpio front ends. 2002-10-16 18:53:40 +00:00
christos
706c1ce906 Flip the pax switch 2002-10-16 15:23:59 +00:00
itojun
553d79070e \n before new sentence. 2002-10-16 14:58:33 +00:00
itojun
e8745f23b6 sync better w/ openbsd tree (cosmetic) 2002-10-16 14:56:11 +00:00
christos
650f61c526 Warn if we are trying to read a gnu tar archive, if --strict is specified. 2002-10-16 04:40:55 +00:00
christos
f70dfaaf73 Support gnu long filename extensions by default for tar on create, list, and
extract. We now generate GNU tar archives by default ("ustar  ^@" instead of
"ustar^@00"). GNU extensions can be disabled with --strict.

XXX: long symlinks untested.
2002-10-16 03:46:07 +00:00
christos
ca541391bc PR/18663: Jeremy Reed: pax/tar/cpio allows ".." in names.
We now disallow it by default on both archive creation and extraction.
Add --insecure option to override.
2002-10-15 16:16:29 +00:00
christos
675306eb0e implement fast read. nothing to it really, it was already there as -q option. 2002-10-15 14:58:53 +00:00
christos
9a9c32e167 Add all the gnu cpio long options. 2002-10-15 14:51:04 +00:00
lukem
e490a5c798 don't compile in `-h' as a synonym for the command that the argument is for.
this fix is hokey, but works as well as the previous solution for -j.
2002-10-15 04:15:58 +00:00
lukem
7f200231eb fix previous: SMALLPROG w/o HOSTPROG still needs <bsd.prog.mk>. (hi christos) 2002-10-14 16:03:51 +00:00
soren
f05dd4bfd6 Sync tar_usage() with tar.1. 2002-10-14 15:04:41 +00:00
christos
7e35f7247f don't support rmt for SMALLPROG 2002-10-14 14:41:22 +00:00
christos
8ffc5b1c59 -T expects an argument. From Eric Gillespie, thanks. 2002-10-13 17:23:40 +00:00
christos
011898cd8e Fix error in counting the archive's name length. From Eric Gillespie, thanks! 2002-10-13 17:21:50 +00:00
christos
cd1f9fe466 If the archive refers to stdin, the archive's name is null. Check for
null when we see if it refers to a remote file. From Eric Gillespie, thanks!
2002-10-13 17:19:33 +00:00
mrg
a9a7ae57f7 fix "pax -rw" processing. for some reason, it was now written to process
"pax -rwvpe a b" as "pax -rwvpe b a", and "pax -rwvpe a b c" as
"pax -rwvpe b c a".  only the part of revision 1.40 that broken this has
been reverted.
2002-10-13 11:31:02 +00:00
mrg
20bac70304 make this build on LP64 2002-10-13 00:34:16 +00:00
mrg
ed83539f6e add a "+" to the options string rather than setting POSIXLY_CORRECT 2002-10-13 00:32:09 +00:00
mrg
9b3e4b9e61 include <string.h> for mem* and str* 2002-10-13 00:31:28 +00:00
wiz
eb12ddd1f9 Miscellaneous fixes. 2002-10-12 22:36:01 +00:00
thorpej
6fe78b30af Only include <rmt.h> if SUPPORT_RMT. 2002-10-12 19:21:12 +00:00
thorpej
32c48247e8 It doesn't help much to skip linking librmt if HOSTPROG but leave
all the librmt calls in the program.  So, make librmt support conditional
on #ifdef SUPPORT_RMT, and define that when NOT building as a HOSTPROG.
2002-10-12 18:49:28 +00:00
christos
0c61202168 merge OpenBSD changes:
- correct -C processing
    - add ability to read filenames and flags from a file
    - don't print dangerous escape sequences to the terminal
    - use strlcpy/strncpy properly.
    - handle tmpfile creation better.
    - improve documentation of options.
    - handle stdout/stderr list selection correctly.
    - kill gzip when we get interrupted.
    - simplify gzip setup.
    - add more flags to programs.

additional changes:
    - librmt processing.
    - set POSIXLY_CORRECT in options parsing.
    - prevent more string overruns.
    - support -T

we don't turn the switch on to replace tar and cpio yet.
2002-10-12 15:39:29 +00:00
christos
b73dcc21ce man pages from OpenBSD.
TODO: add long option documentation.
2002-10-12 15:30:54 +00:00
wiz
71c3607b93 Miscellaneous fixes by Martin Weber (ephaeton at that gmx net thingy). 2002-10-12 00:02:47 +00:00
provos
690d7c3ad0 fix type; its "as :group" 2002-10-11 23:31:00 +00:00
provos
61e8c76047 support for privilege elevation.
with privilege elevation no suid or sgid binaries are necessary any
longer.  Applications can be executed completely unprivileged. Systrace
raises the privileges for a single system call depending on the
configured policy.

Idea from discussions with Perry Metzger, Dug Song and Marcus Watts.
Approved by christos and thorpej.
2002-10-11 21:54:55 +00:00
christos
35bdad4ed7 str{n,l}cpy fixes and buffer limit fixes from OpenBSD 2002-10-11 13:07:36 +00:00
provos
931062ce16 translation for socket system call 2002-10-11 04:40:11 +00:00
provos
c603c2b26f enable meta key in emacs mode for 7-bit locales. approved thorpej. 2002-10-10 17:41:19 +00:00
provos
1b3623c27a correctly evaluate group predicates 2002-10-10 14:06:30 +00:00
provos
306becc9b9 add A to usage; noted by nickus@mpi-cbg.de 2002-10-08 14:50:57 +00:00
provos
89afc325c0 predicates are part of the grammar now; in non-root case, predicates are
evaluated only once; in root case, predicates and variable expansion are
dynamic.
2002-10-08 14:49:23 +00:00
itojun
ed21532463 "output" is a pointer of size "outlen", so use outlen instead of
sizeof(output)

From: "Vincent Labrecque" <vincent@psyfreaks.ca>
2002-10-08 02:47:59 +00:00
christos
1ce87c4b29 - it is wrong to put inton/intoff arount ckmalloc(), because the code
around it is the one that does this.
- whitespace fixes.
2002-10-07 14:26:49 +00:00
christos
202746f803 explain what's breaking with alignments > 16, but no fix yet. 2002-10-07 14:26:08 +00:00
provos
4b7278c7f2 use FNM_LEADING_DIR 2002-10-06 03:16:25 +00:00
provos
9008ac33c8 assume that inserting a template implies permit for the current syscall 2002-10-06 01:28:55 +00:00
christos
b9d3050e20 Rename ALIGN to SHELL_ALIGN and simplify macro so that it does not have side
effects, and add double to it, so that it aligns doubles correctly too. This
is just a workaround to fix the sparc64 problem where ALIGN() is now defined
in some include file to be 16 instead of 8. Thanks to martin for debugging this.
2002-10-04 13:15:51 +00:00
wiz
881c258156 additional and positive with two is. From Adrian Mrva. 2002-10-02 15:59:51 +00:00
wiz
06bd76cf9a parameter, not paramter. By Adrian Mrva. 2002-10-02 15:58:04 +00:00
wiz
1da66f1f4c filesystem -> file system, automaticly -> automatically. 2002-10-02 10:01:46 +00:00
wiz
1d605b2386 evironment -> environment. 2002-10-02 09:57:14 +00:00
wiz
f3e4defc56 Use more mdoc. 2002-10-01 15:11:08 +00:00
wiz
2e6e2165c0 Use more mdoc, particularly to get rid of some \*[Lt] and \*[Gt]. 2002-10-01 15:06:31 +00:00
provos
a79af4d624 fix return value; from marius@umich.edu 2002-09-28 17:56:54 +00:00
mycroft
6092f7d52b Revert the previous for now. This is truly gross. 2002-09-28 03:15:43 +00:00
mycroft
7973b7a0ac Remove the duplicate setpgid() in forkparent(). The real bug was freeing the
job structure in the child and referencing freed memory.
2002-09-28 03:08:00 +00:00
christos
4783843fdc Revert previous change. No need to save rootshell. It is only affecting
the non-vfork case. Having said that, it would be nice if pipelines of
simple commands were vforked too. Right now they are not.
Explain that setpgid() might fail because we are doing it both in the
parent and the child case, because we don't know which one will come
first.
Suspending a pipeline prints %1 Suspended n times where n is the number
of processes, but that was there before. It is easy to fix, but I'll
leave the code alone for now.
2002-09-28 01:25:01 +00:00
christos
6f48233483 Deal with rootshell not being maintained correctly in the vfork() case.
Propagate isroot, throughout the eval process and maintain it properly.
Fixes sleep 10 | cat^C not exiting because sleep and cat ended up in
their own process groups, because wasroot was always true in the children.
2002-09-27 22:56:24 +00:00
mycroft
d84d36165d Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()
screw with them now, only their callers.
2002-09-27 21:32:24 +00:00
thorpej
bb95e8cb62 Revert previous; the change that required it will be done differently. 2002-09-27 21:04:46 +00:00
christos
ad1e7bca30 off by one in nprocs. 2002-09-27 21:04:08 +00:00
christos
35975338b0 Put back charles' fixes from -r1.60 2002-09-27 20:24:36 +00:00
christos
edcb454443 VFork()ing shell: From elric@netbsd.org:
Plus my changes:
	- walking process group fix in foregrounding a job.
	- reset of process group in parent shell if interrupted before the wait.
	- move INTON lower in the dowait so that the job structure is
	  consistent.
	- error check all setpgid(), tcsetpgrp() calls.
	- eliminate unneeded strpgid() call.
	- check that we don't belong in the process group before we try to
	  set it.
2002-09-27 18:56:50 +00:00
mycroft
2aa6ebd4ed In evalpipe(), move the INTOFF after the waitforjob(), to prevent possible
race conditions -- now we always synchronously wait for the job to finish.
In evalcommand(), add the same INTOFF/INTON locking as evalpipe(), to prevent
leaving internal state inconsistent, and also to insure that we synchronously
wait for the job.
2002-09-27 17:37:12 +00:00
christos
6438e7dcdc no SYSV for eagain, enable EMFILE 2002-09-27 16:56:15 +00:00
thorpej
6a244932ed Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.

The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.
2002-09-27 15:56:39 +00:00
provos
0d78fff152 complete file names including a ~ correctly. 2002-09-27 13:23:55 +00:00
simonb
4bce9043f0 Need to initialise the blocksize variable if the -i option is used
too.  The code in display() could possibly be a bit smarter about this
requirement...

Fixes the problem in PR bin/18321 from David Laight and PR bin/18436
from FUKAUMI Naoki.
2002-09-27 12:01:51 +00:00
provos
4fd29e5dcf human-readable output via -h flag. output matches Linux and other BSDs.
partly from kstailey@openbsd.org.  approved itojun and perry.
2002-09-26 16:27:43 +00:00
wiz
6ab45c70b7 Begin new sentences on new lines. From Robert Elz (kre at munnari oz au). 2002-09-26 11:11:17 +00:00
wiz
14dfaa4b03 New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
2002-09-25 15:18:36 +00:00
provos
a94ce5a752 enable emacs mode, add tab key to do completion in emacs and vi mode.
from millert@openbsd.org.  approved by perry and thorpej.
2002-09-25 02:55:03 +00:00
provos
f9b44bb190 change complete-list to first complete and then print a list,
also complete after '=' (dd), and ':' (ssh) and ` (backtick)
improvements from camield@openbsd.org.  approved by perry and thorpej.
2002-09-25 02:41:11 +00:00
itojun
d584f0a0fc support for templates. they allow fast generation of new policies. an
appropriate template can be inserted during initial policy generation.
from provos
2002-09-23 04:35:41 +00:00
mycroft
826e316675 select() -> poll() 2002-09-21 18:15:57 +00:00
jschauma
9f40601644 comment out the (no longer) builtin newgrp 2002-09-20 20:57:58 +00:00
jschauma
b186175fa1 We don't have 'newgrp' -> ifdef the builtin alias. This prevents
the shell from unexpectedly dying if a user enters the (nonexistent)
'newgrp' command.  OK'd by perry.
As seen in OpenBSD.
2002-09-20 20:07:09 +00:00
itojun
ca5a36677b split white space and single line policy processing into separate
functions.  from provos
2002-09-17 05:07:21 +00:00
itojun
0b2d2fe3d7 daemon should not change the directory. from provos 2002-09-17 04:54:36 +00:00
itojun
c1261b4aff periodically save policies that have been modified. from provos
>here is a diff that will cause systrace to periodically save policies
>that have been modified.  Useful if you run systrace on an xterm and
>kill it accidently.  Or other applications like opera that are long
>running and can cause weird crashes.
2002-09-16 04:31:46 +00:00
thorpej
e41b1aa4a2 Use "unsigned char" and "char" instead of "u_int8_t" and "int8_t"
for TARGET_CHAR when building mksyntax.  This isn't perfect, but
it lets the host tool work on non-BSD systems without completely
redoing how sh is built.
2002-09-15 00:19:22 +00:00
sommerfeld
af723a4db0 Use the output blocksize when computing how much room to leave for the
-s option, to suppress unnecessary leading spaces.
2002-09-14 04:25:55 +00:00
thorpej
42321e369a Don't use MAX(); not all systems have it, and this is a host tool. 2002-09-13 18:07:52 +00:00
enami
caa54090d6 Add comment about my rev. 1.27 change. 2002-09-04 04:21:54 +00:00
tron
4fc0806163 Ignore EINVAL returned from fsync(2) because it is the expected error code
if we try to use it on a pipe.
2002-09-03 06:17:26 +00:00
enami
cef250dab9 Detect the last nfs write error. 2002-09-01 11:33:22 +00:00
itojun
c81b949059 allow # in system call name. remove trailing white space.
from provos
2002-08-30 17:09:31 +00:00
itojun
b6aefbe19f sync with latest systrace in openbsd tree. improved systrace with chroot. 2002-08-28 03:52:44 +00:00
lukem
ed401558f2 Implement MKDYNAMICROOT, which currently defaults to "no", but will
be changed in the future to "yes".

If MKDYNAMICROOT == "no", there is no change from existing behaviour
of a static /bin and /sbin (and a few programs in elsewhere).

If MKDYNAMICROOT == "yes", the following changes occur:
    in <bsd.own.mk>:
	SHLIBDIR?=     /lib
	SHLINKDIR?=	/lib
    in various Makefiles, the following entry is DISABLED.
	LDSTATIC?=-static
This results in all programs (except those "standalone" programs built
in sys/arch/*/stand) are linked dynamically, the shared linker is moved
from /usr/libexec to /lib (with a compat symlink), and the shared
libraries used by /bin and /sbin programs are moved from /usr/lib to
/lib (with compat symlinks).
2002-08-27 14:46:11 +00:00
lukem
146a774973 Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path (etc). 2002-08-19 09:56:00 +00:00
wiz
33bb527e01 Drop trailing whitespace. 2002-08-13 13:22:35 +00:00
sommerfeld
8f4d948b68 Improve some of the description of optional drive features. 2002-08-13 13:16:24 +00:00
itojun
c3ca2a9ab6 calloc() arg mistake. it's (nelem, size). from openbsd 2002-08-12 02:37:26 +00:00
soren
236006d5dc Remove extraneous \n's in {err,warn}{,x} that used to be printfs. 2002-08-08 13:24:12 +00:00
itojun
95c7243aec more effort to make it compile on platforms w/o linux emul 2002-08-02 14:29:34 +00:00
soren
e426c0fac8 Following FreeBSD's example, remove the old pre-statfs(2) code for
examining FFS filesystems directly. This also gets rid of df(1)'s
setgid operator bit.
2002-08-02 08:17:12 +00:00
christos
1eb5da90ed don't include utmp.h 2002-08-01 20:05:48 +00:00
wiz
0f88938132 Remove unneeded utmp.h include. 2002-08-01 18:41:34 +00:00
itojun
71a4240254 aenable linux systrace only on platforms that support it.
noted by hannken@eis.cs.tu-bs.de
2002-08-01 08:47:03 +00:00
itojun
2b8709b902 backout previous. mandoc(4) lies. 2002-07-31 00:28:02 +00:00
itojun
822deb809a .Bd -offset does not take numeric arg, but string. 2002-07-31 00:26:56 +00:00
jdolecek
bdd538626a re-apply part of rev. 1.4 - Explain why you would use this.
contrary to rev. 1.4, keep 'The options are as follows' sentence, since
this seems to be used more on system manpages
2002-07-30 21:58:25 +00:00
jdolecek
e9b2b4b074 re-apply changes in rev. 1.3 - Slight changes to the English. 2002-07-30 21:43:26 +00:00
wiz
93aef72209 Sort sections, Sh -> Ss in one place. 2002-07-30 17:06:58 +00:00
itojun
4f0c9c76b6 sync up with latest openbsd systrace.
- avoid race conditions by having seqno in ioctl
- better uid/gid tracking
- "replace" policy to replace args
- less diffs, as many of local changes were fed back to openbsd already

due to the 1st item, it was impossible for us to provide backward-compatibility
(new kernel + old bin/systrace won't work).  upgrade both.
2002-07-30 16:29:28 +00:00
soren
8f6326d364 A local copy of <sys/tree.h> is unnecessary. 2002-07-30 06:09:56 +00:00
wiz
7b9b4ac6f7 'environment', not 'enviroment' 2002-07-11 10:53:19 +00:00
wiz
98c072db3b Fix a typo in a comment. moritz@jodeit.org via OpenBSD. 2002-07-10 22:22:29 +00:00
bjh21
525b050279 Align default behaviour of chmod, chgrp, chown, and chflags with symlink(7),
IEEE 1003.1-2001 (where applicable) and other systems, by follwoing symlinks
on the command line and changing their targets' modes/ownership/flags, rather
than ignoring them.

This fixes PR standards/563 (at last).
2002-07-07 11:44:02 +00:00
atatat
11bb544ec0 Mostly just a rewrite of intercept_run() so the arrangement of "child"
process and "parent" process is more conducive to policy generation.
Previously, tracing of a given program worked something like this:

	fork()
	if (child)
		execprogram()
	else
		dotracing()

That means that if you "systrace -a named", named would fork and
background itself, but you would never get your prompt back because
systrace didn't exit.  Now it works like this:

	fork()
	if (interactive)
		if (child)
			execprogram()
		else
			dotracing()
	else
		if (parent)
			execprogram()
		else
			fork()
			if (parent)
				exit(0)
			setsid()
			dotracing()

This makes it *much* easier to do automated policy generation for
tasks run from rc.d.  Or, for that matter, makes it much easier to use
systrace with tasks run from rc.d.
2002-07-03 22:54:38 +00:00
enami
fa2d3031e1 The el option is an extention. 2002-07-03 01:27:23 +00:00
lukem
e0fcc669c4 Change how "cd .." is handled in next_file() with -M, to ensure that curdir[]
isn't addressed with a negative offset when back at the top of the tree.
This caused pax -M on sparc64 to generate corrupt tar files.
Problem found by Tim Goodwin <tjg@star.le.ac.uk> in [bin/17412].
2002-06-28 11:29:45 +00:00
wiz
716daf6160 Sort sections. 2002-06-26 15:29:43 +00:00
gmcgarry
28272e6493 Explain why you would use this. Reword a little and add some history. 2002-06-26 06:50:14 +00:00
kleink
7595143319 Note that -T is to be used with -l; synced with FreeBSD via Michal
Pasternak on current-users.
2002-06-24 20:14:35 +00:00
agc
1e4714b470 Slight changes to the English. 2002-06-20 10:07:42 +00:00
jdolecek
fc257046b9 g/c procfs fallback code, it's redundant now that we use sysctl to get
process info
2002-06-19 08:11:55 +00:00
thorpej
2265b1ff78 Fix warnings on Alpha: Cast to intptr_t to extract ints stored in void *'s,
and pull in proper prototypes.
2002-06-18 21:22:45 +00:00
thorpej
44e317ae3d Do the previous slightly differently. 2002-06-18 21:21:17 +00:00
thorpej
2623bb99b9 Add an extra cast to size_t when extracting an int stored in a void *.
(XXX Gross.)
2002-06-18 21:19:59 +00:00
itojun
3196ec98ba need ${.CURDIR} for linux_syscalls.c include 2002-06-18 09:52:04 +00:00
thorpej
4192e0aa5a Fix an include snafu pointed out by Matt Thomas. 2002-06-18 02:55:19 +00:00
thorpej
873bb550a0 Some const poisoning. 2002-06-18 02:49:08 +00:00
thorpej
0e0062e921 * Use CPPFLAGS for preprocessor flags, not CFLAGS.
* Don't -I/sys -- that breaks cross-building.  Instead, use relative
  pathnames in netbsd-syscalls.c, similar to what kdump does.
* No need to explicitly CLEANFILES the generated lex/yacc results.
* No need to link against libl and liby.
2002-06-18 01:37:12 +00:00
thorpej
5a040ec813 The SYSTR_CLONE ioctl is gone, so don't use it. (The kernel clones
the systrace communication channel as needed.)
2002-06-18 01:25:04 +00:00
wiz
b70e67425c No .Pp before .Sh, drop trailing space, sort sections. 2002-06-17 17:06:08 +00:00
wiz
c8c3c3fd5f Sort SEE ALSO. 2002-06-17 16:55:05 +00:00
christos
d09016d45a Document some missing flags and add systrace(1) 'x' flag. 2002-06-17 16:48:44 +00:00
christos
5039a9e5ee Add userland portion of systrace. 2002-06-17 16:29:07 +00:00
bjh21
4a9e799f0d Rather than (ab)using the standard error message for EFTYPE, print our own
message when "cat -f" is used on a non-regular file.  This is necessary to
make cat(1) portable to systems that don't have EFTYPE (like Linux).
2002-06-11 22:05:07 +00:00
bjh21
06cc08da90 Only use __RCSID() and __COPYRIGHT() if they're defined. 2002-06-11 22:01:30 +00:00
itojun
0f62c3f25a no need for \n on errx 2002-06-11 05:33:51 +00:00
mason
aa8bdf5f50 Add wrapper around bsd.prog.mk include in preparation for this becoming a
host tool.
2002-06-10 18:31:12 +00:00
mason
ec4fb122bd Add -l option to cat(1), as discussed on tech-userlevel. This option
causes cat(1) to use fcntl(2) to set an exclusive advisory lock on stdout.
While being useful in its own right, this will shortly be used to
guarantee orderly writing to METALOG in the case of unprivileged builds
with NBUILDJOBS > 1.
2002-06-10 07:43:33 +00:00
matt
acc63b5fea Add LL to 1099511627776 since it won't fit in a long on ILP32 systems. 2002-06-09 19:38:00 +00:00
bjh21
28ac946ca2 Fix a comment: POSIX doesn't specify -h. 2002-05-31 18:54:01 +00:00
christos
82886e162e deal with char c; c != -129 warning. Hi jason! 2002-05-31 16:18:48 +00:00
wiz
1da7ff99f7 Since we have rlim_t, use it.
Approved by kleink.
2002-05-28 22:12:25 +00:00
wiz
1815854042 __STDC__ is always defined on NetBSD. 2002-05-25 23:29:16 +00:00
wiz
10610e5a31 __STDC__ is always defined on NetBSD. 2002-05-25 23:12:16 +00:00
wiz
0b398b282c __STDC__ is always defined on NetBSD, so remove #ifdef __STDC__ (and
unnecessary #else cases).
2002-05-25 23:09:06 +00:00
bjh21
84c006d0f8 The printf builtin has been "temporarily" disabled for eight years. Remove
its directory from .PATH to avoid confusion.
2002-05-15 20:45:17 +00:00
bjh21
6f786375c4 Implement sh -a (allexport). Code (all two lines of it) from FreeBSD
(FreeBSD var.c 1.13, sh.1 1.27).
2002-05-15 19:43:29 +00:00
christos
f629aa28d9 implement noclobber. From Ben Harris, with minor tweaks from me. Two
unimplemented comments to go. Go Ben!
2002-05-15 16:33:35 +00:00
christos
eac955176d Implement unset variable error messages from Ben Harris. 2002-05-15 14:59:21 +00:00
kleink
31f7fb4902 Consistent wording: regular' files, not plain' ones; from Giorgos
Keramidas in PR bin/16824.
2002-05-15 06:52:54 +00:00
simonb
f1a6122c11 Simplify previous - sbuf.st_blksize is a uint32_t, so just use
bsize = MAX(sbuf.st_blksize, BUFSIZ);
and skip playing with SSIZE_MAX altogether.
2002-05-09 02:19:42 +00:00
thorpej
f8b11571bb Fix oversight in last. 2002-05-09 02:13:10 +00:00
thorpej
2ee7baad55 Skip a check that is always true if _LP64 is defined. 2002-05-09 02:07:38 +00:00
enami
b0d6c27ed1 - Use four space to indent continuation line.
- Put a space after the C language keyword ``switch''.
- Put an empty line if a function doesn't have local variable.
- Use do { } while (/*CONSTCOND*/ 0) instead of { } to protect a multi
  statement macro
2002-05-02 13:25:09 +00:00
enami
9ca32dd36a A default .Ar arugment is sufficient. 2002-05-02 13:14:23 +00:00
enami
cda5eec6df - Don't put space before function call operator.
- Remove trailing whitespace.
- Put an empty line if function doesn't have local variables.
- Use tab instead of spaces.
2002-05-02 13:07:01 +00:00
kleink
5f23bdba58 Add missing -p to synopsis; from Ryan Younce in PR misc/16555. 2002-04-29 19:47:01 +00:00
nathanw
43634bc5ba Since kinfo_proc2 has many values that are 64-bit, ps needs to know
that they're 64-bit, and grab them out of memory appropriately. Otherwise,
big-endian systems get the wrong end of the 64-bit value and lose.

Keywords affected: inblk, majflt, minflt, msgrcv, msgsnd, nivcsw, nsigs,
nswap, nvcsw, and oublk.
2002-04-24 21:41:22 +00:00
wiz
66a3e61375 "a, b, c, and d", not "a, b, c and d". 2002-04-24 08:58:33 +00:00
wiz
46f7269fa1 End sentence with a dot. 2002-04-21 00:10:09 +00:00
lukem
94f2b78379 - Directories marked `optional' won't be stored, even though their
contents will be.
- Document that `optional' faked-up entries won't be created.
2002-04-20 23:36:48 +00:00
lukem
a879a977d2 If an entry is in the specfile but not in the underlying file system, and it's
marked "optional", don't add it.
2002-04-12 04:44:08 +00:00
christos
de525ac6ca Try harder to find a tty. 2002-04-10 15:52:07 +00:00
thorpej
3ea17f6cff Move the declaration of digit[] into the #ifdef'd code block that
uses it.  Prevents a warning from gcc 3.2.
2002-04-09 00:52:05 +00:00