Commit Graph

227471 Commits

Author SHA1 Message Date
macallan
94fa2b1472 we don't need or want COMPAT_NETBSD32 in a 32bit kernel
should cure pkgsrc MACHINE_ARCH mismatches
2014-05-31 16:16:52 +00:00
christos
01f35fcceb PR/48843: Jarmo Jaakkola: dot commands mess up scope nesting tracking
Evaluation of commands goes completely haywire if a file containing
a break/continue/return command outside its "intended" scope is sourced
using a dot command inside its "intended" scope.  The main symptom is
not exiting from the sourced file when supposed to, leading to evaluation
of commands that were not supposed to be evaluated.  A secondary symptom
is that these extra commands are not evaluated correctly, as some of them
are skipped.  Some examples are listed in the How-To-Repeat section.

According to the POSIX standard, this is how it should work:
    dot:
        The shell shall execute commands from the file in the current
        environment.
    break:
        The break utility shall exit from the smallest enclosing for, while,
        or until loop, [...]
    continue:
        The continue utility shall return to the top of the smallest
        enclosing for, while, or until loop, [...]
    return:
        The return utility shall cause the shell to stop executing
        the current function or dot script.  If the shell is not currently
        executing a function or dot script, the results are unspecified.

It is clear that return should return from a sourced file, which
it does not do.  Whether break and continue should work from the sourced
file might be debatable.  Because the dot command says "in the current
environment", I'd say yes.  In any case, it should not fail in weird
ways like it does now!

The problems occur with return (a) and break/continue (b) because:
    1)  dotcmd() does not record the function nesting level prior to
        sourcing the file nor does it touch the loopnest variable,
        leading to either
    2   a) returncmd() being unable to detect that it should not set
           evalskip to SKIPFUNC but SKIPFILE, or
        b) breakcmd() setting evalskip to SKIPCONT or SKIPBREAK,
        leading to
    3)  cmdloop() not detecting that it should skip the rest of
        the file, due to only checking for SKIPFILE.
The result is that cmdloop() keeps executing lines from the file
whilst evalskip is set, which is the main symptom.  Because
evalskip is checked in multiple places in eval.c, the secondary
symptom appears.
>How-To-Repeat:
Run the following script:

    printf "break\necho break1; echo break2" >break
    printf "continue\necho continue1; echo continue2" >continue
    printf "return\necho return1; echo return2" >return

    while true; do . ./break; done

    for i in 1 2; do . ./continue; done

    func() {
        . ./return
    }
    func

No output should be produced, but instead this is the result:
    break1
    continue1
    continue1
    return1

The main symptom is evident from the unexpected output and the secondary
one from the fact that there are no lines with '2' in them.
>Fix:
Here is patch to src/bin/sh to fix the above problems.  It keeps
track of the function nesting level at the beginning of a dot command
to enable the return command to work properly.

I also changed the undefined-by-standard functionality of the return
command when it's not in a dot command or function from (indirectly)
exiting the shell to being silently ignored.  This was done because
the previous way has at least one bug: the shell exits without asking
for confirmation when there are stopped jobs.

Because I read the standard to mean that break and continue should have
an effect outside the sourced file, that's how I implemented it.  For what
it's worth, this also seems to be what bash does.  Also laziness, because
this way required no changes to loopnesting tracking.  If this is not
wanted, it might make sense to move the nesting tracking to the inputfile
stack.

The patch also does some clean-up to reduce the amount of global
variables by moving the dotcmd() and the find_dot_file() functions from
main.c to eval.c and making in_function() a proper function.
2014-05-31 14:42:18 +00:00
christos
cf026aea41 add one more directory. 2014-05-31 14:36:53 +00:00
christos
50fbec612b new shell tests 2014-05-31 14:36:03 +00:00
christos
6162057ac7 add new directory 2014-05-31 14:31:01 +00:00
christos
9462261d53 PR/48843: Jarmo Jaakkola: Test cses for break/continue/return broken
inside dot commands:

 The test cases are named with the pattern
     dotscope_cmd_cmdscope,
 where dotscope is the scope in which the dot command is and cmdscope
 is the scope where cmd is in the sourced file.
2014-05-31 14:29:06 +00:00
christos
9fc719f12e use weak symbols instead of linking against libpthread. 2014-05-31 14:03:08 +00:00
spz
a9c93eb0a8 - match up comment and interface identifiers
- use RFC5737 documentation prefixes
- use a variable for the RFC1918 private address ranges
2014-05-31 12:33:14 +00:00
spz
af8b224c4c example for port remapping added 2014-05-31 11:54:37 +00:00
martin
8d9bfc398a Instead of running MAKEDEV inside the image content dir (which would only
work for root), make it emit a mtree spec file and pass that to makefs.
This should also work for unprivileged builds.
Problem pointed out by Izumi Tsutsui.
2014-05-31 10:43:00 +00:00
martin
836e302df5 Add a variable CDMAKEFSEXTRAOPTS to provide additional parameters to the
makefs invocation that do not belong in the image option list (CDMAKEFSOPTIONS)
2014-05-31 10:18:47 +00:00
njoly
d7efe85816 Regen for munmap(2) signature. 2014-05-31 08:52:54 +00:00
njoly
72a681e433 Fix munmap(2) signature. 2014-05-31 08:51:19 +00:00
rmind
d9b974c9b7 - npf_nat_freepolicy: handle a race condition when a new connection might
be associated with a NAT policy which is going away and npfctl reload
  would wait for its natural expiration (potentially long time).
- Remove npf_ruleset_natreload() by merging into npf_ruleset_reload().
- npf_ruleset_reload: eliminate a small time period when a valid NAT
  policy might be inactive during the reload operation.
2014-05-30 23:26:06 +00:00
joerg
74b1011998 Inline trivial helper function. 2014-05-30 22:20:48 +00:00
palle
18b7338ec6 Remove debugging code introduced by accident in locore.s revision 1.357 2014-05-30 21:55:32 +00:00
msaitoh
e5ef5a5dc5 Remove duplicated lines. 2014-05-30 19:01:52 +00:00
joerg
4692c72dc2 If clang is requested for i386, amd64 or eARM, also build libc++. 2014-05-30 18:39:29 +00:00
joerg
9030bd2d9e Add note about the eARM flag day for C++. 2014-05-30 18:33:30 +00:00
joerg
b983dfb658 Always use our exception handling code for eARM. 2014-05-30 18:31:58 +00:00
joerg
7632431698 Switch eARM to using normal DWARF exception handling. 2014-05-30 18:31:31 +00:00
joerg
d4f1ac8b3b Remove platform support list for libc unwinder, just keep comment about
ia64 state.
2014-05-30 18:30:32 +00:00
joerg
b1bb3099bf Update build system for LLVM/Clang snapshot r209886. This brings in the
merged AArch64 backend and the move of eARM to DWARF exception handling
for NetBSD. C++11 is required for building.
2014-05-30 18:28:13 +00:00
joerg
571e46f85f Import Clang 3.5svn r209886. 2014-05-30 18:13:37 +00:00
joerg
4b590142ed Import LLVM 3.5svn r209886. 2014-05-30 18:09:54 +00:00
nonaka
eaa06116b6 regen 2014-05-30 16:12:22 +00:00
nonaka
75bffab467 Added Realtek devices. 2014-05-30 16:11:52 +00:00
njoly
4dd55950ee len argument is of unsigned type (size_t) and thus cannot be negative;
remove corresponding statement in ERRORS.
2014-05-30 16:11:01 +00:00
martin
598e3edde3 Pre-populate /dev on the CD - with rockridge extensions we can do this and
it saves us one tmpfs (or mfs) instance, which helps quite a bit on low
memory machines.
2014-05-30 13:24:22 +00:00
martin
3a97fc059a The current vax /boot is super slow unziping kernels - and this is a CD, wich
has space enough, so unzip the kernel on it to speed up the boot process.
XXX The /boot bug should nevertheless be fixed.
2014-05-30 13:23:05 +00:00
martin
6514db7aa7 Make it deal with /dev being the result of a "MAKDEV all" instead of
"MAKEDEV init" by mounting a ptyfs if needed.
2014-05-30 13:19:42 +00:00
martin
4bc697a5ef PR kern/48852 (which should have been bin/ in retrospect): apply patch
from Thomas Schmitt to fix rockridge encoding of device nodes.
2014-05-30 13:14:47 +00:00
joerg
123b42ea74 Drop undocumented and redundant 0 argument to .ent. 2014-05-30 11:46:48 +00:00
joerg
366c7b7f38 Import libc++ r209785. Fix a regression with std::bind exposed by recent
Clang improvements.
2014-05-30 11:39:48 +00:00
hannken
ff361c30ec Change NFS from rbtree to vcache. 2014-05-30 08:47:45 +00:00
hannken
fb88097aee vfs_vnode_iterator_next(): if a vnode is reclaiming (VI_XLOCK) skip
the filter.  Vget() will wait until the vnode disappeared.  No more
"dangling vnode" panics on unmount.
2014-05-30 08:46:00 +00:00
hannken
de57916f59 msdosfs_reclaim(): add missing fstrans and protect change
of v_data with v_interlock as msdosfs_sync() now needs it.
2014-05-30 08:42:35 +00:00
hannken
7bd94e9e7c Testing "v_usecount == 1" for exclusive reference will not always
work -- remove and test only readonly.
2014-05-30 08:40:09 +00:00
uebayasi
ba7dc1f3c8 Convert mtree spec path characters with sed(1) to avoid tool'ifying vis(1). 2014-05-30 08:37:35 +00:00
msaitoh
42c09e06f3 Add 5.1.4, 5.2.2. 6.0.4 and 6.1.3. 2014-05-30 08:36:28 +00:00
msaitoh
267febe644 Sync with FreeBSD:
- Add DragonFly 3.6.0 and 3.6.1
- Add FreeBSD 9.2 and 10.0
- Add Mac OS X 10.9
- Add OpenBSD 5.4
- Change the master's URL.
Add some releases:
- Add NetBSD 5.1.4 and 5.2.2
- Add OpenBSD 5.5
2014-05-30 07:26:06 +00:00
msaitoh
2851377ab9 Add 6.0.[45] and 6.1.[34] 2014-05-30 05:37:04 +00:00
msaitoh
58836705c1 - Remove some obsoleted comments.
- KNF.
2014-05-30 05:04:21 +00:00
msaitoh
486f844f78 - Add PCI-X capability stuff.
- remove extra ':' in pci_conf_print_pcie_cap()
- Add comments.
2014-05-30 03:42:38 +00:00
msaitoh
b95787afbc Regen. 2014-05-30 03:02:32 +00:00
msaitoh
ba3c4cc670 Add Intel 3200 Host and PCIe. 2014-05-30 03:01:58 +00:00
joerg
79c2ddee71 Kill __P. Use static. 2014-05-30 02:31:40 +00:00
joerg
4c68dd0971 Remove !NetBSD code. 2014-05-30 02:28:07 +00:00
rmind
c173b112be tcp_signature_getsav: handle !ipsec_used case and fix the build (hi christos!). 2014-05-30 02:27:29 +00:00
rmind
8e2c3f0d1c Use __CTASSERT() in the header. 2014-05-30 02:17:01 +00:00