Commit Graph

1462 Commits

Author SHA1 Message Date
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
Enno Boland
e4702d9d3b
Merge pull request #6 from foxlet/fix-string-formatting
Fix string formatting of 64-bit unsigned integers
2018-07-30 20:28:09 +02:00
Enno Boland
a5bfc59203 prepare release 2018-07-30 13:47:08 +02:00
Foxlet
4eaf45a767 Fix string formatting of 64-bit unsigned integers 2018-07-17 20:50:48 -04:00
Enno Boland
bfd6b2e88e lib/plist.c: share workload more efficient between threads
Before this patch xbps had a constant slice count for every thread.
This resulted in unbalanced thread usage if the workload was
homogenous over the slices.

This patch replaces the naive slice count approach by spinlock based
reservation.
2018-07-02 13:18:23 +02:00
Juan RP
eaccf4813d Merge pull request #246 from ebfe/signed_pkgver
lib/package_unpack.c: verify signed pkgver matches
2017-10-25 09:17:55 +02:00
Juan RP
eae215e2a0 Merge pull request #234 from Duncaen/umask
Fix pkgdb and files plist permissions with restictive umask.
2017-10-25 09:13:26 +02:00
Agustin Chiappe Berrini
2cd0dc688f Fix compilation of initend for gcc 7
This is a trickier situation.

The original message:

```
initend.c:423:10: error: ‘%s’ directive output may be truncated writing 15 bytes into a region of size between 1 and 512 [-Werror=format-truncation=]
       "%s%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
          ^~
initend.c:422:3: note: ‘snprintf’ output between 16 and 527 bytes into a destination of size 512
   snprintf(xhp->confdir, sizeof(xhp->confdir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       XBPS_SYSCONF_PATH);
       ~~~~~~~~~~~~~~~~~~
initend.c:429:7: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation ]
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ^~~~~~~
initend.c:428:3: note: ‘snprintf’ output 2 or more bytes (assuming 513) into a destination of size 512
   snprintf(xhp->confdir, sizeof(xhp->confdir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
initend.c:434:9: error: ‘%s’ directive output may be truncated writing 17 bytes into a region of size between 1 and 512 [-Werror=format-truncation=]
      "%s%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
         ^~
initend.c:433:2: note: ‘snprintf’ output between 18 and 529 bytes into a destination of size 512
  snprintf(sysconfdir, sizeof(sysconfdir),
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      "%s%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      XBPS_SYSDEFCONF_PATH);
      ~~~~~~~~~~~~~~~~~~~~~
initend.c:455:11: error: ‘%s’ directive output may be truncated writing 14 bytes into a region of size between 0 and 511 [-Werror=format-truncation=]
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
           ^~
initend.c:454:3: note: ‘snprintf’ output between 16 and 527 bytes into a destination of size 512
   snprintf(xhp->cachedir, sizeof(xhp->cachedir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       XBPS_CACHE_PATH);
       ~~~~~~~~~~~~~~~~
initend.c:461:7: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation ]
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ^~~~~~~
initend.c:460:3: note: ‘snprintf’ output 2 or more bytes (assuming 513) into a destination of size 512
   snprintf(xhp->cachedir, sizeof(xhp->cachedir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
initend.c:467:11: error: ‘%s’ directive output may be truncated writing 12 bytes into a region of size between 0 and 511 [-Werror=format-truncation=]
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
           ^~
initend.c:466:3: note: ‘snprintf’ output between 14 and 525 bytes into a destination of size 512
   snprintf(xhp->metadir, sizeof(xhp->metadir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "",
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       XBPS_META_PATH);
       ~~~~~~~~~~~~~~~
initend.c:473:7: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation ]
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ^~~~~~~
initend.c:472:3: note: ‘snprintf’ output 2 or more bytes (assuming 513) into a destination of size 512
   snprintf(xhp->metadir, sizeof(xhp->metadir),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s/%s", strcmp(xhp->rootdir, "/") ? xhp->rootdir : "", buf);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```

It's basically warning about dangerous operations on strings. And as
far as I could tell, is a valid warning and not a false alarm!

This fix makes the concept of `XBPS_MAXPATH` lose a little bit of sense
as now it doesn't necessarily represent the max size of the paths used
by xbps, but instead the max allowed size of the path configured.

I think this change is ok, but I wasn't able to find any reference to
why it was chosen to be 512. POSIX mandates at least 256, so I'm not
breaking anything that wasn't broken already, and Linux seems to have
a maximum size of 4096, which is pretty safe.

Therefore, this changes should be harmless. I think.
2017-08-22 18:35:45 -04:00
Agustin Chiappe Berrini
be5277591f Fix compilation in ftp.c
When trying to compile the file ftp.c, I get errors related with
warnings that were marked to be reported as error.

This was the original message:

```
fetch/ftp.c:444:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
   type = 'D';
   ~~~~~^~~~~
fetch/ftp.c:445:2: note: here
  case 'D':
  ^~~~
fetch/ftp.c: In function ‘ftp_request’:
fetch/ftp.c:342:3: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
   for (i = 0; i <= len && i <= end - dst; ++i)
   ^~~
fetch/ftp.c:342:24: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
   for (i = 0; i <= len && i <= end - dst; ++i)
               ~~~~~~~~~^~~~~~~~~~~~~~~~~
```
2017-08-22 18:03:32 -04:00
Michael Gehring
4aae026615 lib/package_unpack.c: verify signed pkgver matches
$ARCH-repodata is currently not protected by a signature. While most of
the package metadata is also embedded into the .xbps files, which are
protected by a signature, xbps-install ignores it
(1670ff000d/lib/package_unpack.c (L123))
and relies entirely on $ARCH-repodata.

This enables anyone who is able to modify the $ARCH-repodata to
substitute packages. This patch adds a check that verifies the signed
pkgver matches the one in the repodata, so at least downgrades posing as
updates are detected.

This is an incomplete fix as the whole transaction is still set up with
the unsigned repodata and other issues surely exist. The real fix is
signing $ARCH-repodata.
2017-07-09 12:46:01 +00:00
Duncaen
e797936c40 lib/repo_sync.c: sane umask for repodata files 2017-02-27 18:50:19 +01:00
Duncaen
332fbc195a lib/package_unpack.c: set a sane umask for pkg files plists 2017-02-27 18:24:51 +01:00
Duncaen
44778867df lib/pkgdb.c: set a sane umask for pkgdb plist 2017-02-27 18:24:46 +01:00
Duncaen
cf43597e74 lib/package_unpack.c: add memleak notice 2016-09-25 21:47:58 +02:00
Duncaen
797796e086 lib/transaction_shlibs.c: fix memleak 2016-09-25 21:47:40 +02:00
Duncaen
4797dee468 lib/package_configure.c: fix memleak 2016-09-25 21:27:46 +02:00
Duncaen
3b04602cc6 lib/package_alternatives.c: cleanup create_symlinks 2016-09-05 16:03:41 +02:00
Duncaen
dd7a0d073b lib/package_alternatives.c: remove previous symlinks 2016-09-05 02:03:30 +02:00
Duncaen
08b9ed878f lib/fetch: default port, error checks and authentication support 2016-09-02 17:50:05 +02:00
Duncaen
30ace44394 lib/fetch: add socks5 support 2016-09-01 00:38:55 +02:00
Enno Boland
934a59ecd9 lib/fetch/http.c: send proxy auth on https as connect header.
fixes #185
2016-07-08 08:24:14 +02:00
Enno Boland
842ac7c97e lib/util_hash.c: fix memleak. 2016-06-20 10:03:49 +02:00
Enno Boland
30d1d0f607 util_hash.c: void return value 2016-06-17 17:03:43 +02:00
Enno Boland
cb94ffe1c0 util_hash.c: fail on negative result code of read. 2016-06-17 17:03:43 +02:00
Enno Boland
b55ffeceae lib/util_hash.c: write directly to malloced string instead if coping it over 2016-06-16 07:00:08 +02:00
Enno Boland
df97be6a54 lib/verifysig.c: use xbps_file_hash_raw()
instead of mmap'ing the source file, xbps_file_hash_raw is used
to generate a digest of the file.
2016-06-16 06:51:10 +02:00
Enno Boland
7ce66edc57 lib/util_hash.c: add xbps_file_hash_raw method
this function does not mmap the target file and therefore
avoids out of memory exceptions on 32bit systems.
2016-06-16 06:51:10 +02:00
Enno Boland
0b96156b5e Merge pull request #174 from ebfe/stage-leak
lib/repo: plug stage repo mem leak
2016-06-04 07:48:39 +02:00
Michael Gehring
46744c412d lib/fetch/common.c: fix build with -Werror=misleading-indentation
Fixes #179
2016-06-03 20:26:52 +02:00
Michael Gehring
2d6e865d00 lib/repo: plug stage repo mem leak 2016-05-04 09:46:14 +02:00
Enno Boland
7c8b1d7aaa lib/fetch/http.c: HTTP CONNECT needs two \r\ns 2016-04-27 11:04:14 +02:00
Enno Boland
3a5c1f3a71 lib/fetch/http.c: fix EOL at HTTP CONNECT
fixes #172.
2016-04-26 13:59:49 +02:00
Juan RP
adcc6d16a4 lib/fetch/common.c: simplify ssl_init(). 2016-04-24 19:20:54 +02:00
Michael Gehring
793de8399c lib: dont call EVP_cleanup in fp2str
Calling EVP_cleanup here undoes initialization already done in
lib/fetch/common.c ssl_init() causing subsequent attempts to call
SSL_CTX_new() to fail. Which ultimately is the root cause for #170.

Fixes #170
2016-04-24 16:40:25 +02:00
Juan RP
eb3d227d61 lib/fetch: check that SSL_CTX_new() does not fail and print its errors (#170).
Thanks @ebfe.
2016-04-24 08:42:32 +02:00
Juan RP
b810c25601 lib/fetch/common.c: dup pthread.h inclusion. 2016-04-23 07:04:25 +02:00
Juan RP
e2e8eea490 lib/fetch: also call SSL_load_error_strings() once (#167).
Close #168
2016-04-22 11:38:01 +02:00
Juan RP
228a89d51e Use pthread_once(3) to initialize openssl/libressl just once.
Fixes openssl initialization concurrently by multiple threads.
Close #167
2016-04-22 11:32:34 +02:00
Juan RP
2434b90d6e libxbps: use xbps_strlc{at,py} everywhere. 2016-04-17 20:17:37 +02:00
Juan RP
048668b0fe xbps_transaction_shlibs: for providers also print its pkgver obj. 2016-04-17 17:54:49 +02:00
Michael Gehring
530149d90d lib/portableproplib: fix various oob reads/segfaults
Applies the following patches from NetBSD:

http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libprop/prop_object.c?rev=1.30&content-type=text/x-cvsweb-markup
http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libprop/prop_object_impl.h?rev=1.31.12.1&content-type=text/x-cvsweb-markup
2016-04-07 15:07:11 +02:00
Michael Gehring
51511231bf lib/repo.c: fix potential null pointer deref 2016-04-07 02:15:49 +02:00
Juan RP
35ad10ccbd Fix 29765271e correctly.
xbps_find_virtualpkg_in_conf() needs to look at the vpkgs set up in
configuration files, not from those set by pkgdb.

As a result of this the two test cases that were failing yesterday are now
fixed.
2016-03-24 10:23:20 +01:00
Enno Boland
fa635399f0 Merge pull request #156 from Gottox/atomic-rindex-a
xbps-rindex: check for consistent shlibs
2016-03-24 07:11:53 +01:00
Juan RP
29765271e9 xbps.d(5): 'virtualpkg' can now be used to map any pkg to another.
See NEWS for more information.
2016-03-23 12:46:52 +01:00
Enno Boland
4d1ee3b01d xbps-rindex: check for consistent shlibs
When adding packages to the index, xbps-rindex will check if the
consistency of shlibs is broken by a package. If so, rindex will create
a stage file and commit the packages there. Once the consistency is restored,
rindex -a will commit the stage area back to the public repo and delete the
stage file.
2016-03-21 08:31:18 +01:00
Enno Boland
897ac238c4 Revert "xbps-rindex: check for consistent shlibs"
This reverts commit 5f4e1ad43e which was
accidently checked in in the master branch.
2016-03-20 21:40:22 +01:00
Enno Boland
5f4e1ad43e xbps-rindex: check for consistent shlibs
When adding packages to the index, xbps-rindex will check if the
consistency of shlibs is broken by a package. If so, rindex will create
a stage repository and commit the packages there. Once the consistency
is restored, rindex -a will commit the stage area back to the public
repo and delete the stage file.
2016-03-20 21:36:30 +01:00
Michael Gehring
3bfc7b5e6d alternatives: fix dirname() buffer reuse 2016-02-08 15:10:07 +01:00
Michael Gehring
ab0d5c847d libxbps: define _WITH_GETLINE for FreeBSD 2016-02-08 15:09:58 +01:00
Michael Gehring
618e504d30 actually use HAVE_FDATASYNC 2016-02-08 15:09:43 +01:00
Michael Gehring
0f56b68eac add HAVE_STRNSTR 2016-02-08 15:09:33 +01:00
Juan RP
041708f643 Revert "Execute pkg scripts via posix_spawn(3)."
This reverts commit e33f6354c3.

@Gottox pointed out why this won't work.
2016-02-06 10:56:32 +01:00
Juan RP
2130d5daa6 proplib/prop_data: avoid 0 sized allocation reported by clang-analyzer. 2016-02-06 09:41:27 +01:00
Juan RP
42994ada07 Fix xbps_dbg_printf arguments by using __attribute__((format, printf)).
Patch provided by Michael Ghering in #148.

Close #148
2016-02-06 09:13:38 +01:00
Juan RP
067687ce28 libxbps: ignore updates for pkgs with held deps. Close #143 2016-02-06 09:03:54 +01:00
Juan RP
e33f6354c3 Execute pkg scripts via posix_spawn(3). 2016-02-04 11:39:02 +01:00
Juan RP
91067c0547 xbps_symlink_target: fix bug introduced in b81b9ab. 2016-02-04 09:55:46 +01:00
Juan RP
1e733f4daa lib/util: fix a memleak detected by clang-analyzer. 2016-02-03 11:52:07 +01:00
Juan RP
f5f25a5ff4 xbps_symlink_target: fix a double free. 2016-02-02 11:51:26 +01:00
Juan RP
430a25f422 libxbps: execute pkg scripts with /bin/sh directly.
The pkg INSTALL/REMOVE scripts do not need to have the executable
bit set anymore, thus /tmp can be mounted with 'noexec' from now on.

GH #149
2016-02-02 11:28:48 +01:00
Juan RP
b81b9ab379 xbps_symlink_target: fix bb977c7 (v3). 2016-02-02 11:08:05 +01:00
Juan RP
d984eeeb47 xbps_symlink_target: fix bb977c7 (v2). 2015-12-21 17:50:13 +01:00
Juan RP
4c655fd56a xbps_symlink_target: fix bb977c7 2015-12-21 17:20:34 +01:00
Juan RP
9e524d831c fetch/common.c: fix a memleak found by clang-analyzer. 2015-12-21 17:12:14 +01:00
Juan RP
bb977c73e4 xbps_symlink_target: fix a meamleak reported by clang-analyzer. 2015-12-21 16:55:53 +01:00
Juan RP
9c4fa4909c libxbps: initialize locale correctly to handle UTF-8 filenames with musl.
This fixes unpacking of ca-certificates that wasn't unpacking the files
with UTF-8 characters correctly.
2015-12-11 09:59:16 +01:00
Juan RP
2830bbef6d package_remove: reset errno when a file does not exist (ENOENT).
To not propagate it later on... and also pass rv not errno to the
state callback function.
2015-12-01 08:31:05 +01:00
Juan RP
a9482027b2 xbps_array_foreach_cb_multi: handle the case of sysconf returning 0. 2015-11-26 07:18:14 +01:00
Juan RP
93b50bc4dc alternatives: preserve order while updating pkgs (thanks chris2/duncaen). 2015-11-17 16:32:12 +01:00
Juan RP
15ab86c90d alternatives: fix a double free in error path. 2015-11-15 09:23:51 +01:00
Juan RP
9ef83cfa69 alternatives: handle dirname() returning ".". 2015-11-15 09:17:05 +01:00
Juan RP
b3c7d27c6b alternatives: fix creation of symlinks with unexistent dirs.
If an alternative needs to create /usr/bin/foo, and /usr/bin
does not exist, this directory must be created prior to create
the symlink.
2015-11-14 07:26:27 +01:00
Juan RP
e0ce5641a3 lib/repo_pkgdeps.c: add missing \n in debug printfs. 2015-11-13 16:28:59 +01:00
Juan RP
2202482e0e conflicts: really fix the issue with on hold pkgs and update test case. 2015-11-12 13:23:00 +01:00
Juan RP
e9dbb7b2e9 conflicts: add some debugging and remove wrong path. 2015-11-12 13:06:09 +01:00
Juan RP
6a59b65e28 conflicts: fix previous again... 2015-11-12 12:54:53 +01:00
Juan RP
3a5f1f8ad5 conflicts: really ignore on hold pkgs from pkgdb. 2015-11-12 12:41:36 +01:00
Juan RP
784e43d876 conflicts: do not take into account conflicts for on hold pkgs. 2015-11-12 12:24:33 +01:00
Juan RP
0cf4a2c0c0 conflicts: another bugfix + test case. 2015-11-10 15:36:25 +01:00
Juan RP
da5ad3d052 lib/package_alternatives.c: fix builds on travis. 2015-11-10 12:05:20 +01:00
Enno Boland
ae44f32be2 lib/package_alternatives.c: fix memleak 2015-11-10 11:58:07 +01:00
Juan RP
0fced28044 lib/package_alternatives.c: error out if xbps_mkpath() fails.
... and ignore EEXIST for existing dirs.
2015-11-09 16:31:22 +01:00
Juan RP
594c48b9eb Merge pull request #133 from Gottox/relalt
lib/package_alternatives.c: always use relative symlinks in alternatives
2015-11-09 16:17:34 +01:00
Juan RP
182e5bb421 conflicts: ignore pkgs to be removed in transaction. 2015-11-09 16:00:15 +01:00
Enno Boland
2927e58df2 lib/package_alternatives.c: fix style 2015-11-09 08:52:49 +01:00
Enno Boland
78e3bde269 lib/package_alternatives.c: Handle // cases. 2015-11-08 10:47:25 +01:00
Enno Boland
19a65158d9 lib/package_alternatives.c: get rid of goto in normpath. 2015-11-08 10:38:31 +01:00
Enno Boland
8bd2808108 lib/package_alternatives.c: fix wrong /. handling for normalizing paths. 2015-11-08 10:37:26 +01:00
Enno Boland
635db51c27 lib/package_alternatives.c: always use relative symlinks in alternatives
This commit adds relative link support to lib/package_alternatives.c.
Instead of creating absolute links, xbps will create relative links
to the target. This allows to follow links on systems even if the
aren't mounted on /.
2015-11-07 08:40:57 +01:00
Juan RP
9b0cde3267 xbps-alternatives: dangling symlinks are now supported. 2015-11-02 21:02:37 +01:00
Juan RP
1ed8551c08 xbps_configure_packages: ignore internal xbps objects.
Fixes an assertion triggered by `xbps-reconfigure -a`.
2015-10-31 15:03:26 +01:00
Juan RP
f896b17ba7 alternatives: fix an assertion! 2015-10-31 14:19:50 +01:00
Juan RP
33a1bea633 alternatives: fix a warning. 2015-10-31 14:07:12 +01:00
Juan RP
512122da4c alternatives: really make relative symlinks this time. 2015-10-31 14:01:20 +01:00
Joey Gouly
b06ce15136 Allow relative symlinks in xbps-alternatives. 2015-10-31 11:54:01 +00:00
Juan RP
59a8d3d20e alternatives: skip dup alternative groups. 2015-10-31 11:47:58 +01:00
Juan RP
35718e676c Document alternatives in the API. 2015-10-30 13:18:32 +01:00
Juan RP
3ae197f94a xbps_pkgdb_unlock: there's no need to call xbps_pkgdb_update().
Users should call xbps_end() instead; this will flush pkgdb automatically.
2015-10-30 13:17:21 +01:00
Juan RP
cb857dfc27 Alternatives framework for xbps (2/2).
See xbps-alternatives(1) for more information.

Thanks to all who helped to design this and for fixing grammar in
the manual page.
2015-10-30 12:24:46 +01:00
Juan RP
f4cb178f6c libfetch: use default CA path rather than default CA file.
The default CA file set by FreeBSD is only available when using the
LibreSSL provided CA file, and we've decided to use the CA path
by default.

Discussed with @dominikh.
2015-10-28 07:31:26 +01:00
Juan RP
c4bce18734 Merge pull request #122 from GiedriusS/fix_1
libxbps: remove unused variable `pkgdepname'
2015-10-28 05:24:48 +01:00
Juan RP
a13a7fa896 Implemented reverse conflicts for pkgs in pkgdb and transaction. 2015-10-28 05:23:42 +01:00
Juan RP
2c81984f48 repo: fix 29608b0 correctly.
In 29608b0 local repos were simply ignored.
2015-10-27 14:22:30 +01:00
Juan RP
29608b0d8b repo: with XBPS_FLAG_REPOS_MEMSYNC only process remote repos. 2015-10-27 12:47:24 +01:00
Giedrius Statkevičius
5595bf95f1 libxbps: remove unused variable `pkgdepname' 2015-10-25 20:03:02 +02:00
Juan RP
90eb1d9433 libfetch: merge some features from FreeBSD:
- Supports HTTP/1.1 308 redirect.
- SSLv[23] HTTPS connections are forbidden by default.
- TLS client certificate validation thru OpenSSL.
- Fixes for user/password encoding, misc.
2015-10-24 07:52:30 +02:00
Juan RP
47c05047ea Merge pull request #108 from datenwolf/master
set umask for pkgdb creation/access
2015-10-21 09:11:55 +02:00
Juan RP
103caf0694 libxbps: extend the fix for #116 even more for the expected case.
This now catches both test cases correctly.
2015-10-19 18:19:24 +02:00
Juan RP
b069eb14ae libxbps: fixed issue #116 (vpkg does not replace pkg with update in trans).
Thanks to @dominikh for the test case.
2015-10-19 18:01:43 +02:00
Juan RP
4e446968c5 alternatives: do not ignore symlink(2) return value.
This fixes the travisci warning seen with gcc.
2015-10-19 17:11:34 +02:00
Juan RP
240d87af92 rpool: if pkg wasn't found set errno to ENOENT.
This is to return a proper error to the callers (i.e xbps-query(1)).
2015-10-19 17:05:55 +02:00
Juan RP
faeff38ca2 Alternatives framework (1/2) (WIP). 2015-10-18 10:38:35 +02:00
Juan RP
c457b594aa libxbps: fix eudev-libgudev -> libgudev fallout.
Packages to be replaced must be collected *before* checking for
broken reverse dependencies, otherwise them will always be detected
as broken.
2015-10-14 11:46:56 +02:00
Juan RP
d8fc08eb50 libxbps: make relative cachedir set via xbps.d(5) work again.
Close #117
2015-09-15 09:26:07 +02:00
Juan RP
782ec10111 xbps-create(1): timestamps of metadata files are now set to epoch.
Thanks to @Gottox for finding the real issue.
2015-09-03 11:12:49 +02:00
Juan RP
8081751f86 libxbps: print in verbose mode what pkgs are added to the transaction.
Useful to know why a transaction cannot be completed when there are
unresolved reverse dependencies.

Requested by @chris2.
2015-09-02 18:56:20 +02:00
Juan RP
0f2543a650 Fixed and improved msg when revdeps cannot be resolved in a transaction.
After:

$ xbps-install -un
re2-2015.07.01_1 (update) breaks installed pkg `chromium-44.0.2403.155_1'
Transaction aborted due to unresolved dependencies.
$

Before:

$ xbps-install -un
chromium-44.0.2403.155_1 broken, needs `re2-2015.07.01_1'
Transaction aborted due to unresolved dependencies.
$
2015-09-02 11:20:18 +02:00
Wolfgang Draxinger
bd8ea8133f fixed umask value 2015-08-19 15:42:48 +02:00
Wolfgang Draxinger
13f73ef41a Merge branch 'master' of github.com:voidlinux/xbps 2015-08-11 18:29:30 +02:00
Juan RP
8acc375487 portableproplib/prop_object: fix tyops in previous. 2015-07-26 09:16:32 +02:00
Juan RP
0d3c07cdee portableproplib/prop_object: fix an insecure temporary file (CID #62739). 2015-07-26 09:11:20 +02:00
Juan RP
36026451ce Fix some insecure temporary files reported by Coverity. 2015-07-26 09:02:04 +02:00
Juan RP
78f9a97980 lib/package_unpack: ignore remove(2) return value (CID #98681). 2015-07-26 08:22:27 +02:00
Juan RP
28f01b3836 xbps_transaction_package_replace: fix a resource leak (CID #98688). 2015-07-26 08:15:07 +02:00
Juan RP
0b7093e108 portableproplib/prop_object: handle possible NULL pointer deref (CID #62722). 2015-07-26 08:10:26 +02:00
Juan RP
a8d2b1d742 pkgdb: handle possible NULL pointer derefs (CID #98684). 2015-07-26 08:08:05 +02:00
Juan RP
7edabe907f xbps_rpool_release: fix a double free (CID #98695). 2015-07-26 08:03:16 +02:00
Juan RP
090464e4b2 xbps_sanitize_path: fix an out-of-bounds access (CID #98686). 2015-07-26 08:01:29 +02:00
Wolfgang Draxinger
47b5eea0f6 set umask for pkgdb creation/access so that pkgdb remains readable for world, even if xbps tools have been called with a very restrictive umask 2015-07-19 11:47:09 +02:00
Juan RP
a7378f70de fetch: fix regression introduced in 791e683e.
us->size and us->{a,m}time must be set after there's real data.
2015-06-30 21:48:21 +02:00
Juan RP
22ffc14026 Override and use a sane umask when performing pkg configuration.
Close #106
2015-06-28 05:14:02 +02:00
Juan RP
791e683e01 fetch: handle GET with offset == length.
While xbps_fetch_file() creates the .part file and for whatever reason
it did not finish properly to rename the file, it could request the server
to restart the download with offset set to file size, resulting in HTTP 416
return code.

Handle this case by checking if the server returns 416 and then checking
if the returned file size matches the requested offset and just rename
the file.

Thanks to @beefcurtains for the test case.
2015-06-28 04:28:55 +02:00
Juan RP
00149d0f37 xbps_transaction_prepare: if ENOSPC, keep the transaction dictionary.
... we need this in xbps-install to print required/free space on rootfs.

Close #101
2015-06-20 09:48:21 +02:00
Juan RP
1774d17e40 Keep /usr/sbin if found as obsolete, it's a symlink in void. 2015-06-05 08:29:05 +02:00
Juan RP
87fcc7d6a8 If pkg signature verification files, remove pkg archive and its signature file. 2015-06-04 09:59:52 +02:00
Juan RP
92c07c126f xbps_repo_lock: sleep() for a second if the lock is already taken.
... rather than looping continuously.
2015-06-04 08:08:40 +02:00
Juan RP
07e8330936 xbps-install(1): added -U --unpack-only to only unpack pkgs, skips configuration. 2015-06-03 11:15:11 +02:00
Juan RP
c464874c1e unpack: make sure the xucd callbacks don't get a dangling pointer.
If the current entry filename has been changed, the pointer must be updated
to point to the updated string.
2015-05-28 10:39:39 +02:00
Juan RP
769a997afb Introduce xbps_plist_{array,dictionary}_from_file().
Those are a wrapper around xbps_{array,dictionary}_internalize_from_zfile()
that prints a debugging msg when the plist file cannot be internalized.

Update xbps to use these wrappers.
2015-05-28 10:15:05 +02:00
Juan RP
2ba31e048a proplib: check for EOF a bit early on the internalized plist. 2015-05-28 09:34:03 +02:00
Juan RP
fd30a00cb4 proplib: fix a NULL pointer dereference when internalizing empty blobs.
_prop_object_internalize_context_alloc: make sure that passed xml string
is not NULL before derefering it a bit later.
2015-05-28 09:14:28 +02:00
Juan RP
4fdc8de9d6 repo: make index and index-meta dicts immutable.
For clients that want to modify its content they will need to copy a mutable
dictionary instead. This will avoid unwanted modifications.
2015-05-22 12:19:48 +02:00
Juan RP
5e97a1eb39 xbps_pkgdb_update: return EINVAL if pkgdb cannot be internalized. 2015-05-22 12:18:54 +02:00
Juan RP
da74e3dd9e libxbps: stop and error out if pkg signature is not valid. 2015-05-09 06:27:03 +02:00
Juan RP
c5d6556c50 xbps-remove: fix #95 (xbps-remove -R pkg lists/removes orphans) 2015-05-06 17:21:13 +02:00
Juan RP
ea364affc8 libxbps: open fds with O_CLOEXEC to avoid warnings of leaked fds. 2015-04-15 21:02:38 +02:00
Juan RP
15893caf0b fetch: support keep-alive even if the HTTP server returns 304 (Not-Modified). 2015-04-13 12:05:40 +02:00
Juan RP
2216c84eca libxbps: continue updating all pkgs if xbps is uptodate. 2015-03-29 11:06:18 +02:00
Juan RP
83ade39960 xbps now autoupdates itself exclusively if there's an update.
That was added for 0.21, but for some reason that I cannot remember it was
disabled a bit later... looks like it's useful to have.
2015-03-29 09:56:28 +02:00
Juan RP
9a16283575 Introduce xbps_repo_{un,}lock() to serialize write access to repodata.
We use a simple file lock that is created with O_CREAT|O_EXCL.
This should fix the concurrency issues with multiple processes
running xbps-rindex -a/-c on the same repository/arch combo.
2015-03-25 12:00:59 +01:00
Juan RP
dc47dfd593 xbps_get_pkg_fulldeptree: detect pkgs depending on itself via virtual pkgs.
Reported by Duncan Overbrook.

Update NEWS with recent changes.
2015-03-20 08:03:06 +01:00
Juan RP
f9b6dd9d2d proplib: anonymous mappings need MAP_ANON.
Somehow I removed this accidentally in a previous change... sigh.
2015-03-11 17:06:45 +01:00
Juan RP
95d650bdb1 lib/transaction_shlibs.c: add a printf to see what's going on. 2015-03-07 08:02:39 +01:00
Juan RP
441f147f05 Fix reinstallation of pkgs in repolock mode.
At the time we've been searching for the pkg in a repo, no repos
were registered resulting in EINVAL. While here, if there's no
declared repos return ENOENT instead.
2015-03-05 21:23:58 +01:00
Juan RP
4922c808f4 Implemented feature #77 (Add package repository locked mode)
Close #77
2015-03-03 12:11:28 +01:00
Juan RP
976718417b libxbps: remove "skip-obsoletes" handling; unnecessary with the mtime checks. 2015-02-26 19:51:03 +01:00
Juan RP
b6b446d32e libxbps: properly detect obsolete files with files being between pkgs.
120 test cases now successfully pass, and all known issues about
pkg updates that move files between them should be gone (hopefully).
2015-02-26 19:37:46 +01:00
Juan RP
cbe493858c libxbps: apply file timestamps to unmodified files on-disk while unpacking. 2015-02-25 11:10:18 +01:00
Juan RP
b133b9023c lib/package_unpack.c: wrap some long lines and fix an obvious error. 2015-02-24 09:34:39 +01:00
Juan RP
7e21f1ee1a xbps_symlink_target: rename var to avoid shadowing a global var. 2015-02-19 11:44:10 +01:00
Juan RP
9083191e4b xbps_symlink_target: double free in rootdir == '/' case. 2015-02-19 11:39:59 +01:00
Juan RP
6d65e76f91 xbps_symlink_target: fix a memleak. 2015-02-19 11:36:09 +01:00
Juan RP
a05e039cce Revert "Stop converting relative symlinks to absolute."
This reverts commit 9ae3638429.

This change is ok, but cannot be used right now because all existing
binpkgs were created with an old xbps-create(8).
2015-02-19 11:11:58 +01:00
Juan RP
9ae3638429 Stop converting relative symlinks to absolute.
There's no reason to make them absolute, simply store in the metadata
the target file as is. This vastly simplifies the code and makes all
test pass correctly.
2015-02-19 11:04:34 +01:00
Juan RP
67eba7d912 Improve detection of target file in relative symlinks.
If xbps-create(8) did not guess the target file of relative symlinks for
some reason, just compare the current symlink and what's stored as is,
without converting it to absolute.

This might happen with dangling relative symlinks or existing binary
packages that were not created with a newer xbps-create(8).
2015-02-19 10:24:24 +01:00
Juan RP
05f879ec09 Introduce xbps_symlink_target() and use it in two places.
This code is now shared by xbps-pkgdb and libxbps/xbps-remove.
2015-02-19 09:47:09 +01:00
Juan RP
1722635e08 Introduce xbps_sanitize_path() to fix #78 properly.
This removes multiple slashes of a path and returns you a buffer with
the sanitized string.
2015-02-18 15:12:39 +01:00
Juan RP
628a344560 libxbps: fix a memleak introduced in 1403826fa. 2015-02-17 16:39:04 +01:00
Juan RP
1403826fa6 libxbps: detect and remove properly symlinks with relative targets.
Close #78
2015-02-17 11:59:05 +01:00
Juan RP
0fc297a471 lib/transaction_ops.c: minor optimization. 2015-02-16 11:18:58 +01:00
Juan RP
2aa844f3f7 lib/Makefile: remove some disabled warnings for lib{fetch,portableproplib}.
There's no need to set _GNU_SOURCE and disable those compiler warning flags.
2015-02-15 05:47:35 +01:00
Juan RP
b8b4694b33 portableproplib: use posix_madvise rather than madvise.
The posix variant is the standardized version of madvise.
2015-02-15 05:42:18 +01:00
Juan RP
4e0ce0fbb4 libxbps: make the vpkg_provider_and_revdeps_downgrade test case work. 2015-02-10 10:55:05 +01:00
Juan RP
1ebb245672 xbps_transaction_store: print repo too. 2015-02-05 10:26:53 +01:00
Juan RP
c0d7d930de libxbps: make sure that revdeps of vpkg providers are always resolved.
Added new test cases to verify its correctness in upgrades and removals.
2015-02-05 10:04:42 +01:00
Juan RP
d607655371 libxbps: globally check for unresolved reverse dependencies.
Close #46. See NEWS for more information.
2015-02-03 10:20:13 +01:00
Juan RP
3bc6354550 lib/repo_pkgdeps.c: fix some debug printfs. 2015-02-02 09:37:34 +01:00
Juan RP
076b3f8c44 libxbps: add pkgs on hold mode to the transaction, but ignore them.
Those are there mostly to be shown by the clients and notify that
there's an update in repos that is being ignored.

Idea by @chneukirchen.
2015-01-28 12:07:47 +01:00
Juan RP
571d96fa92 libxbps: make sure to remove pkg metadata file on upgrades with skip-obsoletes.
This fixes the following case:

 - A-1.0_1 is installed and owns bin/foo.
 - A-1.1_1 is in the transaction and depends on B-1.0_1 that owns bin/foo.
 - B-1.0_1 is in the transaction and replaces A<1.1_1.
 - A-1.1_1 in the transaction now has "skip-obsoletes".
 - A is updated to 1.1_1, its metadata file (<pkgname>-files.plist) wasn't removed.

Added two new test cases to verify moving files from/to a dependency.
2015-01-27 17:53:37 +01:00
Juan RP
cbf1cfe0f5 libxbps: improve debug messages again. 2015-01-21 11:39:45 +01:00
Juan RP
b7fd0dcac5 xbps_transaction_shlibs: take into account shlibs from pkgs in the transaction. 2015-01-18 12:44:26 +01:00
Juan RP
f9eef6aa0d Perform global tracking of unresolved shlibs before accepting transaction.
Rather than checking per package being installed or updated, check
all installed packages to have all its shlib-requires resolved.
2015-01-18 10:23:52 +01:00
Juan RP
d11230a29d libxbps: abort pkg unpacking as soon as a file cannot be written.
Close #74
2015-01-18 10:22:05 +01:00
Juan RP
bce27b968e xbps_find_*pkg_in_array: fix logic when transaction obj string matches. 2015-01-17 06:04:22 +01:00
Juan RP
e438aae13c transaction_revdeps.c: remove dead code. 2015-01-14 21:00:37 +01:00
Juan RP
8263449f94 xbps_end: don't bother releasing everything; pkgdb is enough.
xbps-query -L now: 115ms
xbps-query -L before: 148ms

Fuck you valgrind!
2015-01-14 18:43:17 +01:00
Juan RP
a651f33832 xbps_pkgdb_release: don't bother releasing everything. 2015-01-14 17:34:00 +01:00
Juan RP
91b7b2fd5a Use a sane umask(2) before unpacking package files.
See https://github.com/voidlinux/void-packages/issues/835
for more information.
2015-01-11 11:01:09 +01:00
Juan RP
b23855f692 xbps_repo_close: only unlock the file lock if repo was opened as such.
If xbps_repo_open() was called with the lock arg set, xbps_repo_close()
will now unlock the repo file lock, without the need to set it.

This avoids the need to always unlock the file lock even if it wasn't
locked previously. This also introduceds an ABI/API break, but this
way it's cleaner.
2015-01-11 09:11:38 +01:00
Juan RP
7dea05f507 xbps_pkgdb_update: added 3rd bool arg "update", not update in memory pkgdb.
If true, the in memory pkgdb dict will be updated with data from the on-disk pkgdb.
2015-01-10 19:42:09 +01:00
Juan RP
7c153a2b15 pkgdb: disable pkgdb conversion code; 0.38 was released long ago. 2015-01-10 19:26:37 +01:00
Juan RP
ee175a2a68 Improve xbps_end() and use it before exit(3)ing.
- Simplify xbps_repo_open::repo_get_dict().
- Use xbps_end() in the utils where necessary.
- Make xbps_end() call xbps_pkgdb_unlock() if necessary.
- Make xbps_end() release rpool resources.
- Make xbps_end() release resources from xbps_handle.
- Fixed 90% of reported leaks (still reachable at exit) from valgrind.

That was to silence valgrind's memcheck with --leak-check=full.
2015-01-10 19:11:31 +01:00
Juan RP
8196811e2e lib/repo.c: indent previous. 2015-01-10 12:00:36 +01:00
Juan RP
b09faadebc xbps-{install,query}: --repository now accepts relative paths in local repos. 2015-01-10 11:59:31 +01:00
Juan RP
7b3a500139 libxbps: the provides obj now expects exact pkgver strings.
This reduces extra allocs and simplifies the code, which was just
there to workaround some broken pkgs anyway.
2015-01-10 07:26:23 +01:00