You are not logged in.

#1 2012-08-03 12:00:24

masutu
Member
Registered: 2010-01-30
Posts: 40

Package only works if build with makepkg as non-root user

Hi guys,

i got a strange problem with the package petri-foo, which i maintain.
The created package only works if i build it with makepkg as non-root user (which is anyway the recommended method, i know). If i install it with e.g. 'yaourt -S' as root, it builds without any errors, but launching it gives the following error message:

masutu:~$ petri-foo
[Petri-Foo] 13:14:14.251 Message: Reading global settings from: /home/masutu/.config/petri-foo/rc.xml
[Petri-Foo] 13:14:14.252 Message: Not running under session management
petri-foo: /tmp/yaourt-tmp-root/aur-petri-foo/src/petri-foo-0.1.85/libpetrifoo/driver.c:63: driver_start: Assertion `ndrivers > 0' failed.
zsh: abort      petri-foo

The same happens if i do e.g. 'packer -S petri-foo' as normal user (with giving root password before installing, no sudo),

masutu:~$ petri-foo
[Petri-Foo] 13:15:49.321 Message: Reading global settings from: /home/masutu/.config/petri-foo/rc.xml
[Petri-Foo] 13:15:49.322 Message: Not running under session management
petri-foo: /tmp/packerbuild-1000/petri-foo/petri-foo/src/petri-foo-0.1.85/libpetrifoo/driver.c:63: driver_start: Assertion `ndrivers > 0' failed.

But when i build the package as normal user with makepkg and install it afterward via 'pacman -U' as root everthing is working fine.
I took a quick look at the source code (i'm not a c programmer), here's a snippet of 'driver.c':

/* available drivers */
[...]
extern Driver  jack_driver;
static Driver* drivers[] = { &jack_driver, NULL };
static int ndrivers = 0;
static int curdriver = -1;
void driver_init(void)
{
    int i;

    for (i = 0; drivers[i] != NULL; i++, ndrivers++)
        drivers[i]->init();

    if ((ndrivers = i) < 0)
        ndrivers = 0;
}
[...]
int driver_start(void)
{
    assert(ndrivers > 0);  // this is line 63

    if (curdriver >= 0)
        drivers[curdriver]->stop();

    curdriver = 0;

    return drivers[curdriver]->start();
}
[...]

As said before, i'm not into c programming, but it looks like something's going wrong with the jack driver initialization. What's going on here?
The package even works if build as 'dummy' user (without the user being in any additional groups like audio or so) with makepkg, but fails if makepkg is done by root (bad practice, i know).
Don't know, if this is really an arch specific problem, or if there is some underlying issue.

Offline

#2 2012-08-03 22:12:37

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: Package only works if build with makepkg as non-root user

Hi Masutu,

I've not been able to reproduce this error. I have not got yaourt installed but have tried aurget and packer in the ways you describe and they don't show any problem installing or running petri-foo.

I wondered if you were running JACK as a regular user and Petri-Foo as root but I've tried that now and that doesn't reproduce the assert failure only this error:

ATTENTION: The playback device "hw:0" is already in use. The following applications are using your soundcard(s) so you should  check them and stop them as necessary before  trying to start JACK again:
jackd (process ID 1770)
cannot load driver module alsa

What happens when building Petri-Foo without aurget/packer/yaourt/etc?

Was there any particular reason for building with debug info? Can you post the debug messages that come before the assert failure?

Cheers,
James.
ps maybe post to petri-foo-devel unless you've resolved this issue.

Offline

#3 2012-08-06 01:41:55

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: Package only works if build with makepkg as non-root user

Ignore my comment where I make the assumption you are making a debug build. This is infact a bug in the Petri-Foo CMakeLists. The assertions should be disabled for a release build by #define'ing NDEBUG but NDEBUG was not #define'd.

However, #define'ing NDEBUG unearths a mysterious side-effect with the LFO modulation combo-boxes which I need to look into.

Offline

#4 2012-08-06 04:09:57

jwm-art
Member
Registered: 2011-02-01
Posts: 87

Re: Package only works if build with makepkg as non-root user

jwm-art wrote:

Ignore my comment where I make the assumption you are making a debug build. This is infact a bug in the Petri-Foo CMakeLists. The assertions should be disabled for a release build by #define'ing NDEBUG but NDEBUG was not #define'd.

However, #define'ing NDEBUG unearths a mysterious side-effect with the LFO modulation combo-boxes which I need to look into.

I've just pushed a commit to git fixing the NDEBUG problem. NDEBUG is correctly defined or not now meaning assert is ignored when it should be and also found the cause of the side-effect.

There's a slim possibility it might also fix the problems you're experiencing.
James.

Offline

#5 2012-08-06 13:08:24

masutu
Member
Registered: 2010-01-30
Posts: 40

Re: Package only works if build with makepkg as non-root user

Hi James,

thanks, your last commit did solve the problem. If i'm experiencing other issues, i'll post to [petri-foo-devel], as said before, i wasn't sure where this problem came from. I'll be away for about two weeks from wednesday on, so if you release a >1.86 version the next days it'll take some time since i can upload a new PKGBUILD. Thanks again!

Offline

Board footer

Powered by FluxBB