Commit Graph

1819 Commits

Author SHA1 Message Date
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