Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

arnold-fixes/0000755000117100016300000000000013337775451011560 5ustar  bwkfacarnold-fixes/unary-plus.bad0000644000117100016300000000002713337522465014341 0ustar  bwkfacq
43.12345678912345678
arnold-fixes/a-format.bad0000644000117100016300000000007413337522465013732 0ustar  bwkfacnawk: weird printf conversion %a
 source line number 2
%a42
arnold-fixes/a-format.ok0000644000117100016300000000001113337522465013604 0ustar  bwkfac0x1.5p+5
arnold-fixes/decr-NF.bad0000644000117100016300000000003613337522465013440 0ustar  bwkfac6
a b c d e f
5
a b c d e f
6
arnold-fixes/string-conv.ok0000644000117100016300000000006513337522465014360 0ustar  bwkfaca = >>12.1234<<
1 -> 12.1234
2 -> 12.12
3 -> 12.1234
arnold-fixes/system-status.awk0000644000117100016300000000107713337522465015131 0ustar  bwkfac# Unmodified nawk prints the 16 bit exit status divided by 256, but
# does so using floating point arithmetic, yielding strange results.
#
# The fix is to use the various macros defined for wait(2) and to
# use the signal number + 256 for death by signal, or signal number + 512
# for death by signal with core dump.

BEGIN {
	status = system("exit 42")
	print "normal status", status

	status = system("kill -HUP $$")
	print "death by signal status", status

	status = system("kill -ABRT $$")
	print "death by signal with core dump status", status

	system("rm -f core*")
}
arnold-fixes/decr-NF.ok0000644000117100016300000000003313337522465013320 0ustar  bwkfac6
a:b:c:d:e
5
a:b:c:d:e:
6
arnold-fixes/system-status.ok0000644000117100016300000000012613337522465014752 0ustar  bwkfacnormal status 42
death by signal status 257
death by signal with core dump status 518
arnold-fixes/string-conv.bad0000644000117100016300000000010313337522465014466 0ustar  bwkfaca = >>12.1234<<
1 -> >>12.1234<<
2 -> >>12.1234<<
3 -> >>12.1234<<
arnold-fixes/ofs-rebuild.awk0000644000117100016300000000072113337522465014472 0ustar  bwkfac# The bug here is that nawk should use the value of OFS that
# was current when $0 became invalid to rebuild the record.

BEGIN {
	OFS = ":"
	$0 = "a b c d e f g"
	$3 = "3333"
	# Conceptually, $0 should now be "a:b:3333:d:e:f:g"

	# Change OFS after (conceptually) rebuilding the record
	OFS = "<>"

	# Unmodifed nawk prints "a<>b<>3333<>d<>e<>f<>g" because
	# it delays rebuilding $0 until it's needed, and then it uses
	# the current value of OFS. Oops.
	print
}
arnold-fixes/unary-plus.ok0000644000117100016300000000001213337522465014216 0ustar  bwkfac0
43.1235
arnold-fixes/string-conv.awk0000644000117100016300000000036013337522465014527 0ustar  bwkfacBEGIN {
	OFMT = ">>%.6g<<"
        a = 12.1234
	print "a =", a
        b = a ""
        print "1 ->", b
        CONVFMT = "%2.2f"
        b = a ""
        print "2 ->", b
        CONVFMT = "%.12g"
        b = a ""
        print "3 ->", b
}
arnold-fixes/a-format.awk0000644000117100016300000000003613337522465013764 0ustar  bwkfacBEGIN {
	printf("%a\n", 42)
}
arnold-fixes/system-status.bad0000644000117100016300000000014213337522465015065 0ustar  bwkfacnormal status 42
death by signal status 0.00390625
death by signal with core dump status 0.523438
arnold-fixes/README0000644000117100016300000000202613337522465012433 0ustar  bwkfacList of bugs fixed.

1. ofs-rebuild: OFS value used to rebuild the record was incorrect.
Fixed August 19, 2014. Revised fix August 2018.

2. system-status: Instead of a floating-point division by 256, use
the wait(2) macros to create a reasonable exit status. Fixed March 12, 2016.

3. space: Use provided xisblank() function instead of ispace() for
matching [[:blank:]].

4. a-format: Add POSIX standard %a and %A to supported formats. Check
at runtime that this format is available.

5. decr-NF: Decrementing NF did not change $0. This is a decades-old
bug. There are interactions with the old and new value of OFS as well.
Most of the fix came from the NetBSD awk.

6. string-conv: String conversions of scalars were sticky.  Once a
conversion to string happened, even with OFMT, that value was used until
a new numeric value was assigned, even if OFMT differed from CONVFMT,
and also if CONVFMT changed.

7. unary-plus: Unary plus on a string constant returned the string.
Instead, it should convert the value to numeric and give that value.
arnold-fixes/ofs-rebuild.ok0000644000117100016300000000002113337522465014312 0ustar  bwkfaca:b:3333:d:e:f:g
arnold-fixes/space.awk0000644000117100016300000000057013337522465013354 0ustar  bwkfacBEGIN {
	c[" "] = "\" \""
	c["\a"] = "\\a"
	c["\b"] = "\\b"
	c["\f"] = "\\f"
	c["\n"] = "\\n"
	c["\r"] = "\\r"
	c["\t"] = "\\t"
	c["\v"] = "\\v"

	sort = "LC_ALL=C sort"

	for (i in c)
		printf("%s %s [[:space:]]\n", c[i],
			i ~ /[[:space:]]/ ? "~" : "!~") | sort

	for (i in c)
		printf("%s %s [[:blank:]]\n", c[i],
			i ~ /[[:blank:]]/ ? "~" : "!~") | sort

	close(sort)
}
arnold-fixes/ofs-rebuild.bad0000644000117100016300000000002713337522465014435 0ustar  bwkfaca<>b<>3333<>d<>e<>f<>g
arnold-fixes/space.ok0000644000117100016300000000043213337522465013200 0ustar  bwkfac" " ~ [[:blank:]]
" " ~ [[:space:]]
\a !~ [[:blank:]]
\a !~ [[:space:]]
\b !~ [[:blank:]]
\b !~ [[:space:]]
\f !~ [[:blank:]]
\f ~ [[:space:]]
\n !~ [[:blank:]]
\n ~ [[:space:]]
\r !~ [[:blank:]]
\r ~ [[:space:]]
\t ~ [[:blank:]]
\t ~ [[:space:]]
\v !~ [[:blank:]]
\v ~ [[:space:]]
arnold-fixes/space.bad0000644000117100016300000000042613337522465013320 0ustar  bwkfac" " ~ [[:blank:]]
" " ~ [[:space:]]
\a !~ [[:blank:]]
\a !~ [[:space:]]
\b !~ [[:blank:]]
\b !~ [[:space:]]
\f ~ [[:blank:]]
\f ~ [[:space:]]
\n ~ [[:blank:]]
\n ~ [[:space:]]
\r ~ [[:blank:]]
\r ~ [[:space:]]
\t ~ [[:blank:]]
\t ~ [[:space:]]
\v ~ [[:blank:]]
\v ~ [[:space:]]
arnold-fixes/unary-plus.awk0000644000117100016300000000007013337522465014373 0ustar  bwkfacBEGIN {
	print +"q"
    print +"43.12345678912345678"
}
arnold-fixes/decr-NF.awk0000644000117100016300000000014713337522465013477 0ustar  bwkfacBEGIN {
	$0 = "a b c d e f"
	print NF
	OFS = ":"
	NF--
	print $0
	print NF
	NF++
	print $0
	print NF
}