Commit Graph

35 Commits (4be39c59fbad1008af6e06e9a76f53f9c0b48d43)

Author SHA1 Message Date
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 dbb6a232e5 path: don't use PATH_MAX, use PKGCONF_ITEM_SIZE * 4 for realpath buffer 2021-03-18 06:56:55 -06:00
Fabian Groffen 13a5d9a5f0 libpkgconf: path: supply buffer to realpath
To avoid a crash on some platforms (like Darwin 9) provide a buffer to
realpath(3).

Darwin 9 (last PPC target) documents realpath needs to be given a buffer
to the resolved_path argument large enough to hold PATH_MAX bytes.
With NULL argument it crashes.  Solaris makes no mention of
resolved_path to be allowed NULL, yet recent versions accept it and
malloc(3) accordingly.

Because the documentation explicitly mentions PATH_MAX being the limit
to what realpath(3) would write in resolved_path, switching to a static
buffer here doesn't limit resolution compared to dynamically allocating
a buffer by realpath(3).

While this change requires a bit more space on the stack, it avoids a
malloc/free sequence, and allows successful operation on (older)
platforms that lack support for dynamically allocating a return buffer
in realpath(3).

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2021-01-08 18:44:40 -05:00
Ariadne Conill 2a8bebf289 libpkgconf: path: rewrite DOS paths in non-cygwin case too 2020-06-11 18:00:56 -06:00
Ariadne Conill 7e0b0fadab libpkgconf: path: fix memory leak when deduping paths (closes #39) 2019-07-11 03:43:18 -05:00
Alexander Tsoy db9c1e96a1
fix the order of header includes
config.h should be included before stdinc.h, otherwise large file
support is not enabled.

Downstream bug: https://bugs.gentoo.org/687548
2019-06-08 04:55:52 +03:00
William Pitcock 3afd14c49e libpkgconf: path: use realpath(3) to deduplicate the search path
closes #24
2019-03-23 22:27:05 -05:00
William Pitcock 43e8c7b44d libpkgconf: path: add path list copying function 2018-05-09 16:35:21 -05:00
William Pitcock 4589274c43 libpkgconf: start to remove PKGCONF_BUFSIZE allocations from the stack. (closes #149)
Patch by Karen Arutyunov.
2017-10-16 12:56:19 -05:00
William Pitcock 36551cca83 libpkgconf: path: relocate the path before doing dedup checks (closes #151) 2017-10-16 11:30:22 -05:00
William Pitcock 3bc2e21dd1 libpkgconf: path: ensure entire buffer is zeroed before calling realpath() on it (closes #150) 2017-10-16 11:26:27 -05:00
William Pitcock e9fd43caa7 libpkgconf: clean up header includes (closes #137) 2017-09-17 23:38:25 -05:00
William Pitcock a6d6b88d14 libpkgconf: path: fix logic error in path relocation case when matching against a list (closes #129) 2017-09-08 18:27:04 -05:00
Dan Kegel 4d7b4d7c8e Minimal tweaks to compile with Visual C 2015 2017-06-04 19:19:55 -07:00
John Hein 9b255d465c If PKG_CONFIG_PATH element is a sym link, use the link destination instead of the link for inode caching checks.
See issue 112 & issue 110 (https://github.com/pkgconf/pkgconf/issues)
2017-02-24 23:26:41 -06:00
John Hein 76b8e0a26b Normalize the path to remove duplicate / separators rather than possibly altering the path with realpath(3). Leave sym links as is in path components. This is also cheaper than realpath(3), and works on platforms that don't have realpath(3).
Note: if this is accepted, the check for realpath in configure.ac
can be removed, and some docs that mention realpath will be adjusted.
2017-02-24 23:26:10 -06:00
William Pitcock b06bbe75a4 libpkgconf: path: only enable cygwin path relocation backend for msys (ref #72) 2017-01-23 23:17:26 -06:00
William Pitcock 1ee3c12f53 libpkgconf: path: use pkgconf_path_relocate() when matching paths 2017-01-19 10:43:23 -06:00
William Pitcock fa927fd379 libpkgconf: path: pkgconf_path_relocate(): implement realpath backend 2017-01-19 10:36:07 -06:00
William Pitcock 0315832285 doc: document pkgconf_path_relocate() 2017-01-19 10:31:40 -06:00
William Pitcock 147fd80750 path: relocate system libdir/includedir if appropriate 2017-01-13 20:12:38 -06:00
William Pitcock 87a5a1f0cc path: when stubbing pkgconf_path_relocate(), suppress unused variables warnings 2017-01-13 20:08:22 -06:00
William Pitcock 1369f558c6 path: add new pkgconf_path_relocate() API which is a stub when path
relocation is not needed
2017-01-13 20:05:21 -06:00
Baptiste Daroussin 3b3f1dc76e Fix gcc warnings 2017-01-07 17:57:37 +01:00
Baptiste Daroussin 2e855972dc inode cache: ensure we never use an unitilized struct stat 2017-01-07 17:52:44 +01:00
Graham Ollis 9c426b6f2c do not filter non-existent directories if filter is off 2016-12-31 14:10:59 -06:00
William Pitcock 92f566ff38 libpkgconf: path: check both device node and inode for dedup. pointed out by @plicease 2016-12-30 11:39:45 -06:00
William Pitcock 2305031573 libpkgconf: path: make the duplicate filtering opt-in. some path lists should not be deduped (compiler path lists, for example) 2016-12-30 11:13:04 -06:00
William Pitcock bad0da0c03 libpkgconf: path: filter out duplicate path entries by inode if possible (closes #102) 2016-12-30 11:01:15 -06:00
William Pitcock aa041b415e libpkgconf: path: add naive path list filtering function 2016-12-30 10:44:01 -06:00
William Pitcock f6b074f267 libpkgconf: path: make pkgconf_path_match_list() take a const list argument 2016-12-21 19:50:05 -06:00
William Pitcock 4cc0d017da libpkgconf: document path module 2016-12-10 20:14:42 -06:00
William Pitcock e7f4846508 libpkgconf: path: add cleanup functions 2016-12-02 00:04:43 -06:00
William Pitcock 4bb46e20e3 libpkgconf: add path matching and environment building functions 2016-11-30 22:36:35 -06:00
William Pitcock f4da1082cb libpkgconf: refactor some path operations 2016-11-30 22:15:13 -06:00