Glib2 0.90.2 gem

Hi,

When installing the glib2 0.90.2 gem on our staging server with bundler,
we get an error preventing installation.

Bundler is running as a regular user (not root) so it appears to be a
permissions issue. The target system is 64bit Linux.

Here’s the error:

** [out :: staging] make install
** [out :: staging] /usr/bin/install -c -m 0755 glib2.so
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbglib.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgutil.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgobject.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgcompat.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 glib-enum-types.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] mkdir -p /usr/lib/pkgconfig
** [out :: staging] /usr/bin/install -c -m 644 ruby-glib2.pc
/usr/lib/pkgconfig
** [out :: staging] /usr/bin/install: cannot remove
`/usr/lib/pkgconfig/ruby-glib2.pc’: Permission denied
** [out :: staging] make: *** [install] Error 1

cheers

– James H. [email protected] Wed, 29 Sep 2010 20:49:11 +1000

yes, you either need to run bundler as root, or compile manually (with a
–prefix)

niklas | brueckenschlaeger wrote:

yes, you either need to run bundler as root, or compile manually (with a
–prefix)

Is it normal for gems to install files to system paths? I was under the
impression that as a general rule, gems keep all their files in one
place.

Installing gems as root makes me nervous - it would be trivial for a
malicious person to release a nasty gem that harms my system. Is it
possible for the glib2 gem to be modified to not require root?

cheers

– James H. [email protected] Thu, 30 Sep 2010 10:16:53 +1000

Hi,

In [email protected]
“[ruby-gnome2-devel-en] glib2 0.90.2 gem” on Wed, 29 Sep 2010 20:49:44
+1000,
James H. [email protected] wrote:

** [out :: staging] /usr/bin/install -c -m 644 ./rbglib.h /srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgutil.h /srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgobject.h /srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 ./rbgcompat.h /srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] /usr/bin/install -c -m 644 glib-enum-types.h /srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
** [out :: staging] mkdir -p /usr/lib/pkgconfig
** [out :: staging] /usr/bin/install -c -m 644 ruby-glib2.pc /usr/lib/pkgconfig
** [out :: staging] /usr/bin/install: cannot remove `/usr/lib/pkgconfig/ruby-glib2.pc’: Permission denied
** [out :: staging] make: *** [install] Error 1

We want to fix this but there are no idea to solve it.
Please give us more time or good idea.

Thanks,

kou

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] glib2 0.90.2 gem” on Sun, 03 Oct 2010
22:11:39 +0900 (JST),
Kouhei S. [email protected] wrote:

** [out :: staging] /usr/bin/install -c -m 644 ./rbglib.h
/srv/rails/app/shared/bundle/ruby/1.8/gems/glib2-0.90.2/lib
Please give us more time or good idea.
I fixed this by not installing *.pc by default.
pkgconfigdir make variable is needed to install *.pc like
“make pkgconfigdir=/usr/lib/pkgconfig install”.

Thanks,

kou

In general you are right. Rubygems should not require root privileges to
be installed. But in this case the gem (or the original ruby-gnome build
system) tries to install pkgconfig files in /usr/lib/pkgconfig. These
are required for other libraries (e.g. ruby bindings for libraries built
upon glib) to link against ruby-glib.
But actually, looking at your trace again, it seems as glib2 at the
point it fails glib2 has already been installed, so just try to load it.
Either way, you should make sure that your gems do not harm your system
and don’t do nasty things you do not want, regardless whether you’re
installing them as root or not.

– niklas