Permissions

I want to create simple package, that will install one executable file into /usr/games

Compilation goes well (You can see in log, that compilation exits with status 0).
Problem is in installation, but I don’t know where.

The Makefile:

DESTDIR=
BINDIR=/usr/games

all:
	g++ -s -O2 snake.cpp -o snake `allegro-config --libs --shared` -Wall -Wextra -pedantic

clean:
	rm -f snake

install:
	install -D -m 755 snake "${DESTDIR}${BINDIR}/snake"

uninstall:
	rm ${DESTDIR}${BINDIR}/snake

This is spec file:

Name:          Snake
Summary:       Simple Snake Game
Version:       1.1
Release:       0
Group:         Amusements/Games/Action/Arcade

BuildRequires: gcc-c++
BuildRequires: liballeg4_2
BuildRequires: liballeg-devel

Source:        %{name}-%{version}.tar.bz2
BuildRoot:     %{_tmppath}/%{name}-%{version}-build
License:       GPLv3

%description
This is a simple Snake game. Use arrow keys to control snake and collect as many dots as You can.
After first run, game will create a config file in $HOME/.config/snake.ini with a default values.

%prep
%setup

%build
make

%install
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,games,games)
/usr/games/snake

Here is log:

Using BUILD_ROOT=/abuild/root_5/.mount
Using BUILD_ARCH=i586:i486:i386
Doing xen build in /dev/abuild/5_root


build20 started "build snake.spec" at Mon Jun 22 13:48:37 UTC 2009.

Building snake for project 'home:etamPL' repository 'openSUSE_11.1' arch 'i586' srcmd5 '7bd43df7e56885365028e4a10a727268'

processing specfile /abuild/root_5/.build-srcdir/snake.spec ...
running changelog2spec --target rpm --file /abuild/root_5/.build-srcdir/snake.spec
init_buildsystem --prepare --clean --rpmlist /abuild/root_5/.build.rpmlist /abuild/root_5/.build-srcdir/snake.spec build rpmlint-Factory ...
preinstalling aaa_base...
preinstalling acl...
preinstalling attr...
preinstalling bash...
preinstalling coreutils...
preinstalling diffutils...
preinstalling filesystem...
preinstalling fillup...
preinstalling glibc...
preinstalling grep...
preinstalling insserv...
preinstalling libacl...
preinstalling libattr...
preinstalling libbz2-1...
preinstalling libgcc43...
preinstalling libxcrypt...
preinstalling m4...
preinstalling libncurses5...
preinstalling pam...
preinstalling permissions...
preinstalling popt...
preinstalling libreadline5...
preinstalling rpm...
preinstalling sed...
preinstalling tar...
preinstalling zlib...
preinstalling libselinux1...
preinstalling util-linux...
preinstalling perl-base...
preinstalling libdb-4_5...
preinstalling libvolume_id1...
preinstalling libsepol1...
copying packages...
reordering...done
booting XEN kernel ...
linux64 xm create -c /var/run/bsworker_5/build/xen.conf name=build:5_root memory=750 disk=phy:/dev/abuild/5_root,hda1,w disk=phy:/dev/abuild/5_swap,hda2,w extra=quiet init=/.build/build panic=1 console=ttyS0
Using config file "/var/run/bsworker_5/build/xen.conf".
Started domain build:5_root
PCI: Fatal: No config space access function found
i8042.c: No controller found.
doing fast boot
Creating device nodes with udev
Boot logging started on /dev/xvc0(/dev/console) at Mon Jun 22 13:48:50 2009
Waiting for device /dev/hda1 to appear: ok
fsck 1.41.1 (01-Sep-2008)
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/hda1
/dev/hda1: clean, 2434/1826816 files, 183663/7296000 blocks
fsck succeeded. Mounting root device read-only.
Mounting root /dev/hda1
2nd stage started in virtual machine
machine type: x86_64
switching personality to 134217736...
2nd stage started in virtual machine
machine type: i686
swapon on /dev/hda2
found swap v1 signature string for 4 KiB PAGE_SIZE
mount: none already mounted or //proc busy
logging output to //.build.log...
processing specfile /.build-srcdir/snake.spec ...
init_buildsystem /.build-srcdir/snake.spec build rpmlint-Factory ...
running aaa_base preinstall script
running aaa_base postinstall script
Updating etc/sysconfig/language...
Updating etc/sysconfig/backup...
Updating etc/sysconfig/boot...
Updating etc/sysconfig/kernel...
Updating etc/sysconfig/suseconfig...
Updating etc/sysconfig/clock...
Updating etc/sysconfig/proxy...
Updating etc/sysconfig/windowmanager...
Updating etc/sysconfig/sysctl...
Updating etc/sysconfig/cron...
Updating etc/sysconfig/news...
Updating etc/sysconfig/shutdown...
Updating etc/passwd...unchanged
Updating etc/group...unchanged
Updating etc/shadow...new
initializing rpm db...
installing filesystem-11.1-2.3
installing terminfo-base-5.6-89.10
installing glibc-2.9-2.8
installing audit-libs-1.7.7-5.1
installing fillup-1.42-242.8
installing gdbm-1.8.3-371.8
installing glibc-locale-2.9-2.8
installing libasound2-1.0.18-8.7
installing libattr-2.4.39-67.5
installing libbz2-1-1.0.5-34.5
installing libdb-4_5-4.5.20-94.17
installing libltdl7-2.2.6-1.20
installing libselinux1-2.0.71-3.38
installing libsepol1-2.0.32-5.38
installing libvolume_id1-128-9.3
installing libxcrypt-3.0.1-25.20
installing net-tools-1.60-725.5
installing patch-2.5.9-252.43
installing perl-base-5.10.0-62.10
installing popt-1.7-20.1
installing xorg-x11-libICE-7.4-1.24
installing xorg-x11-libXau-7.4-1.23
installing zlib-1.2.3-104.137
installing libncurses5-5.6-89.10
installing libbz2-devel-1.0.5-34.5
installing attr-2.4.39-67.5
installing file-4.24-43.1
installing libacl-2.2.47-27.5
installing libreadline5-5.2-141.10
installing xorg-x11-libfontenc-7.4-1.23
installing xorg-x11-libxcb-7.4-1.24
installing perl-5.10.0-62.10
installing bash-3.2-141.10
installing acl-2.2.47-27.5
installing brp-check-suse-1.0-14.8.1
installing build-2008.11.28.r5747-1.3
installing insserv-1.12.0-22.15
installing libexpat1-2.0.1-88.10
installing libgcc43-4.3.3_20081022-9.5
installing libgomp43-4.3.3_20081022-9.5
installing libuuid1-1.41.1-11.9
installing libzio-0.9-4.19
installing bzip2-1.0.5-34.5
installing cracklib-2.8.12-55.1
installing less-424b-1.29
installing libstdc++43-4.3.3_20081022-9.5
installing xorg-x11-libSM-7.4-1.26
installing fontconfig-2.6.0-8.1
installing info-4.12-1.85
installing pam-1.0.2-13.3
installing cpio-2.9-75.35
installing diffutils-2.8.7-143.9
installing gawk-3.1.6-1.44
installing grep-2.5.2-90.28
installing gzip-1.3.12-68.36
installing libtool-2.2.6-1.20
installing login-3.37-1.5
installing m4-1.4.12-1.13
installing make-3.81-128.9
installing sed-4.1.5-85.60
installing tar-1.20-23.5
installing binutils-2.19-9.3
installing findutils-4.4.0-38.27
installing gmp-4.2.3-10.3
installing gettext-runtime-0.17-60.5
installing coreutils-6.12-32.10
installing texinfo-4.12-1.85
installing linux-kernel-headers-2.6.27-2.28
post linux-kernel-headers-2.6.27-2.28 /var/tmp/rpm-tmp.36419 1
`usr/include/asm' -> `asm-x86'
installing libmpfr1-2.3.2-3.9
installing autoconf-2.63-1.97
installing sysvinit-2.86-186.7
installing timezone-2008h-2.14
WARNING: Not updating /etc/localtime with new zone file
installing xorg-x11-libX11-7.4-1.25
installing cvs-1.12.12-144.28
installing psmisc-22.6-61.14
installing groff-1.18.1.1-167.3
Updating etc/sysconfig/suseconfig...
installing xorg-x11-libXfixes-7.4-1.24
installing xorg-x11-libXrender-7.4-1.24
installing xorg-x11-libxkbfile-7.4-1.25
installing cpp43-4.3.3_20081022-9.5
installing xorg-x11-libXext-7.4-1.25
installing automake-1.10.1-4.264
installing glibc-devel-2.9-2.8
installing gettext-tools-0.17-60.5
installing xorg-x11-libXt-7.4-1.26
installing man-2.5.2-17.3
Updating etc/sysconfig/cron...
installing aaa_base-11.1-10007.5
Updating etc/sysconfig/language...
Updating etc/sysconfig/backup...
Updating etc/sysconfig/boot...
Updating etc/sysconfig/kernel...
Updating etc/sysconfig/suseconfig...
Updating etc/sysconfig/clock...
Updating etc/sysconfig/proxy...
Updating etc/sysconfig/windowmanager...
Updating etc/sysconfig/sysctl...
Updating etc/sysconfig/cron...
Updating etc/sysconfig/news...
Updating etc/sysconfig/shutdown...
Updating etc/passwd...unchanged
Updating etc/group...unchanged
Updating etc/shadow...unchanged
installing cpp-4.3-34.168
installing libstdc++43-devel-4.3.3_20081022-9.5
installing netcfg-11.1-1.14
warning: /etc/HOSTNAME created as /etc/HOSTNAME.rpmnew
installing xorg-x11-libXv-7.4-1.25
installing xorg-x11-libXp-7.4-1.25
installing gcc43-4.3.3_20081022-9.5
installing xorg-x11-libXmu-7.4-1.26
installing permissions-2008.11.25-1.5
Updating etc/sysconfig/security...
installing xorg-x11-libXpm-7.4-1.27
installing gcc-4.3-34.168
installing gcc43-c++-4.3.3_20081022-9.5
installing post-build-checks-1.0-53.11
installing pam-modules-11.1-5.1
installing xorg-x11-libXprintUtil-7.4-1.26
installing rpm-4.4.2.3-20.1
Updating etc/sysconfig/services...
installing util-linux-2.14.1-10.1
installing gcc-c++-4.3-34.168
installing rpmlint-mini-1.0-213.38
installing xorg-x11-libs-7.4-8.1
installing rpmlint-Factory-1.0-44.9
installing liballeg4_2-4.2.2-10.1
installing liballeg-devel-4.2.2-10.1
removing nis flags from //etc/nsswitch.conf...
now finalizing build dir...
Starting SuSEconfig, the SuSE Configuration Tool...
Running in full featured mode.
Reading /etc/sysconfig and updating the system...
Executing /sbin/conf.d/SuSEconfig.groff...
Executing /sbin/conf.d/SuSEconfig.permissions...
Finished.
-----------------------------------------------------------------
I have the following modifications for snake.spec:
19c19
< Release: 0
---
> Release: 30.1
-----------------------------------------------------------------
----- building snake.spec (user abuild)
-----------------------------------------------------------------
-----------------------------------------------------------------
+ exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --define 'disturl obs://build.opensuse.org/home:etamPL/openSUSE_11.1/7bd43df7e56885365028e4a10a727268-snake' /usr/src/packages/SOURCES/snake.spec
error: cannot open Pubkeys index using db3 - No such file or directory (2)
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.65667
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd /usr/src/packages/BUILD
+ rm -rf Snake-1.1
+ /usr/bin/bzip2 -dc /usr/src/packages/SOURCES/Snake-1.1.tar.bz2
+ tar -xvvf -
drwxr-xr-x etam/users 0 2009-06-22 13:10 Snake-1.1/
-rw-r--r-- etam/users 247 2009-06-22 13:10 Snake-1.1/Makefile
-rw-r--r-- etam/users 8735 2009-06-20 18:02 Snake-1.1/snake.cpp
+ STATUS=0
+ '' 0 -ne 0 ']'
+ cd Snake-1.1
++ /usr/bin/id -u
+ '' 399 = 0 ']'
++ /usr/bin/id -u
+ '' 399 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.65667
+ umask 022
+ cd /usr/src/packages/BUILD
+ /bin/rm -rf /var/tmp/Snake-1.1-build
++ dirname /var/tmp/Snake-1.1-build
+ /bin/mkdir -p /var/tmp
+ /bin/mkdir /var/tmp/Snake-1.1-build
+ cd Snake-1.1
+ make
g++ -s -O2 snake.cpp -o snake `allegro-config --libs --shared` -Wall -Wextra -pedantic
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32072
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd Snake-1.1
+ rm -rf /var/tmp/Snake-1.1-build
+ make DESTDIR=/var/tmp/Snake-1.1-build install
install -D -m 755 snake "/var/tmp/Snake-1.1-build/usr/games/snake"
+ RPM_BUILD_ROOT=/var/tmp/Snake-1.1-build
+ export RPM_BUILD_ROOT
+ test -x /usr/sbin/Check -a 399 = 0 -o -x /usr/sbin/Check -a '!' -z /var/tmp/Snake-1.1-build
+ echo 'I call /usr/sbin/Check...'
I call /usr/sbin/Check...
+ /usr/sbin/Check
Checking permissions and ownerships - using the permissions files
/tmp/Check.perms.DA7NqX
setting /var/tmp/Snake-1.1-build/ to root:root 0755. (wrong owner/group abuild:abuild)
setting /var/tmp/Snake-1.1-build/usr to root:root 0755. (wrong owner/group abuild:abuild)
setting /var/tmp/Snake-1.1-build/usr/games/snake to games:games 0755. (wrong owner/group abuild:abuild)
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip-debug
+ /usr/lib/rpm/brp-check-la
+ /usr/lib/rpm/brp-symlink
+ /usr/lib/rpm/brp-desktop
WARNING: '/usr/lib/rpm/brp-desktop.data/suse-screensavers.menu' does not exist
WARNING: '/usr/lib/rpm/brp-desktop.data/preferences-gnome.menu' does not exist
WARNING: '/usr/lib/rpm/brp-desktop.data/applications-kmenuedit.menu' does not exist
+ /usr/lib/rpm/brp-rpath
+ /usr/lib/rpm/brp-pie
+ /usr/lib/rpm/brp-rootfs
+ /usr/lib/rpm/brp-tcl
+ /usr/lib/rpm/brp-check-python
+ /usr/lib/rpm/brp-check-bytecode-version
+ /usr/lib/rpm/brp-boot-scripts
+ /usr/lib/rpm/brp-hook
Processing files: Snake-1.1-30.1
Finding Provides: /usr/lib/rpm/find-provides Snake
Finding Requires: /usr/lib/rpm/find-requires Snake
Finding Supplements: /usr/lib/rpm/find-supplements Snake
Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Requires: liballeg.so.4.2 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.1.3) libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libm.so.6 libstdc++.so.6 libstdc++.so.6(CXXABI_1.3) libstdc++.so.6(GLIBCXX_3.4)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/Snake-1.1-build
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/Snake-1.1-build
Wrote: /usr/src/packages/SRPMS/Snake-1.1-30.1.src.rpm
Wrote: /usr/src/packages/RPMS/i586/Snake-1.1-30.1.i586.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.34110
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd Snake-1.1
+ rm -rf /var/tmp/Snake-1.1-build
+ exit 0
... checking for files with abuild user/group
... running 00-check-install-rpms
... installing all built rpms
Preparing packages for installation...
Snake-1.1-30.1
... running 01-check-debuginfo
... testing for empty debuginfo packages
... running 02-check-gcc-output
... testing for serious compiler warnings
(using /usr/lib/build/checks-data/check_gcc_output)
(using //.build.log)
... running 03-check-binary-kernel-log
... running 04-check-filelist
... checking filelist
... running 05-check-invalid-requires
... running 06-check-installtest
... testing for pre/postinstall scripts that are not idempotent
... running 08-check-permissions
... testing for modified permissions
--------------------------------------------------------------------
package: Snake
SuSEconfig.permissions modified files that are not properly handled!
this will break rpm -V, ask ro for details.
diff for both runs of rpm -V:
+.M...... /usr/games/snake
--------------------------------------------------------------------
System halted.

Make installs snake to proper location, then Check sets proper owner:group (root:root for directories, games:games for binary), so what’s wrong?

Hi
Since it’s just one file, install it to /usr/bin? Else change to the
path as required.


%files
%defattr (0755, games, games)
%verify(not mode) %{_bindir}/snake


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.23-0.1-default
up 12:59, 2 users, load average: 0.09, 0.17, 0.08
GPU GeForce 8600 GTS Silent - Driver Version: 185.18.14

Ok. I don’t know why the /usr/games/snake after install had permissions 2755. So in Makefile I changed 755 to 0755 (in install line) and now it works fine :smiley:

Hi
Glad you have it sorted :slight_smile:


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.23-0.1-default
up 3 days 8:36, 2 users, load average: 0.01, 0.01, 0.00
GPU GeForce 8600 GTS Silent - Driver Version: 185.18.14

It worked, bot not anymore.
I don’t understand this. Something in OBS must be changing this permissions and then complaining that they are wrong.

In makefile it’s strictly written:

install -D -m 0755 snake "${DESTDIR}${BINDIR}/snake"

So why something changes it to 2755???

Is there something wrong with my sources, or is it a bug in OBS?

Hi
Set it in the %files section then…


%attr(0755,root,root) %{_bindir}/snake


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.25-0.1-default
up 6 days 3:20, 2 users, load average: 0.05, 0.08, 0.03
GPU GeForce 8600 GTS Silent - Driver Version: 190.18

I give up. :frowning:
I moved it to /usr/bin/snake and set it to 0755,root,root.

I don’t want to fight it anymore.

LOL :slight_smile: Maybe have a look at the /etc/permissions file…


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.25-0.1-default
up 7 days 1:01, 2 users, load average: 0.19, 0.11, 0.09
GPU GeForce 8600 GTS Silent - Driver Version: 190.18

Awww… Everything is clear now. :slight_smile:

Maybe my binary should have a more original name than a simple “snake”?