8000 Unicode support by xiongjiamu · Pull Request #1 · xxmcyr/awk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unicode support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open

Unicode support #1

wants to merge 41 commits into from

Conversation

xiongjiamu
Copy link

Test BWK's PR

arnoldrobbins and others added 28 commits May 31, 2022 22:37
and also fixed splitting of input lines when FS="", plus tests in T.utf
In case the source string resides in the array that's about to be
wiped, copy the string and release its cell immediately.

To reproduce:

    BEGIN { a[1]="a b"; print split(a[1],a),a[1],a[2] }

Reported by Todd C. Miller.
The lexer returns a copy of a regular expression's string
representation which is then leaked during parsing. Since the only
consumer of that copy makes a copy of the copy (makedfa via mkdfa),
just return a pointer to the original string.

Test with:

    valgrind --leak-check=full a.out '/123/; /456/' </dev/null

Reported by Todd C. Miller.
In every instance, after strnode has extracted the string, the node is leaked.

Tests:

    valgrind --leak-check=full ./a.out '{sub("b", x)}' </dev/null
    valgrind --leak-check=full ./a.out '{sub("b", r, s)}' </dev/null
    valgrind --leak-check=full ./a.out '{match(s, "restr")}' </dev/null
    valgrind --leak-check=full ./a.out '"s1" ~ "s2"' </dev/null
Test:

    valgrind --leak-check=full ./a.out '{exit}' x=y </dev/null
===============> cat leak.sh
#/bin/sh

# Monitor awk's memory consumption while repeatedly calling int()
# with extra, tempcell-producing expression arguments. There is
# nothing special about int(). Most of the other functions in
# run.c/bltin() will do.

${1:-./a.out} '
BEGIN {
	mem = "ps -p $PPID -o rsz="
	system(mem)
	while (++i <= 100000) {
		int(1+2, 3+4, 5+6, 7+8, 9+0)
		if (i % 10000 == 0)
			system(mem)
	}
}
' 2>/dev/null
===============> paste <(./leak.sh ./master.out) <(./leak.sh ./a.out)
 2404	 2520
 4612	 2528
 6804	 2528
 9000	 2528
11192	 2528
13384	 2528
15580	 2528
17772	 2528
19968	 2528
22160	 2528
24356	 2528
===============> cat leak.sh
#/bin/sh

# Monitor awk's memory consumption while repeatedly calling printf
# with extra, tempcell-producing expression arguments.

${1:-./a.out} '
BEGIN {
	mem = "ps -p $PPID -o rsz="
	system(mem)
	while (++i <= 100000) {
		printf("%d", 1+2, 3+4, 5+6, 7+8, 9+0) > "/dev/null"
		if (i % 10000 == 0)
			system(mem)
	}
}
' 2>/dev/null
===============> paste <(./leak.sh ./master.out) <(./leak.sh ./a.out)
 2572	 2564
 4804	 2600
 6996	 2600
 9192	 2600
11384	 2600
13576	 2600
15772	 2600
17964	 2600
20160	 2600
22352	 2600
24548	 2600
either directly or implicitly because FS is, splitting is done
as if the string was in CSV format, as with input.
@CLAassistant
Copy link
CLAassistant commented Sep 14, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 6 committers have signed the CLA.

✅ miykaelxxm
❌ Brian Kernighan
❌ plan9
❌ arnoldrobbins
❌ mpinjr
❌ xiongjiamu


Brian Kernighan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@xiongjiamu xiongjiamu linked an issue Nov 15, 2022 that may be closed by this pull request
@xiongjiamu xiongjiamu removed a link to an issue Nov 15, 2022
@xiongjiamu xiongjiamu temporarily deployed to github-pages January 28, 2023 07:37 — with GitHub Pages Inactive
@xiongjiamu xiongjiamu temporarily deployed to github-pages February 10, 2023 02:52 — with GitHub Pages Inactive
name: "表单模板"
description: "填写表单并提交你的 bug"
title: "[Bug]: "
labels: ["bug", "triage"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 @miykaelxiong 看看

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等等等等

name: "表单模板"
description: "填写表单并提交你的 bug"
title: "[Bug]: "
labels: ["bug", "triage"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我要看啥? 这个代码不是我写的

@xiongjiamu xiongjiamu temporarily deployed to github-pages August 16, 2023 09:45 — with GitHub Pages Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0