Commit Graph

281623 Commits

Author SHA1 Message Date
rillig
09971cc10b make(1): remove dead code from Hash_FindEntry
All callers pass a properly initialized table.
2020-10-04 17:21:28 +00:00
rillig
02572dfffe make(1): remove dead code from JobOutput 2020-10-04 16:50:37 +00:00
rillig
81714495f1 make(1): split Parse_DoVar into manageable pieces
This makes it easier to eliminate duplicate code, for example in
Parse_IsVar and Parse_DoVar.
2020-10-04 16:43:22 +00:00
jakllsch
15df7ca096 device_printf() instead of aprint_error_dev() where appropriate 2020-10-04 16:23:04 +00:00
martin
a2df346540 If we have no explicitly marke target root partition, make sure to set
the proper flag on the implicit one.
2020-10-04 16:09:12 +00:00
christos
67dafae820 Apply by hand a patch to fix http://r6.ca/blog/20200929T023701Z.html
aka "the memcmp bug", from a patch for gcc-10 in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
Tested on x86_64 by running a full build, install and running it.
Testing that the problem has been fixed with one of the unit tests provided.
2020-10-04 14:44:47 +00:00
rillig
f8e46b8e43 make(1): don't modify the given line during Parse_DoVar
Placing null characters all over the line made the code hard to
understand.  The null characters were placed for top-level whitespace as
well as the operator.

Working with a read-only line makes it easier to inspect the parsing
state during debugging.

This change involves an additional bmake_malloc for each variable name.
This will be compensated later by extending the API of the Var module to
also accept a pair of pointers (start, end) as the variable name.
2020-10-04 14:40:13 +00:00
kre
5bbbc6a94d Fix a typo (s/int/in/) 2020-10-04 14:22:52 +00:00
kim
eb131804a5 Use "pool" for the pool.ntp.org servers. Add some new hints.
- Use the "pool" keyword for obtaining servers from ntp.pool.org.
  - Add "tos minclock" and "tos maxclock" to limit the number of servers.
  - Add "restrict source" to apply appropriate restrictions to servers.
    (Specifically "nopeer" cannot be applied to "pool" servers.)
  - A single "pool" entry suffices -- using "2.netbsd.pool.ntp.org" so
    that we get both IPv4 and IPv6 addresses. (No addresses are returned
    for just "netbsd.pool.ntp.org.")
- Add a comment about "tinker panic 0" -- useful for VMs and laptops.
- Add a comment about "discard minimum" -- useful for some SNTP clients.
- Add an explanation for the "limited" restriction keyword.
- Unify whitespace and comment formatting.
2020-10-04 13:50:44 +00:00
rillig
9d72f76464 make(1): clean up local variables in Parse_DoVar
The variable "line" was misnamed since it turned from the beginning of
the line to the variable name.  The variable "cp" was named too broadly.
Having two moving pointers in a single parsing function was too much.

Now p is the only moving pointer.  From it, the variable name and value
are extracted as the pointer flies by.  These more specific names make
the lower half of the function more readable since Var_Set(name, value)
sounds more correct and to the point than Var_Set(line, cp).

Memory management for the possibly expanded variable value is now
simpler as there may or may not be an expanded value, and that is freed
in every case.  No need for another Boolean variable called freeCp
anymore.  Distinguishing between the unexpanded value and the actual
value highlights the data flow.

Using const pointers is a step into the direction of having a parser
that operates on a read-only string.  Right now the string is destroyed
upon parsing.
2020-10-04 13:24:59 +00:00
rillig
2bd1a09b0a make(1): fix out-of-bounds memory access in Parse_DoVar
When a line starts with "=value", this is interpreted as a variable
assignment, with an empty variable name.  In that case, there is no
"previous character" from the '='.  Accessing that character therefore
was an out-of-bounds read access.

If a whole file starts with "=value", instead of just a single line,
this out-of-bounds access can actually lead to a segmentation fault.
This depends on the memory allocator though.
2020-10-04 11:58:57 +00:00
rillig
c814087e2a make(1): only use the VARE_ASSIGN flag if necessary
When checking the right-hand side of a variable assignment for syntax
errors, it does not matter  whether a '$$' is expanded to '$' or kept as
'$$'.
2020-10-04 10:35:25 +00:00
rin
498c80dabc Add missing __{BEGIN,END}_DECLS in order to catch up with
sanitizer_linux_libcdep.cc rev 1.17:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc#rev1.17

Fix build with HAVE_GCC=9.
2020-10-04 10:34:18 +00:00
rillig
59dabd71e0 make(1): add basic tests for the += assignment operator 2020-10-04 10:16:09 +00:00
rin
a9c87449c2 Fix ramdisk overflow:
- switch to x_disklabel (drop non-native label support)
- switch to x_fsck_ffs and x_newfs (drop byte-swapped and Apple UFS support)
- switch to more
2020-10-04 09:42:48 +00:00
rin
5958de7d2a Fix miniroot overflow by switching to x_fsck_ffs and x_newfs
(drop byte-swapped and Apple UFS support).
2020-10-04 09:34:18 +00:00
rillig
6e682a454c make(1): add test for combining :sh with += 2020-10-04 08:32:52 +00:00
rillig
03e490953a make(1): make documentation of Error more precise 2020-10-04 08:22:59 +00:00
rillig
079405bd8d make(1): add another test for parsing :sh assignments 2020-10-04 08:14:35 +00:00
skrll
17871edd4a KNF 2020-10-04 08:09:12 +00:00
rillig
369666478e make(1): test another edge case for the :sh assignment 2020-10-04 08:02:17 +00:00
rillig
127040e6d2 make(1): fix parsing of the :sh assignment operator modifier 2020-10-04 07:49:45 +00:00
rillig
65f1297096 make(1): add tests for parsing assignments, especially :sh
Luckily nobody uses the :sh variable assignment modifier since its
syntactical variant != is simpler.
2020-10-04 06:53:15 +00:00
nat
a73bf1cfe7 Ensure event_thread stays in event loop upon creation. 2020-10-04 06:15:54 +00:00
rillig
dfde7bb817 make(1): replace strcpy with memcpy in Hash_CreateEntry
The string length is already known, no need to recalculate it.
2020-10-03 23:16:28 +00:00
rillig
ae60f31db0 make(1): remove unnecessary code from Hash_DeleteEntry
This function is only called 2 times, and both callers pass valid
arguments.
2020-10-03 22:33:26 +00:00
riastradh
35a4cb626d autoconf: Blame devices holding up boot with config_pending.
Blame message requires `boot -x' (AB_DEBUG).

Fix ata so it doesn't mismatch config_pending_incr/decr devices.
2020-10-03 22:32:50 +00:00
christos
5e85fe34cc PR/55693: Andreas Gustafsson: factor(6) lists factors in wrong order
Sync with FreeBSD and change their -h (that printed hex) to -x because
we were already using -h.
2020-10-03 22:27:00 +00:00
rillig
7a85896268 make(1): clean up hash table implementation
Having the hash function potentially redefined is a bit too much
flexibility.  If actually needed, this should be done using a patch, not
using the C preprocessor.

Converting the macro to a function made the control flow easier to
understand.  It also revealed that the variable p was unnecessary in
both Hash_FindEntry and Hash_CreateEntry.
2020-10-03 22:25:04 +00:00
rillig
052e64b5e1 make(1): clean up #include sections 2020-10-03 21:52:50 +00:00
rillig
aea5b99b75 make(1): remove dead store in ParseGetLine
GCC 5 didn't dare to optimize this by itself.
2020-10-03 21:43:41 +00:00
rillig
78fa7ec431 make(1): inline macro ISEQOPERATOR
The name of the macro was wrong.  These characters are not used in an
equality operator, it's an assignment operator.
2020-10-03 21:23:42 +00:00
rillig
75f91a54ee make(1): use consistent pattern for parsing whitespace
The pp and cpp in the function names stand for "parsing position" and
"const parsing position".
2020-10-03 21:19:54 +00:00
rillig
00e17f17bf make(1): add unit test for the Towers of Hanoi puzzle 2020-10-03 20:34:06 +00:00
martin
d9c7022040 PR 55384: detangle pm->ptstart from the "install" flag (selecting a
target partition). Instead introduce a new PTI_INSTALL_TARGET per partition
flag and deal with it in the partitioning backends.

Honour pm->ptstart when allocating new partitions - it is supposed to be
the first sector usable by NetBSD.
2020-10-03 18:54:18 +00:00
christos
10f7eba97a - centralize number parsing code
- enable -g
- KNF
2020-10-03 18:42:20 +00:00
christos
f717d52b2d bump libc for set_rpc_maxgrouplist 2020-10-03 18:35:21 +00:00
christos
460972a5e2 bump for set_rpc_maxgrouplist 2020-10-03 18:34:15 +00:00
christos
f0047c9ccc add set_rpc_maxgrouplist 2020-10-03 18:33:52 +00:00
christos
fb8fd3ef27 Add set_rpc_maxgrouplist 2020-10-03 18:31:29 +00:00
christos
c53d404f5e add set_rpc_maxgrouplist(3) 2020-10-03 18:30:39 +00:00
wiz
2858bf9ece New sentence, new line. 2020-10-03 18:29:02 +00:00
christos
a9f74273b0 Add -A (noac) option to turn off the attribute cache. (Maciej W. Rozycki) 2020-10-03 18:06:37 +00:00
thorpej
806d42fb8f Add a comment describing the rpb::rpb_vptb field. 2020-10-03 17:33:23 +00:00
thorpej
ef2f8a9cde Provide an alternate delay function that uses the Qemu get-time hypercall. 2020-10-03 17:32:49 +00:00
thorpej
d0123f4cd6 Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us.  Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments.  So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
  "root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD".  In the case of
  Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
  perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
2020-10-03 17:31:46 +00:00
rillig
6f58a78513 make(1): add test demonstrating the Towers of Hanoi puzzle
It's not the primary task of make to handle procedure calls with
parameters, combined with lexical scoping, therefore the code does not
look as straight-forward or clean as in other programming languages.  It
feels more like squeezing a programming problem from the imperative
world into the world of declarative dependencies.

A more idiomatic way of implementing this puzzle should be as a
dependency graph since that's both the natural structure of the puzzle
and the primary domain of make.  Something like having a main target
"hanoi-5" that depends on intermediate targets of the form
"move-1.2.3.4.5-_._._._._-_._._._._", each representing a single
configuration of the stacks.  These targets could be generated
dynamically.  A benefit of this implementation would be that the puzzle
could be resumed from an arbitrary configuration, just just from the
initial configuration.
2020-10-03 17:30:54 +00:00
rillig
27ec5f2921 make(1): demonstrate naive output filtering with csh in parallel mode 2020-10-03 15:38:13 +00:00
rillig
eaf8289576 make(1): fix shell definition for csh
The bug has been there since at least 1993-03-21.  This is strong
evidence that nobody has ever used the csh in parallel mode.
2020-10-03 15:28:37 +00:00
rillig
cc4e65a520 make(1): demonstrate wrong output when using csh in parallel mode 2020-10-03 15:23:42 +00:00