Bug 11310 - Problem with --root
Summary: Problem with --root
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-05-08 22:25 UTC by mal
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-05-09 15:35:28 UTC
Embargoed:


Attachments (Terms of Use)

Description mal 2000-05-08 22:25:39 UTC
Hi,
I have a simple .spec file
and I am trying to rebuild it with --root
option so package rebuilding can be performed as non-root.

I give the command
rpm -ba --root /tmp/y2/  -ba
/tmp/sc/clienthost.clientdomain.com/cfg/usr/src/redhat/SPECS/printerconfig.clienthost.clientdomain.com.spec

and it looks like RPM appends /tmp/y2/ directory TWICE
whet it trying to read the files created during installation.
I get

[mal@eth0_external y2]$ rpm -ba --root /tmp/y2/  -ba
/tmp/sc/clienthost.clientdomain.com/cfg/usr/src/redhat/SPECS/printerconfig.clienthost.clientdomain.com.spec
Executing(%prep): /bin/sh -e /tmp/y2/var/tmp/rpm-tmp.25065
+ umask 022
+ cd /usr/src/redhat/BUILD
+ exit 0
Executing(%build): /bin/sh -e /tmp/y2/var/tmp/rpm-tmp.25065
+ umask 022
+ cd /usr/src/redhat/BUILD
+ exit 0
Executing(%install): /bin/sh -e /tmp/y2/var/tmp/rpm-tmp.25065
+ umask 022
+ cd /usr/src/redhat/BUILD
+ umask 022
+ rm -rf
/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot
+ mkdir -p
/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/var/spool/lpd
/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/etc
+ mkdir
/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/var/spool/lpd/lp
+ cd /tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot
+ /bin/cat
+ /bin/cat
+ /bin/cat
+ /bin/cat
+ exit 0
Processing files: printerconfig.clienthost.clientdomain.com-1.0-2
File not found:
/tmp/y2/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/etc/printcap
File not found:
/tmp/y2/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/var/spool/lpd/lp/general.cfg
File not found:
/tmp/y2/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/var/spool/lpd/lp/textonly.cfg
File not found:
/tmp/y2/tmp/y2/var/tmp/printerconfig.clienthost.clientdomain.com-buildroot/var/spool/lpd/lp/postscript.cfg
PreReq: /bin/sh
Requires: lpd >= 0.5 printtool rhs-printfilters
[mal@eth0_external y2]$

See, the directory /tmp/y2/tmp/y2/ is appended TWICE.

The spec file is:

Summary: Printer configuration for clienthost.clientdomain.com.
Name: printerconfig.clienthost.clientdomain.com
Version: 1.0
Release: 2
Copyright: GPL
Group: System Environment/Daemons
Requires: lpd >= 0.5
Requires: printtool
Requires: rhs-printfilters
BuildRoot: /var/tmp/%{name}-buildroot
BuildArchitectures: noarch

%description
This package is a set of configuration files for
clienthost.clientdomain.com
printer subsystem.

%prep

%build

%install
umask 022
rm -rf "${RPM_BUILD_ROOT}"
mkdir -p "${RPM_BUILD_ROOT}"/var/spool/lpd "${RPM_BUILD_ROOT}"/etc

mkdir "${RPM_BUILD_ROOT}"/var/spool/lpd/lp

cd "${RPM_BUILD_ROOT}"

/bin/cat >.//etc/printcap<<"EOF_.//etc/printcap._S_15_cfg"

##PRINTTOOL3## LOCAL ljet4 600x600 letter {} LaserJet4 Default {}
lp:\
        :sd=/var/spool/lpd/lp:\
        :mx#0:\
        :sh:\
        :lp=/dev/lp0:\
        :if=/var/spool/lpd/lp/filter:
EOF_.//etc/printcap._S_15_cfg
/bin/cat
>.//var/spool/lpd/lp/general.cfg<<"EOF_.//var/spool/lpd/lp/general.cfg._S_16_cfg"
#
export DESIRED_TO=ps
export PAPERSIZE=letter
export PRINTER_TYPE=LOCAL
export ASCII_TO_PS=YES
EOF_.//var/spool/lpd/lp/general.cfg._S_16_cfg
/bin/cat
>.//var/spool/lpd/lp/textonly.cfg<<"EOF_.//var/spool/lpd/lp/textonly.cfg._S_17_cfg"
#
TEXTONLYOPTIONS=
CRLFTRANS=
TEXT_SEND_EOF=NO
EOF_.//var/spool/lpd/lp/textonly.cfg._S_17_cfg
/bin/cat
>.//var/spool/lpd/lp/postscript.cfg<<"EOF_.//var/spool/lpd/lp/postscript.cfg._S_18_cfg"
#
GSDEVICE=ljet4
RESOLUTION=600x600
COLOR=
PAPERSIZE=letter
EXTRA_GS_OPTIONS=""
REVERSE_ORDER=
PS_SEND_EOF=NO

#
# following is related to printing multiple pages per output page
#
NUP=1
RTLFTMAR=18
TOPBOTMAR=18
EOF_.//var/spool/lpd/lp/postscript.cfg._S_18_cfg


%clean
rm -rf "${RPM_BUILD_ROOT}"

%post

chkconfig --level 1 lpd off
chkconfig --level 2 lpd off
chkconfig --level 3 lpd on
chkconfig --level 4 lpd off
chkconfig --level 5 lpd on


%postun

chkconfig --level 1 lpd off
chkconfig --level 2 lpd off
chkconfig --level 3 lpd off
chkconfig --level 4 lpd off
chkconfig --level 5 lpd off


%files
%defattr(0644,root,root)

%config /etc/printcap
%config /var/spool/lpd/lp/general.cfg
%config /var/spool/lpd/lp/textonly.cfg
%config /var/spool/lpd/lp/postscript.cfg

%changelog
* Mon May 08 2000 Autogenerated on: Mon May 08 14:08:01 EDT 2000
- spec file automatically created from a template
- version: $Id: printer_process.jspinclude,v 1.7 2000/05/08 16:50:36 mal
Exp $

* Mon May 08 2000 Vladislav Malyshkin (mal)
- intial revision

Comment 1 Jeff Johnson 2000-05-09 15:35:59 UTC
The option --root does not permit "building by non-root", but rather
attempts to do a chroot(2) during a build, and concatenates strings
to build paths to files to create before doing the chroot(2).

Comment 2 mal 2000-05-09 16:59:59 UTC
>The option --root does not permit "building by non-root", but rather
>ttempts to do a chroot(2) during a build, and concatenates strings
>to build paths to files to create before doing the chroot(2).

But it also does not work what I build RPM as root.
There is a bug with double concatenation of string,
specifically with DOUBLE CONTENCATION to of variable set in --root option
when scanning for the files to be included to RPM.

Comment 3 mal 2000-05-09 19:07:59 UTC
I dig it more.
This is more information:

When processing rpm in gdb I see

build/file.c: around line 1270
    /* XXX spec->buildRootURL == NULL, then xstrdup("") is returned */
    fl.buildRootURL = rpmGenPath(spec->rootURL, spec->buildRootURL, NULL);

(gdb) print  fl.buildRootURL
$6 = 0x813ae48
"/tmp/y2/tmp/y2/var/tmp/backupconfig.clienthost.clientdomain.com-buildroot"
(gdb) print   spec->rootURL
$7 = 0x8138230 "/tmp/y2"
(gdb) print   spec->buildRootURL
$8 = 0x8141780
"/tmp/y2/var/tmp/backupconfig.clienthost.clientdomain.com-buildroot"

So the --root /tmp/y2/ variable as prefix was already added to path
when creating spec object
and then, it was added again in build/file.c: around line 1270
So I think one of them is definitiely  wrong.
It should be addedd only once.


Note You need to log in before you can comment on or make changes to this bug.