Commit Graph

1357 Commits

Author SHA1 Message Date
Duncaen
008e1ed901 lib/external/fexec.c: run child with 022 umask 2019-06-14 21:09:15 +02:00
Duncaen
c3f6f485a3 lib/repo_sync.c: set umask before creating repo cache directories 2019-06-14 21:08:55 +02:00
Juan RP
04291329aa
Bump XBPS_API_VERSION and libxbps major soname.
- struct xbps_handle was modified.
- xbps_pkg_is_ignored() was added to the API.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-14 09:54:51 +02:00
Juan RP
f6116fc2ac xbps_pkgdb_lock(): check if rootfs is writable.
As shown in https://github.com/void-linux/xbps/issues/110
/var might be rw, while / might be ro.

Check this via xbps_pkgdb_lock() for both things.

Close #110

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-13 17:41:01 +02:00
Juan RP
c3b2d7ca53 libxbps: fix xbps autoupdate when its revdeps are up-to-date.
The current code was failing because while checking for updates
on its reverse dependencies, up-to-date versions were treated
as an error.

Added a new test case to verify that it works as expected.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-13 14:18:31 +02:00
Juan RP
cf4f0f4aa0 xbps_alternatives_register: fix a memleak.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
bcd80f2936 xbps_alternatives_register: update pkgdb alternatives dictionary.
... otherwise the entry might not be added to our array and won't
hit pkgdb.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
1c85083a94 lib/package_alternatives.c: update copyright.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
f06edd8850 xbps_alternatives_register: no need to check for 'alloc'.
Found by @huglovefan. Thanks.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
639ff2d642 xbps_alternatives_register: get rid of an unnecessary change.
Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
d189921818 xbps_alternatives_register: fix test case "more_entries_update".
Even if the alternatives group is already registered, we need
to create the symlinks from current pkg dictionary (repo).

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
f4f9bef6e5 xbps_alternatives_register: find and remove obsolete symlinks.
This fixes the new test case "less_entries_update" contributed
by @duncaen.

If "alternatives" dict from pkgdb differs from the one from repos,
find obsoletes and remove them.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
04f899c80f xbps_alternatives_unregister: fix removal of current provider.
Fix logic as found by @duncaen in #101.

Also set "first" when the entry is removed from the array.

Fixes #102

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
c29efcd13b xbps_alternatives_unregister: fix xbps_set_cb_state().
In the !current branch, "first" wasn't initialized so it displayed garbage:

Removing `pinentry-tty-1.1.0_5' ...
Removing 'pinentry' alternatives group symlink: pinentry
pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group
Switched 'pinentry' alternatives group to 'p
o@�'
Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty
Removed file `/usr/bin/pinentry-tty'
Removed `pinentry-tty-1.1.0_5' successfully.

With my fix:

Removing `pinentry-tty-1.1.0_5' ...
Removing 'pinentry' alternatives group symlink: pinentry
pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group
Switched 'pinentry' alternatives group to 'pinentry'
Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty
Removed file `/usr/bin/pinentry-tty'
Removed `pinentry-tty-1.1.0_5' successfully.

Signed-off-by: Juan RP <xtraeme@gmail.com>
2019-06-11 19:53:19 +02:00
Juan RP
dd3dc2ddec xbps_symlink_target: always canonicalize rootdir.
... otherwise we might end up with a relative rootdir that will
give unexpected results.

dtrt when rootdir != /
2019-06-07 20:13:24 +02:00
Juan RP
9e2c00ee8b libxbps: remove dangling symlinks properly.
This fixes removal of packages that contain multiple levels
of dangling symlinks, i.e faenza-icon-theme and probably others.

Close #23
2019-06-07 20:13:24 +02:00
Juan RP
371be9703e Sync with portableproplib-0.6.8. 2019-06-04 21:43:52 +02:00
Duncaen
33fbe8a5ef fulldeptree: ignore missing local runtime dependencies
They most likely come from `ignorepkg` and without this patch
operations xbps-remove -R aborts if a dependency was ignored
at install time.
2019-05-27 12:41:39 +02:00
Duncaen
67badf983b lib/conf.c: ignore glob errors 2019-05-22 15:05:45 +02:00
Duncaen
79317563e9 lib/conf.c: fix including absolute paths 2019-05-22 15:05:45 +02:00
Duncaen
85bf13f138 lib: move conf parsing to lib/conf.c and refactor to not rely on getcwd/chdir
This fixes https://github.com/voidlinux/xbps/issues/158
2019-05-22 13:22:10 +02:00
Johannes Brechtmann
949d2d90e7 package_remove: fix length comparison 2019-05-16 11:04:48 +02:00
Juan RP
108a165534 libxbps: try to update revdeps when installing or updating pkgs.
This fixes the cases where a pkg installation or update
could break its revdeps due to not satisfying dependencies.

When performing an install or update, xbps now always checks if
there are updates for its revdeps and get added to the transaction.

See the two new test cases for more information.
2019-05-14 23:34:53 +02:00
Juan RP
2a9794968c proplib/prop_object: needs compat.h. 2019-04-22 15:32:06 +02:00
Juan RP
cf78b7272f lib/util: musl needs _{GNU,BSD}_SOURCE for strlc{at,py}(). 2019-04-22 15:31:07 +02:00
Juan RP
0db5ace61d configure: fix vasprintf test; cosmetics.
The vasprintf test was always failing because it needed stdarg.h.
Misc cosmetics: rename compat objs to COMPAT_OBJS.
2019-04-22 15:30:02 +02:00
Duncaen
456f775e4d alternatives: don't switch unchanged alternative groups on removal
Closes: #82 [via git-merge-pr]
2019-04-22 14:51:32 +02:00
Juan RP
1d8b95a993 package_config_files.c: fix a shadowed variable declaration.
Found by pcc.
2019-04-22 14:51:13 +02:00
Juan RP
c658e41747 fulldeptree: make sure there are no dups.
Added a test case to verify that dup deps are discarded
completely.
2019-04-22 14:51:13 +02:00
Juan RP
71775950e8 lib/fetch/http.c: fix https->http redirection via proxy.
See https://github.com/void-linux/xbps/issues/52

Thanks @jschultz

Closes: #79 [via git-merge-pr]
2019-04-22 14:49:54 +02:00
Andreas Kempe
0c657582f2 lib/fetch/common.c: send socks5 request as a single transaction
Splitting the socks5 request is causing issues when running against Tor.
It causes Tor to fail with an address unknown error. Assembling the
request and sending it in its entirety solves the issue.

An strace of torsocks, that functions correctly when used with xbps, shows
that the request is being sent all at once:

        recvfrom(3, "\5\0", 2, 0, NULL, NULL)
        sendto(3, "\5\1\0\3>lysator7eknrfl47rlyxvgeamrv7ucefgrrlhk7rouv3sna25asetwid.onion\0P", 69, 0, NULL, 0)
        recvfrom(3, "\5\0\0\1\0\0\0\0\0\0", 10, 0, NULL, NULL)

Closes: #54 [via git-merge-pr]
2019-04-20 11:11:40 +02:00
human
b502dc708a fix setting alternatives for packages with more than one group 2019-04-20 11:10:34 +02:00
Duncaen
ea2cb1d369 unpack: keep conf_files replaced with symlinks, unpack as .new-pkgver 2019-04-20 10:56:08 +02:00
Duncaen
cd4c07a467 libxbps: sane umask for pkgdb and files plists 2019-04-20 10:46:59 +02:00
Duncaen
d1667fd931 Add the ability to ignore packages
The previous idea was to use virtual packages in the users configuration
to satisfy dependencies by mapping them to existing installed packages.
Using virtual packages for it doesn't work as expected and trying to make
it work would break other functionalities of virtual packages, like the
version satisfaction checks for `provides` and the ability to replace
virtual packages with real packages. The virtual package functionality
should be used exclusively for virtual packages.

This allows users to specify packages packages that should be ignored.
Ignored packages in dependencies are always satisfied without installing
the package, while updating or installing a package that depends on an
ignored package.

This does NOT ignore the shlib checks, ignoring a package that provides
required shared libraries will abort the transaction as if there was no
package that provides the required shared library.
2019-04-19 23:07:59 +02:00
Duncaen
9f52a7837f lib/fetch: add happy eyeballs connect algorithm (RFC6555/RFC8305)
Connect to the addresses from `getaddrinfo(3)`,
alternating between address family,
starting with ipv6 and wait `fetchConnDelay`
between each connection attempt.

If a connection is established within the attempts,
use this connection and close all others.

If `connect(3)` returns `ENETUNREACH`, don't attempt more
connections with the failing address family.

If there are no more addresses to attempt,
wait for `fetchConnTimeout` and return the first established
connection.

If no connection was established within the timeouts,
close all sockets and return -1 and set errno to
`ETIMEDOUT`.
2019-04-19 22:58:50 +02:00
Juan RP
291faddf8c xbps now also updates revdeps of itself if there's an update.
Close https://github.com/void-linux/xbps/issues/77

Closes: #78 [via git-merge-pr]
2019-04-19 22:57:42 +02:00
Juan RP
08aa44602f xbps_array_foreach_cb_multi: fix incorrect array counter.
This fixes some races that could be seen when there's a
determined number of pkgs and CPU threads.
2019-04-19 22:57:42 +02:00
Juan RP
580a5ba29b xbps_get_pkg_fulldeptree(): fix all known bugs and make it 50x faster.
faster: use a hash table with pkg names on the transaction dict,
 the process of collecting and sorting is now 50x faster or
 even more (kde5).

bugs: this now detects cyclic deps and returns with an appropropiate
 return value: ELOOP and ENOENT in xbps-query(1) --fulldeptree.
 Ping me if you need more details :-)

Close https://github.com/void-linux/xbps/issues/16
Close https://github.com/void-linux/xbps/issues/5
2019-04-19 22:57:42 +02:00
human
8d594727cc lib/util.c: improve error handling in xbps_binpkg_{arch,pkgver}
they no longer assert or segfault on malformed strings

Closes: #48 [via git-merge-pr]
2019-04-14 15:01:18 +02:00
Johannes Brechtmann
2745e25740 lib/package_remove: order directories before removal
The order of entries in files.plist is inconsistent
between different releases of xbps. Hence they must be
ordered before removal to, so sub directories are removed
before their parents.
2019-04-14 14:30:16 +02:00
Duncaen
5aabfe3ad9 fix indention 2019-04-14 12:37:24 +02:00
Duncaen
4d1f9832c1 lib/package_find_obsoletes: fix comment 2019-04-14 11:52:32 +02:00
Yuxuan Shui
2c69345acc Don't process processed packages again in collect_rdeps
Otherwise we will get exponential time complexity
2019-04-14 11:25:41 +02:00
Duncaen
07ec982b07 lib/fetch/http.c: ignore headers after CONNECT response 2019-04-08 13:34:23 +02:00
Duncaen
c1a64ba86e Revert "lib/initend.c: Fix user virtual packages"
This reverts commit bea146c724.
2019-03-22 22:34:11 +01:00
kayvenm
bea146c724 lib/initend.c: Fix user virtual packages
Dictionary was never initialized because of wrong condition check

Closes: #265 [via git-merge-pr]
2019-03-22 21:45:44 +01:00
Cameron Nemo
5aa1adca90 lib/initend.c: xbps_init(): safer string handling
Signed-off-by: Cameron Nemo <camerontnorman@gmail.com>
Closes: #58 [via git-merge-pr]
2019-03-22 19:14:08 +01:00
wuhanck
b4eebafa6d upgrade to openssl 1.1.x. 2019-01-24 14:57:50 -05:00
Foxlet
0f33859701 Fix namespace violation 2018-09-25 22:11:30 -04:00