Commit Graph

147 Commits

Author SHA1 Message Date
Arnold D. Robbins
34a6f41cca Update FIXES and version date in main.c. 2019-09-10 09:57:07 +03:00
Alexander Richardson
ad9bd2f40a Avoid creating an out-of-bounds pointer in word() (#48)
As it is never dereferenced in the n == -1 case it shouldn't cause any
problems. However, UBSAN complains about this, so it is required to run
the tests when compiling with -fsanitize=undefined.
2019-09-10 09:54:53 +03:00
Alexander Richardson
cbf924342b Fix out-of-bounds access in gototab array for caret character (#47)
When matching a caret, the expression	`f->gototab[s][c] = f->curstat;` in
cgoto() will index the 2D-array gototab with [s][261]. However, gototab
is declared as being of size [NSTATES][NCHARS], so [32][259]. Therefore,
this assignment will write to the state for character 0x1.
I'm not sure how to create a regression test for this, but increasing the
array size to HAT+1 values fixes the error and the tests still pass.

I found this issue while running awk on a CHERI system with sub-object
protection enabled. On x86, this can be reproduced by compiling awk
with -fsanitize=undefined.
2019-09-10 09:54:11 +03:00
Sevan Janiyan
50e6962495 Drop Mac OS 9 reference (#46)
"buildmac" file is no longer supplied.
2019-08-13 20:27:51 +03:00
Arnold D. Robbins
c95b96020f Grammar optimization from NetBSD: Two adjacent string constants are merged. 2019-07-28 20:09:24 +03:00
Arnold D. Robbins
795a06b58c Remove trailing whitespace on lines in all files. 2019-07-28 05:51:52 -06:00
Arnold D. Robbins
cebda366a9 Improve cleanup of test directory upon 'make clean'. 2019-07-26 12:57:48 +03:00
Martijn Dekker
5b602ca8a2 Add support for "\a" and "\v" to regex and command line args (#44)
Support POSIX-specified C-style escape sequences "\a" (alarm)
and "\v" (vertical tab) in command line arguments and regular
expressions, further to the support for them in strings added on
Apr 9, 1989. These now no longer match as literal "a" and "v"
characters (as they don't on gawk and mawk).

IOW, lex.c already supported these (lines 390-391 as of 4e343460);
the support needed to be added to b.c and tran.c.

Relevant POSIX reference:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_20_06_13_04
2019-07-26 11:46:58 +03:00
Arnold D. Robbins
4e34346094 Update FIXES and main.c version. 2019-07-17 21:14:52 +03:00
M. Warner Losh
9310d452c9 Apply the following from FreeBSD / OpenBSD:
323965 | imp | 2017-09-23 23:04:06 -0600 (Sat, 23 Sep 2017) | 8 lines

Don't display empty error context.

Context extraction didn't handle this case and showed uninitialized memory.

Obtained from: OpenBSD lib.c 1.21
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2019-07-16 22:23:19 +03:00
M. Warner Losh
0939e3392b Apply r323963 from FreeBSD (pulling in the fix from OpenBSD)
| Fix uninitialized variable
|
| echo | awk 'BEGIN {i=$1; print i}' prints a boatload of stack
| garbage. NUL terminate the memory returned from malloc to prevent it.
|
| Obtained from: OpenBSD run.c 1.40
| Sponsored by: Netflix
| Differential Revision: https://reviews.freebsd.org/D12379
2019-07-16 22:23:02 +03:00
M. Warner Losh
966fdc9c29 Bring in fix from FreeBSD:
| r323964 | imp | 2017-09-23 23:04:02 -0600 (Sat, 23 Sep 2017) | 6 lines
|
| Fix %c for floating values that become 0 when coerced to int.
|
| Obtained from: OpenBSD run.c 1.36 (From Jeremy Devenport)
| Sponsored by: Netflix
| Differential Revision: https://reviews.freebsd.org/D12379
2019-07-16 22:21:33 +03:00
pfg
c70b9fe882 awk: Use random(3) instead of rand(3)
While none of them is considered even near to cryptographic
level, random(3) is a better random generator than rand(3).

Use random(3) for awk as is done in other systems.

Thanks to Chenguang Li for discussing this in the lists
and submitting the patch upstream.

PR:		193147
MFC after:	5 weeks

git-svn-id: svn+ssh://svn.freebsd.org/base/head@271879 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2019-07-16 22:19:56 +03:00
pfg
650d868ec4 MFV r315425: one-true-awk: have calloc(3) do the multiplication.
MFC after:	3 days

git-svn-id: svn+ssh://svn.freebsd.org/base/head@315426 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2019-07-16 22:12:26 +03:00
pfg
524219409a MFV r300961: one-true-awk: replace 0 with NULL for pointers
Also remove a redundant semicolon.

Also had to rebase on upstream pull.

git-svn-id: svn+ssh://svn.freebsd.org/base/head@301289 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2019-07-16 22:11:57 +03:00
Arnold D. Robbins
b8e0827095 Update FIXES and version in main.c. 2019-07-16 20:54:44 +03:00
Arnold D. Robbins
147521b831 Revise testdir/T.split per PR #42. 2019-07-16 20:50:23 +03:00
Arnold D. Robbins
891690942a Update T.split to match code changes. 2019-07-16 20:37:13 +03:00
Arnold D. Robbins
00170ba76c Merge remote-tracking branch 'melloc/posix-fs' into save-fs-fixes 2019-07-14 20:39:02 +03:00
Arnold D. Robbins
7e368c272a Update FIXES for test suite changes. 2019-06-24 01:13:10 -06:00
Arnold D. Robbins
ab911ab204 Update makefile, mainly to clean up testdir. 2019-06-24 01:10:24 -06:00
Arnold D. Robbins
4a99bd14d0 Remove awktest.tar. 2019-06-23 03:14:32 -06:00
Arnold D. Robbins
d6c466c367 Extract testdir. 2019-06-23 03:13:57 -06:00
Cody Mello
ae99b752af Disallow deleting SYMTAB and its elements (#43) 2019-06-17 22:08:54 +03:00
Cody Peter Mello
b463680594 Update field-splitting behaviour to match POSIX definition 2019-06-14 14:54:11 -07:00
Arnold D. Robbins
fabf9efece Minor fixes in the man page. 2019-06-06 11:29:20 -06:00
Arnold D. Robbins
28dacbd66b Allow unmatched right paren in regexes. Fixes Issue #40. 2019-06-04 23:53:31 -06:00
Arnold D. Robbins
4189ef5d58 Fix Issue #38 - don't require non-= after = in cmd line assignment. 2019-05-29 21:04:18 +03:00
Arnold D. Robbins
89354cc230 Update awktest.tar(p.50) to modern sort options. 2019-04-07 20:39:15 +03:00
Arnold D. Robbins
55edb1b1dd Simplify cross-compiling change. Update FIXES. 2019-03-12 21:54:57 +02:00
nee-san
c83d943830 Fix cross-build (#34)
* Fix cross-build

Fixes in make file to support cross-build because maketab is a host tool and should be compiled with host compiler

* some
2019-03-12 21:52:17 +02:00
Arnold D. Robbins
33ead6d239 Sync FIXES with GitHub repo activity. 2019-03-05 21:39:02 +02:00
Arnold Robbins
4bc685f701
Merge pull request #30 from McDutchie/interval-expr
backport ERE interval/repetition expressions from Apple awk-24
2019-03-05 21:28:45 +02:00
Martijn Dekker
e6ecf52e04 Merge remote-tracking branch 'upstream/master' into interval-expr
main.c: bump version to 20190305
2019-03-05 03:45:40 +01:00
onetrueawk
2d9034a01a
Merge pull request #32 from enh/master
maketab: support build systems with read-only source.
2019-03-03 15:11:28 -05:00
onetrueawk
1164fa7ace
Merge pull request #31 from arnoldrobbins/master
Make getline handle numeric strings, and update FIXES
2019-03-03 15:10:03 -05:00
onetrueawk
115fac0587
Merge pull request #12 from iamleot/cc_func-avoid-undefined-behaviour
Avoid undefined behaviour when using ctype(3) functions in relex() (possible fix for #11)
2019-03-03 15:08:25 -05:00
Martijn Dekker
0619d5d537 repeat(): add FATAL calls for errors that should be impossible 2019-02-21 22:38:16 +01:00
Elliott Hughes
785d10884a Add .gitignore. 2019-01-29 17:27:07 -08:00
Elliott Hughes
cc165f4be9 maketab: support build systems with read-only source.
If your generated files are considered outputs that live elsewhere, you
need a way to tell maketab where ytab.h actually is.

Specifically, I'm trying to avoid checking in generated files in
Android's AOSP tree's copy of one-true-awk.
2019-01-29 17:20:00 -08:00
Leonardo Taccari
031aac816d
Merge branch 'master' into cc_func-avoid-undefined-behaviour 2019-01-28 17:34:58 +01:00
Arnold D. Robbins
f25e845cf7 Update version string in main.c. 2019-01-26 21:55:03 +02:00
Arnold D. Robbins
778d21f73b Simplify getline-numeric input and results. 2019-01-26 20:50:31 +02:00
Arnold D. Robbins
9206c643e8 Update FIXES. 2019-01-25 13:02:19 +02:00
Arnold D. Robbins
9dbd1f1de3 Make getline POSIX compliant w.r.t. numeric strings. 2019-01-25 12:56:06 +02:00
Martijn Dekker
8a2222286c backport ERE interval/repetition expressions from Apple awk-24
The lack of POSIX interval expressions[*] (a.k.a. bounds, a.k.a.
repetition expressions) in regular expressions is listed under BUGS
in 'awk.1'. Apple's version of onetrueawk has supported these since
at least 2009, judging by the date stamp on their src/b.c in:
https://opensource.apple.com/tarballs/awk/awk-24.tar.gz

A bug report prompted NetBSD to swiftly integrate this code into
their awk. This commit is based on that NetBSD diff.
http://gnats.netbsd.org/53885
f3e4c4ca1d

b.c:
- Backport POSIX-standard interval expressions support in regular
  expressions via NetBSD from Apple awk-24 (20070501).

main.c:
- Bump version ID.

FIXES:
- Add note and credit for this feature.

awk.1: section BUGS:
- Remove line saying interval expressions are not supported.

_________
[*] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04_06
2019-01-23 09:12:27 +00:00
onetrueawk
c3c7c1370e
Merge pull request #27 from junghans/fix_parallel_build
fixed parallel build
2019-01-21 14:21:43 -05:00
onetrueawk
bf2585c9fd
Merge pull request #20 from melloc/nf-self-assign
Fix issues with NF self-assignment and setting NF to negative values
2019-01-21 14:20:37 -05:00
onetrueawk
79f008e853
Merge branch 'master' into nf-self-assign 2019-01-21 14:20:28 -05:00
onetrueawk
c154c3cb82
Merge pull request #19 from melloc/split-fs-from-array
Fix calling split() with a third argument that lives in the target array
2019-01-21 14:19:24 -05:00