You are not logged in.

#1 Today 05:03:23

furrykef
Member
From: Oklahoma City, USA
Registered: 2024-02-25
Posts: 13

PKGBUILD issue: file installed by npm has wrong owner

This is a minimal PKGBUILD to demonstrate the issue:

pkgname=fakepkg
pkgver=0.0
pkgrel=1
pkgdesc='Not a real package'
arch=('any')
makedepends=('npm')

package() {
    npm install -g --prefix "$pkgdir/usr" vectra@0.2.2
}

Run `makepkg`, then run `namcap *.zst`. You should get the following error:

fakepkg E: File (usr/lib/node_modules/vectra/bin/vectra.js) is owned by furrykef:furrykef

Obviously, the offending uid and gid will be different, but the message should otherwise be the same. Several files will be packaged, but only this one file in the package will have the problem. I have no idea why.

Not every package installed by npm has this issue. In fact, most don't. But there are nonetheless others that do, such as wavefile@11.0.0. I ran into the issue while trying to package a program that happens to have vectra and wavefile as dependencies (specified via the program's package.json rather than in the PKGBUILD like this).

You can work around the issue by chowning everything in "$pkgdir/usr/lib/node_modules" to root:root after running npm, but this step is easily missed and shouldn't be necessary.

Offline

Board footer

Powered by FluxBB