Commit Graph

218 Commits (master)

Author SHA1 Message Date
Ariadne Conill 7bfc2289fd tests: add regression test for maximum package count off-by-one
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-05-02 11:58:56 -07:00
huyubiao 6d1f160e89 argvsplit: fix some quoting rules 2023-05-02 11:45:42 -07:00
Taylor R Campbell 212c85863a Avoid undefined behaviour with the ctype(3) functions.
fix https://github.com/pkgconf/pkgconf/issues/291

As defined in the C standard:

        In all cases the argument is an int, the value of which shall
        be representable as an unsigned char or shall equal the value
        of the macro EOF.  If the argument has any other value, the
        behavior is undefined.

This is because they're designed to work with the int values returned
by getc or fgetc; they need extra work to handle a char value.

If EOF is -1 (as it almost always is), with 8-bit bytes, the allowed
inputs to the ctype(3) functions are:

        {-1, 0, 1, 2, 3, ..., 255}.

However, on platforms where char is signed, such as x86 with the
usual ABI, code like

        char *ptr = ...;
        ... isspace(*ptr) ...

may pass in values in the range:

        {-128, -127, -126, ..., -2, -1, 0, 1, ..., 127}.

This has two problems:

1. Inputs in the set {-128, -127, -126, ..., -2} are forbidden.

2. The non-EOF byte 0xff is conflated with the value EOF = -1, so
   even though the input is not forbidden, it may give the wrong
   answer.

Casting char to unsigned int first before passing the result to
ctype(3) doesn't help: inputs like -128 are unchanged by this cast,
because (on a two's-complement machine with 32-bit int and unsigned
int), converting the signed char with integer value -128 to unsigned
int gives integer value 2^32 - 128 = 0xffffff80, which is out of
range, and which is converted in int back to -128, which is also out
of range.

It is necessary to cast char inputs to unsigned char first; you can
then cast to unsigned int if you like but there's no need because the
functions will always convert the argument to int by definition.  So
the above fragment needs to be:

        char *ptr = ...;
        ... isspace((unsigned char)*ptr) ...

This patch changes unsigned int casts to unsigned char casts, and
adds unsigned char casts where they are missing.
2023-05-02 11:43:56 -07:00
Ariadne Conill 49ab0b2ab7 tests: fixup! 2023-01-21 21:43:23 +00:00
Ariadne Conill 8f12d36b76 tests: fixup trailing whitespace in expected results 2023-01-21 20:22:03 +00:00
Ariadne Conill 6a5b55740d tests: fix test regressions caused by tilde changes 2023-01-21 19:25:46 +00:00
Ziemowit Łąski 1c3f246198 pkgconf: Handle spaces correctly when expanding variables
Given the following .pc fragment:

includedir=/mingw64/include
Cflags: -I${includedir} -I${includedir}/taglib

Should includedir be assigned the value 'C:/Program\ Files/Git/mingw64/include', the expansion of ${includedir} will be chopped off after the first space:

Cflags: -IC:/Program\

With this patch, the expansion is corrected:

Cflags: -IC:/Program\ Files/Git/mingw64/include -IC:/Program\ Files/Git/mingw64/include/taglib

Create spaces-in-paths.pc
2023-01-20 22:18:26 +00:00
Eli Schwartz 8f233383cd meson: remove useless command that isn't needed
The tests/*.sh are executable in the source tree, and don't need to be
chmodded after being copied to the build tree.
2023-01-20 22:13:21 +00:00
Ariadne Conill 2f51733e34 tests: add regression test for billion-laughs 2023-01-20 22:11:00 +00:00
Ariadne Conill 3e481581ba add billion-laughs test fixture 2023-01-20 22:01:38 +00:00
Ariadne Conill dbd78db67f tests: add regression test for github #259 2022-08-16 19:42:13 +00:00
Ariadne Conill 8764578719 tests: ignore stdout on regress:missing test 2022-08-08 09:26:22 +00:00
Ariadne Conill 884a88583b tests: add testcase for requires.private debounce 2022-08-08 08:56:53 +00:00
Ariadne Conill 4e8f376c5d tests: add fixtures for github #258 2022-08-08 05:26:00 +00:00
Ariadne Conill 94b3f118cc tests: add regression test to catch --modversion regression introduced by new solver 2022-08-08 00:37:07 +00:00
Ariadne Conill 666b520273 tests: add tests for SPDX license assertions 2022-08-07 04:40:31 +00:00
Ariadne Conill 9aa0006c27 tests: improve circular reference tests to make use of the circular reference diagnostic 2022-08-07 01:35:12 +00:00
Dylan Baker dd779ad9f8 meson: add check to run_command
Because we really should be checking that it succeeds, and because not
setting it is deprecated.
2022-08-01 09:40:08 -07:00
Dylan Baker c04097e491 meson: pass configured files idiomatically
Instead of attempting to figure out what the paths will be, take the
returned file object and pass that around, meson will then automatically
figure out the correct paths.
2022-08-01 09:40:08 -07:00
Dylan Baker 06fe2e23b0 meson: use current_source_dir and current_build_dir instead of *_root
The latter doesn't work correctly when being used as a subproject, as it
returns the *absolute* root. So if pkgconf is being built as part of
muon, then it will return muon's source root. current_source_dir, on the
other hand returns the directory correctly whether being built as a
subproject or superproject.
2022-08-01 09:40:08 -07:00
Ariadne Conill f93870efd9 tests: add testcase for legacy FDO rules plus pc_sysrootdir 2022-07-26 18:05:31 +00:00
Ariadne Conill 18e2406002 tests: add omg-sysroot-uninstalled fixture 2022-07-26 18:03:15 +00:00
Ariadne Conill 6c70781aad introduce PKG_CONFIG_PKGCONF1_SYSROOT_RULES for legacy pkgconf behavior 2022-07-26 18:00:22 +00:00
Ariadne Conill d9ec3ee642 tests: add testcases for confirming desired sysroot behavior regarding -uninstalled packages 2022-07-26 16:46:39 +00:00
Ariadne Conill 7fa632a658 tests: sysroot: add additional tests 2022-06-26 19:34:54 +00:00
Ariadne Conill 9950312fde tests: add additional test fixtures 2022-06-26 19:34:39 +00:00
Ariadne Conill 19b1befb5d add additional sysroot testcase fixtures 2022-06-26 19:21:52 +00:00
Ariadne Conill 623b8f7851 tests: further fixups 2022-06-26 18:56:36 +00:00
Ariadne Conill ab352222a2 tests: fix up some test changes from the solver optimizations
the output of pkgconf is basically functionally equivalent in both cases
2022-06-26 18:22:04 +00:00
Ariadne Conill bf933903aa hackfix a couple of flaky tests 2021-10-07 01:29:29 -06:00
Ariadne Conill a10a88ef64 tests: regress: disable sysroot_munge test for now, not working with distcheck 2021-07-24 20:39:29 -06:00
Sandro Mani ed86f2dda3 Don't prepend sysroot_dir if pkg-config file lies outside of sysroot_dir 2021-07-24 20:43:58 -05:00
Christoph Reiter 4be39c59fb Remove usage of cygwin_conv_path() under cygwin/msys
This converted Unix paths to Windows paths, but all cygwin tools
work with Unix paths so this shouldn't be needed.

There is one use case if you use a cygwin pkgconf with a non-cygwin toolchain,
but pkgconf works reasonable well natively now so this shouldn't be needed
anymore and more likely leads to problems and confusion.

Both cygwin and msys have patched this out already:
* https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/pkgconf.git;a=blob;f=pkgconf.cygport;h=e5d003f3f3dfc9e374b916974018022ad8d68852;hb=HEAD#l55
* a4bce0c294/pkgconf/PKGBUILD (L26)
2021-03-20 06:58:53 -08:00
Ariadne Conill 347281ebfe tests: add fragment-comment testcase (ref #215) 2021-03-18 05:39:45 -06:00
Ariadne Conill d351e6ae59 Revert "tests: remove some no longer relevant bitrot in the test environment file"
This reverts commit 107ad34f8f.

Breaks autoconf.
2019-07-12 08:23:36 -05:00
Ariadne Conill 061627f091 meson: bump required version to 0.47 for copy directive 2019-07-12 08:20:05 -05:00
Ariadne Conill 107ad34f8f tests: remove some no longer relevant bitrot in the test environment file 2019-07-12 08:19:19 -05:00
Ariadne Conill 3740bfb6d7 tests: add test for malformed versions generating a diagnostic with --validate 2019-07-12 06:42:08 -05:00
Ariadne Conill a91e0bf215 tests: explicitly test --print-provides with malformed versions 2019-07-12 06:37:46 -05:00
Ariadne Conill 312b4e51a9 tests: add test for malformed version handling 2019-07-12 06:22:41 -05:00
Ariadne Conill 3783d65784 tests: add malformed-version fixture 2019-07-12 06:15:35 -05:00
William Pitcock 9315ee9ee6 tests: add orphaned-requires-private test 2019-01-14 14:07:19 -06:00
William Pitcock 737e326ae1 tests: add orphaned requires.private testcase 2019-01-14 14:04:50 -06:00
William Pitcock 47284486df regress: add test for empty tuple buffer overflow issue 2018-07-28 19:45:57 -05:00
William Pitcock 8f6e071d58 tests: add test fixture for bogus .pc files 2018-06-16 16:35:19 -05:00
William Pitcock ae7faf73fd tests: add testcase for tuple dequoting bug (legacy github bug #186) 2018-06-14 16:11:21 -05:00
William Pitcock 854a6adfe9 tests: add tuple-quoting fixture 2018-06-14 15:31:00 -05:00
Leorize f36ccc1d91 libpkgconf: add support for Haiku
client: use BELIBRARIES

On Haiku, BELIBRARIES is the equivalent to LIBRARY_PATH on many other
systems, while LIBRARY_PATH is instead the LD_LIBRARY_PATH of Haiku.

pkg: bootstrap package search paths with Haiku's find_paths

This commit adds build_default_pkgconfig_path. The function appends
to the list given the default pkgconfig paths, and will supersede
get_default_pkgconfig_path
2018-04-05 10:02:54 -05:00
William Pitcock 3f753fa3dd libpkgconf: dependency: preference uncoloured nodes in event of a dependency collision 2018-03-18 19:03:18 -05:00
William Pitcock 9a53290d8a tests: add new test fixtures for Requires.internal 2018-03-18 18:00:04 -05:00