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.
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.
- 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...)
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.
> 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.
> 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.
$ /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.
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.
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.
- 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.
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.
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.
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.
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.
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.
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.
-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.
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.
>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.
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.
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).
- 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.
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).
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.
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].
* 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.
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.
- 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
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.
point to a tty.
Unfortunately the shell assumed that it could do all process group
handling ioctls to fd=2, but this is not correct. Jobs that redirected
fd=2 would be unable to perform the ioctls and silently fail since
the error reporting channel is fd=2... Instead open /dev/tty set
it to close on exec, and use that instead (like all other shells
do). We don't handle the case where the OS does not provide FD_CLOEXEC
or FIOCLEX, because I am lazy.
While I am there:
- Simplify the code by defining functions for tc{g,s}pgrp when OLD_TTY_DRIVER
is defined.
- make sure that 'sh &' works by stopping itself. Don't kill the shell's
process group, kill the shell itself.
infrastructure and using that infrastructure in programs.
* MKHESIOD, MKKERBEROS, MKSKEY, and MKYP control building
of the infratsructure (libraries, support programs, etc.)
* USE_HESIOD, USE_KERBEROS, USE_SKEY, and USE_YP control
building of support for using the corresponding API
in various libraries/programs that can use it.
As discussed on tech-toolchain.
commit where pipeline commands didn't inherit the correct process group.
Reviewed by Christos.
Change a trace format string arg to use %p instead of %x and a long cast.
type as we get the data passed from the kernel. This avoids (missing)
sign extension bugs on LP64 systems and partly takes care of PR 15677.
We now print this values as negative seconds - still wrong, but that
probably is due to the simple way this values are acumulated in the
scheduler, causing negative times when ntpd steps time backwards.
the syntax maps to determine the beginning and end quotes (kill
CENDQUOTE). Handle single quotes opening and closing via checking
the current syntax map. Keep a bitmap of doublequote state one bit
per variable nesting level. For the first 32 nested double quotes,
we don't need any additional memory, but for more we allocate
dynamically.
(alternate directory for id info) if SMALL is defined
- enable -DSMALL and remove unused objects if CRUNCHEDPROG is defined
- minor cleanup in next_file() (preparation for future work)
round has been tested on Solaris/x86 and Linux hosts.
* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
be done from dbdir/master.passwd and dbdir/group, using simple text file
parsing routines from ../../usr.sbin/mtree/getid.c.
This does not affect the -G and -U options, which always use the
system databases.
- Add strsuftoull(), which parses a number into a u_longlong_t, with
multiplication support, and support for 'g' (GB) and 't' (TB) suffices.
If an error occurs, print to stderr and exit.
Based on get_blk() from args.c and strsufto*() (in other programs)
- Add strsuftoullx(), which acts as per strsuftoull() but returns the
error in the supplied buffer instead (if the returned buffer != "", an
error occurred)
- Replace get_bsz() use with strsuftoull()
- Remove (now) unnecessary argument validation
- Remove unused {f,p,s,t}_stats fields in struct IO
if we are not going to use reachover makefiles for ksh (and given that
pdksh does not update very frequently (at all? any more? at the moment?),
it is probably reasonable not to).
alias expansion inside the switch as appropriate. This is achieved by a
flag noalias which is turned on and off in as we parse. In the following
example [1] and [0] indicate the value of noalias.
[0] case <expr> in
[1] <lit> ) [0] <expr> ;;
[1] <lit> ) [0] <expr> ;;
...
[1] esac [0]
FreeBSD does:
[0] case <expr> in [1]
<lit> ) <expr> ;;
<lit> ) <expr> ;;
...
esac [0]
This handles the following shell script:
alias a=ls
case $1 in
a) echo a;
a;;
f) echo f;;
*) echo default;;
esac
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.
If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.
Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
leaving the ansi stuff)
- use longlong_t instead of quad_t (etc), and rename *uqd*() -> *ull*()
- clean up the NET2_STAT stuff similar to ftpd; provide #defines and
macros which select which cast to use, etc
- clean up the NET2_FTS and NET2_REGEX #define use
- fix bug where the 'clear' flag was set outside of main loop, so
"dump,uchg,arch" on a file with flags would clear all the bits
(because "dump" sets 'clear'). noted in FreeBSD PR 10071, and fix
obtained from FreeBSD.
- enforce right-most priority on arguments by clearing the appropriate
bit in the opposite set; if a string of "nouchg,uchg" is given,
chflags(8) would clear uchg because it applies the "set" bits before
clearing the "clear" bits. now, "uchg" sets UF_IMMUTABLE in setp
and also resets it in clrp, solving this problem
- constify second arg (the `default' arg)
ChangeLog entry:
Mon Jan 29 10:12:31 NST 2001 Michael Rendell (michael@garfield.cs.mun.ca)
* c_exec.c(execute): added rv_prop flag to prevent if/while/for/...
in the presence of "set -e" from causing the shell to exit.
Example:
set -e
(false && echo hi)
[exits shell though it shouldn't]
ChangeLog and example provided by pdksh maintainer, Michael Rendell.
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).
Improved by comments from enami and christos -- thanks!
Heimdal/krb4/KAME changes already fed back, rest to follow.
Inspired by, but not not based on, OpenBSD.
(i.e. processes started from shell scripts). Fixes problem where kill -STOP'ing
a subprocess of a shell script would cause the shell to proceed to the next
command.