Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package names that contain x86_64 break xbps-install/xbps-remove #600

Open
classabbyamp opened this issue Aug 13, 2024 · 3 comments
Open

Comments

@classabbyamp
Copy link
Member

xbps will successfully index a package with the name containing x86_64 but cannot install it (or sometimes can, but cannot uninstall it). I was unable to reproduce this with another architecture (like calling a package foo-aarch64-1.0_1) or with just a false revision (like foo_1-1.0_1).

mkdir -p pkg/foo/bar repo root
echo asdf > pkg/foo/bar/baz
cd repo
xbps-create -A noarch -n foo-x86_64-1.0_1 -s "foo pkg" ../pkg
xbps-rindex -d -a ./*.xbps
cd ..
xbps-install -r root -R repo -yvd foo-x86_64
[DEBUG] XBPS: 0.59.1 API: 20200221 GIT: UNSET
[DEBUG] Processing configuration directory: /tmp/xbps-test/root/etc/xbps.d
[DEBUG] Processing system configuration directory: /tmp/xbps-test/root/usr/share/xbps.d
[DEBUG] rootdir=/tmp/xbps-test/root
[DEBUG] metadir=/tmp/xbps-test/root/var/db/xbps
[DEBUG] cachedir=/tmp/xbps-test/root/var/cache/xbps
[DEBUG] confdir=/tmp/xbps-test/root/etc/xbps.d
[DEBUG] sysconfdir=/tmp/xbps-test/root/usr/share/xbps.d
[DEBUG] syslog=true
[DEBUG] bestmatching=false
[DEBUG] keepconf=false
[DEBUG] Architecture: x86_64
[DEBUG] Target Architecture: (null)
[DEBUG] Repository[0]=/tmp/xbps-test/repo
[DEBUG] [pkgdb] initialized ok.
[DEBUG] [rpool] checking `/tmp/xbps-test/repo' at index 0
[DEBUG] [repo] `/tmp/xbps-test/repo/x86_64-stagedata' open stagedata No such file or directory
[DEBUG] [rpool] `/tmp/xbps-test/repo' registered.
[DEBUG] [rpool] checking `/tmp/xbps-test/repo' at index 0
[DEBUG] xbps_transaction_install_pkg: trans_find_pkg foo-x86_64: 2
Package 'foo-x86_64' not found in repository pool.
[DEBUG] xbps_pkgdb_unlock: pkgdb_fd 3
[DEBUG] [pkgdb] released ok.
@classabbyamp classabbyamp changed the title package names that contain x86_64 break xbps package names that contain x86_64 break xbps-install/xbps-remove Aug 13, 2024
@Chocimier
Copy link
Member

foo-x86_64 looks like pkgname foo, version x86, revision 64. Passing exact pkgver as argument to xbps-install is a documented feature to select package from repository by available version.

Would you suggest to reject pkgnames that look like pkgver in xbps-create?

@classabbyamp
Copy link
Member Author

Would you suggest to reject pkgnames that look like pkgver in xbps-create?

this is probably the most sane solution

@classabbyamp
Copy link
Member Author

more problematic reproducer:

mkdir -p pkg/foo/bar pkg2/foo/baz repo root
echo asdf > pkg/foo/bar/baz
echo jkl > pkg2/foo/baz/idk
cd repo
xbps-create -A noarch -n foo-bar-x86_64-1.0_1 -s "foo pkg" ../pkg
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" -D "foo-bar-x86_64>=0" ../pkg2
xbps-rindex -d -a ./*.xbps
cd ..
xbps-install -r root -R repo -yvd foo
[DEBUG] XBPS: 0.59.1 API: 20200221 GIT: UNSET
[DEBUG] Processing configuration directory: /tmp/xbps-test/root/etc/xbps.d
[DEBUG] Processing system configuration directory: /tmp/xbps-test/root/usr/share/xbps.d
[DEBUG] rootdir=/tmp/xbps-test/root
[DEBUG] metadir=/tmp/xbps-test/root/var/db/xbps
[DEBUG] cachedir=/tmp/xbps-test/root/var/cache/xbps
[DEBUG] confdir=/tmp/xbps-test/root/etc/xbps.d
[DEBUG] sysconfdir=/tmp/xbps-test/root/usr/share/xbps.d
[DEBUG] syslog=true
[DEBUG] bestmatching=false
[DEBUG] keepconf=false
[DEBUG] Architecture: x86_64
[DEBUG] Target Architecture: (null)
[DEBUG] Repository[0]=/tmp/xbps-test/repo
[DEBUG] [rpool] checking `/tmp/xbps-test/repo' at index 0
[DEBUG] [repo] `/tmp/xbps-test/repo/x86_64-stagedata' open stagedata No such file or directory
[DEBUG] [rpool] `/tmp/xbps-test/repo' registered.
[DEBUG] xbps_repo_get_pkg: found foo-1.0_1
Found foo-1.0_1 in repository /tmp/xbps-test/repo
[DEBUG] [trans] `foo-1.0_1' stored (/tmp/xbps-test/repo)
[DEBUG] xbps_transaction_install_pkg: trans_find_pkg foo: 0
[DEBUG] xbps_transaction_prepare: processing deps
[DEBUG] Finding required dependencies for 'foo-1.0_1':
[DEBUG] foo-1.0_1: requires dependency 'foo-bar-x86_64>=0': not installed.
[DEBUG] [rpool] checking `/tmp/xbps-test/repo' at index 0
[DEBUG] xbps_repo_get_pkg: found foo-bar-x86_64-1.0_1
Found foo-bar-x86_64-1.0_1 in repository /tmp/xbps-test/repo
[DEBUG] [trans] `foo-bar-x86_64-1.0_1' stored (/tmp/xbps-test/repo)
[DEBUG] xbps_transaction_prepare: checking on hold pkgs
[DEBUG] xbps_transaction_prepare: checking replaces
[DEBUG] xbps_transaction_prepare: checking revdeps
[DEBUG] xbps_transaction_prepare: checking conflicts
[DEBUG] xbps_transaction_prepare: checking shlibs
[DEBUG] xbps_transaction_prepare: computing stats

Name           Action    Version           New version            Download size
foo-bar-x86_64 install   -                 1.0_1                  - 
foo            install   -                 1.0_1                  - 

Size required on disk:           23B
Space available on disk:        31GB


[*] Verifying package integrity
[DEBUG] [trans] verifying 2 packages.
foo-bar-x86_64-1.0_1: verifying SHA256 hash...
foo-1.0_1: verifying SHA256 hash...

[*] Collecting package files
foo-bar-x86_64-1.0_1: collecting files...
foo-1.0_1: collecting files...

[*] Unpacking packages
foo-bar-x86_64-1.0_1: unpacking ...
foo-bar-x86_64-1.0_1: unpacked file `./foo/bar/baz' (7 bytes)
foo-1.0_1: unpacking ...
foo-1.0_1: unpacked file `./blah/blep/asdf' (16 bytes)

[*] Configuring unpacked packages
[DEBUG] [configure] cannot find foo-bar-x86_64 (foo-bar-x86_64-1.0_1) in pkgdb
[DEBUG] xbps_transaction_commit: configure failed for foo-bar-x86_64-1.0_1: No such file or directory
Transaction failed! see above for errors.
[DEBUG] xbps_pkgdb_unlock: pkgdb_fd 3
[DEBUG] [pkgdb] released ok.

it seems that you're right about it interpreting foo-bar-x86_64 as foo-bar, version x86, revision 64, as i think it gets confused looking for the foo-bar when trying to configure packages.

furthermore, in this reproducer, you get stuck with the package:

$ xbps-query -r root -l
uu foo-1.0_1            foo pkg
uu foo-bar-x86_64-1.0_1 foo pkg
$ xbps-remove -r root -Ry foo

Name           Action    Version           New version            Download size
foo            remove    1.0_1             -                      - 
foo-bar-x86_64 remove    -                 -                      - 

Size freed on disk:              23B
Space available on disk:        31GB

Removing `foo-1.0_1' ...
Removed `foo-1.0_1' successfully.
ERROR: foo-bar-x86_64-1.0_1: failed to remove package: No such file or directory
Transaction failed! see above for errors.
$ xbps-remove -r root -Ry foo-bar
Package `foo-bar' is not currently installed.
$ xbps-remove -r root -Ry foo-bar-x86_64
Package `foo-bar-x86_64' is not currently installed.

for some context: I ran into this when splitting qemu's emulators into packages like qemu-system-x86_64. Had to manually edit the pkgdb to remove qemu-system-x86_64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants