Commit Graph

1512 Commits

Author SHA1 Message Date
Natanael Copa b253118cca abuild: add test for -doc subpackages 2022-12-01 15:46:03 +01:00
Samanta Navarro f8208aded0 abuild-tar: do not read past corrupt tar header
The abuild-tar binary can read past the end of an invalid tar header if
the contained link name does not end with a terminating NUL character.
In this case it reads past the end of hdr.linkname and maybe even past
the end of the header if no further NUL bytes are contained.

The strnlen function is used in apk-tools for such cases as well, so I
recommend to use it here too.

How to reproduce (compile abuild-tar with -fsanitize=address):

cat > poc.tar.b64 << EOF
b3dvAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAAMDAwMDAw
MAAwMDAwMDAwADAwMDAwMDAwMDAwADAwMDAwMDAwMDAwADAwMDAwMAAAMm93b29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29v
b29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb28=
EOF
base64 -d < poc.tar.b64 | abuild-tar --hash
2022-11-30 13:16:19 +00:00
Natanael Copa f97bf6ae8b abuild-tar: add test for --hash 2022-11-30 13:02:18 +01:00
Natanael Copa 9aeb6484b6 abuild-tar: add test for --cut 2022-11-30 12:19:34 +01:00
Natanael Copa 8a16229d3e abuild-tar: fix --help and add test for usage 2022-11-30 12:00:09 +01:00
Natanael Copa 94122d7bec tests: pre-generate abuild keys
use a fake openssl for abuild-keykey and pre-generate the abuild keys.
This makes tests run significantly faster as we dont need to generate
new keys for each abuild-keygen test.
2022-11-29 09:08:14 +00:00
Natanael Copa 7d540bed4d ==== release 3.10.0 ==== 2022-11-29 10:37:08 +01:00
psykose 4e855560a7 newapkbuild: make meson test use --print-errorlogs
-v outputs everything from the tests, which has a lot of very
uninteresting and spammy data. all we really care about is failures, so
print only the errorlogs on failure by default. this is analogous to the
cmake output on failure
2022-10-25 09:25:56 +00:00
Kevin Daudt 15b6128a45 abump: source APKBUILD in subshell
As demonstrated in b7813c3 (abump: demonstrate abump environment
polution, 2022-10-15), sourcing APKBUILDs in abump polutes it's
environment.

Address that by sourcing the APKBUILD in a subshell as well as some of
the checks following it that need the information from the APKBUILD.
That information is not used any later, it's not an issue that it's
discarded outside of the subshell.
2022-10-15 11:06:53 +00:00
Kevin Daudt b7813c377c abump: demonstrate abump environment polution
abump sources the APKBUILD to be able to check some variables. When the
APKBUILD exports variables in the global scope, that affects the abump
environment as well.

When abump then executes abuild, it will inherrit the environment from
abump. This is an issue under the following circumstances:

* The APKBUILD only updates the value of an exported variable if it's
  not set
* The default value includes a variable set by abuild, like `$srcdir`.

Because the variable is set by abuild, but not abump, the resulting
exported variable is different. Because it's then set incorrectly in the
abump environment, it's no longer updated with the correct variable when
abuild is invoked.
2022-10-15 10:52:11 +00:00
Natanael Copa 5c542377a8 abuild: fix amove corner cases
fix `amove dir` (without leading or trailing /)

add various testcases for amove
2022-09-23 12:31:56 +02:00
Natanael Copa 53501883fc make: let the test timeout be configurable at run time 2022-09-13 07:42:09 +02:00
Natanael Copa 58a9262c48 make: increase test timeout 2022-09-12 17:50:35 +02:00
Natanael Copa d2ef7f4edb ==== release 3.10.0_rc1 ==== 2022-09-12 17:27:47 +02:00
Natanael Copa eeaa4b0f32 buildlab: use grep -E instead of egrep 2022-09-12 17:20:47 +02:00
Natanael Copa 04c2c9edde abuild: use grep -E instead of egrep
fixes the warning:

  egrep: warning: egrep is obsolescent; using grep -E
2022-09-12 17:06:21 +02:00
Noel Kuntze 6cef1a2150 functions.sh.in: Export original CC, CXX, CPPFLAGS, CXXFLAGS, CFLAGS, LDFLAGS in BUILDCC, BUILDCXX, BUILDLD, BUILDCPPFLAGS, BUILDCXXFLAGS, BUILDCFLAGS, BUILDLDFLAGS Default CC to gcc, CXX to g++, LD to ld 2022-08-30 10:38:38 +02:00
Natanael Copa 8357608d5f tests: functions: add test for empty but set vars
ref https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/112
2022-08-30 10:38:38 +02:00
ptrcnull 7878630e26 abuild: add $conflicts to spellchecking 2022-08-29 08:10:37 +00:00
Drew DeVault 1571e2887e Downgrade suid w/o PIE from error to warning
Some languages (such as Hare) do not support position-independent
executables. Such cases require extra care and scrutiny, but should not
be entirely disallowed.
2022-08-28 18:18:49 +02:00
xdavidwu 3ee93ea8bc abuild: print failed patches to stderr 2022-08-05 14:32:26 +00:00
psykose 927f14f6b3
abuild: fix package size for script-only packages 2022-08-05 16:00:36 +02:00
Natanael Copa 3a235e4d3c tests: adjust to openssl 3
openssl3 have different output to stderr when generating keys. Adjust
accordingly.
2022-08-05 13:22:02 +00:00
Jakub Panek fd6002b277 abuild.conf: set release profile optimisations for cargo
Signed-off-by: Jakub Panek <me@panekj.dev>
2022-07-26 15:04:00 +00:00
ptrcnull 33ce0536ef
abuild: set GIT_CEILING_DIRECTORIES before running prepare/build/check/package 2022-06-22 17:50:38 +02:00
Natanael Copa 4dbf8e3756 abuild-keygen: use doas instead of sudo
fallback to sudo if doas was not found
2022-06-22 16:41:51 +02:00
Natanael Copa 36e1d04f06 tests: abuild: dont copy keys in global scope
this makes it copy keys when generating the list of tests
2022-06-22 16:13:07 +02:00
Natanael Copa ce6e5964b2 tests: port abump tests 2022-06-22 16:13:07 +02:00
Natanael Copa 9d5b268aec functions: hide error on missing git remote origin 2022-06-22 16:13:07 +02:00
Natanael Copa fe74a8a760 abump: fix help/usage
- exit with success with -h is specified and use stdout
2022-06-22 16:13:07 +02:00
Natanael Copa df0eece116 tests: remove abuild.bats
its completely ported now
2022-06-22 16:13:07 +02:00
Natanael Copa 709235bc82 tests: abuild: port mutiline license test 2022-06-22 16:13:07 +02:00
Natanael Copa bd84b91ba9 test: abuild: port invalid pkgname/subpkgname/subpkgversion 2022-06-22 16:13:07 +02:00
Natanael Copa 07894fa745 tests: abuild: port invalid-initd test 2022-06-22 16:13:07 +02:00
Natanael Copa 30b493d4b2 tests: abuild: port and fix py provides generation 2022-06-22 16:13:07 +02:00
Natanael Copa ca29f73dfe tests: abuild: port subpkg-dep-leak test 2022-06-22 16:13:07 +02:00
Natanael Copa 9c67324854 tests: abuild: port duplicate checksum test 2022-06-22 16:13:07 +02:00
Natanael Copa e25a2b6fc5 abuild: use timestamp of APKBUILD if not in git
we normally use the last git commit timestamp for creating reproducible
builds. Fall back to APKBUILD timestamp if there are no git commits.
2022-06-22 16:13:07 +02:00
Natanael Copa e684847caf tests: add test for checksum generation 2022-06-22 16:13:07 +02:00
Natanael Copa 2e3816d08c tests: abuild: port reproducible build test 2022-06-22 16:13:07 +02:00
Natanael Copa f932f3d32a tests: abuild: add tests for dbg subpackage
Apparently tmpfs does not support extended attributes user namespace, so
ddrop the SETFATTR=false test.
2022-06-22 16:13:07 +02:00
Natanael Copa 35592db050 tests: abuild: add lib64 tests 2022-06-22 16:13:07 +02:00
Natanael Copa 1b66d65805 tests: abuild: add test for invalid filename 2022-06-22 16:13:07 +02:00
Natanael Copa a845a0bf1d abuild: echo invalid filenames to stderr 2022-06-22 16:13:07 +02:00
Natanael Copa 1913c6929c tests: refacgor abuild build failure 2022-06-22 16:13:07 +02:00
Natanael Copa 209ad1f6ab tests: abuild: add test for simple build 2022-06-22 16:13:07 +02:00
Natanael Copa 1a4e76dd74 abuild: export $git to fix fatal: not a git repository
We re-spawn abuild and need to pass $git
2022-06-22 16:13:07 +02:00
Natanael Copa 63467b1ef3 abuild: pass -v option to subshells
Help debugging in fakeroot by passing -v option
2022-06-22 16:13:07 +02:00
Natanael Copa 4da872b8c9 tests: abuild: test show version 2022-06-22 16:13:07 +02:00
Natanael Copa f69cbe8b96 abuild: show usage on stderr on invalid options 2022-06-22 16:13:07 +02:00