Re: poldek -r broken again?

2010-05-08 Thread Przemyslaw Iskra
On Sun, May 02, 2010 at 03:23:32PM -0400, Jeff Johnson wrote:
 
 Send along a patch if you want a fix. The code is in lib/psm.c,
 and the patch is likely less than 5 lines (which is 2 orders of magnitude
 fewer lines than have already been written about Glen's %pretrans script)

That should do it for rpm 5:

http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/~checkout~/packages/rpm/rpm-lua-exit-chroot-correctly.patch

I didn't test it, but very similar change in rpm 4.5 fixed the problem.


-- 
   Sparky{PI] -- Przemyslaw _  ___  _  _  ... LANG...Pl..Ca..Es..En
/) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWWppcrcd.pld-linux.org
\\| -_)'___| ||^'||//\\//|  _/| |  | : JID..sparkyatjabberes.org
(/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mailsparkyatpld-linux.org
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


poldek -r broken again?

2010-05-02 Thread Paweł Zuzelski
or I'm missing something?

mkdir /th
poldek --update --upa
rpm --initdb -r /th
poldek -r /th
poldek install geninitrd
(...)
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/ldconfig-2.11.1-5.i686.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/filesystem-3.0-34.i686.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/busybox-initrd-1.15.3-4.i686.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.noarch.RPMS/rpm-whiteout-1.33-1.noarch.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.noarch.RPMS/ca-certificates-20090814-6.noarch.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/glibc-2.11.1-5.i686.rpm
 failed: No such file or directory
error: open of 
/root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/pdksh-5.2.14-56.i686.rpm
 failed: No such file or directory
(... a lot of similar errors)

BUT
poldek install FHS
works.

-- 
Paweł
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: poldek -r broken again?

2010-05-02 Thread Jacek Konieczny
On Sun, May 02, 2010 at 05:38:14PM +0200, Paweł Zuzelski wrote:
 or I'm missing something?
 
 mkdir /th
 poldek --update --upa
 rpm --initdb -r /th

cd /

 poldek -r /th
 poldek install geninitrd

Greets,
Jacek
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: poldek -r broken again?

2010-05-02 Thread Przemyslaw Iskra
On Sun, May 02, 2010 at 05:38:14PM +0200, Paweł Zuzelski wrote:
 or I'm missing something?
 
 mkdir /th
 poldek --update --upa
 rpm --initdb -r /th
 poldek -r /th
 poldek install geninitrd
 (...)
 error: open of 
 /root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/ldconfig-2.11.1-5.i686.rpm
  failed: No such file or directory
 error: open of 
 /root/tmp/poldek-cache-root/http_ftp.sk.pld-linux.org.dists.th.PLD.i686.RPMS/filesystem-3.0-34.i686.rpm
  failed: No such file or directory
^^^
This part exactly:

%if %{pld_release} != ac
%pretrans -p lua
-- this needs to be a dir
if posix.stat(/usr/include/X11, type) == link then
-- feel free to write in pure lua, but success on first install is not 
important.
os.execute(umask 022; mv -f /usr/include/X11{,.rpmsave}; mkdir -m755 
-p /usr/include/X11  mv -f /usr/include/X11.rpmsave/*
/usr/include/X11)
end
%endif

Makes rpm lose track of current root directory. That is, it is unnable
to exit the chroot correctly before continuing instalation.

-- 
   Sparky{PI] -- Przemyslaw _  ___  _  _  ... LANG...Pl..Ca..Es..En
/) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWWppcrcd.pld-linux.org
\\| -_)'___| ||^'||//\\//|  _/| |  | : JID..sparkyatjabberes.org
(/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mailsparkyatpld-linux.org
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: poldek -r broken again?

2010-05-02 Thread Jacek Konieczny
On Sun, May 02, 2010 at 08:11:39PM +0200, Przemyslaw Iskra wrote:
 %if %{pld_release} != ac
 %pretrans -p lua
 -- this needs to be a dir
 if posix.stat(/usr/include/X11, type) == link then
   -- feel free to write in pure lua, but success on first install is not 
 important.
   os.execute(umask 022; mv -f /usr/include/X11{,.rpmsave}; mkdir -m755 
 -p /usr/include/X11  mv -f /usr/include/X11.rpmsave/*
 /usr/include/X11)
 end
 %endif
 
 Makes rpm lose track of current root directory. That is, it is unnable
 to exit the chroot correctly before continuing instalation.

Oh, my investigation didn't go that far.  Anyway, starting poldek/rpm
with $PWD == '/' ('cd /' before running poldek) seems to be a working 
workaround.

Greets,
Jacek
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: poldek -r broken again?

2010-05-02 Thread Przemyslaw Iskra
On Sun, May 02, 2010 at 02:57:39PM -0400, Jeff Johnson wrote:
 
  chroot(.) = 0
   -- chroots back to /tmp !
  This way /tmp becomes new root.
  
 
 ... which re-establishes the cwd before embedded lua was run.

It also establishes /tmp as new /, so now when you use path:
/tmp/rpm/something it points to /tmp/tmp/rpm/something in real root.


Please, google for breaking out of chroot, some of those tutorials
are nicely explained.

 My guess is that you want a deterministic chdir(/) when running
 opaque embedded lua scripts. You certainly can do chdir(/) within
 the lua script if you wish.
 
 The disagreement seems largely to be what you expect RPM to do vs. what
 should be done in embedded scriptlets. And there's truly so few embedded
 scripts in *.rpm that noone (certainly not me) has ever tried
 to pin down the execution environment precisely.

I have no idea why it doesn't work in this case, but works in all
others. Are %post and %pre scripts run as separate processes ?

  To exit chroot it should fchdir to old /, chroot there, and
  fchdir to old working directory.
  
 
 And your old working directory is (in fact) /tmp which was restored by 
 fchdir(2).

/tmp also becomes new /, which brakes full paths (ones starting with /).


-- 
   Sparky{PI] -- Przemyslaw _  ___  _  _  ... LANG...Pl..Ca..Es..En
/) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWWppcrcd.pld-linux.org
\\| -_)'___| ||^'||//\\//|  _/| |  | : JID..sparkyatjabberes.org
(/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mailsparkyatpld-linux.org
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: poldek -r broken again?

2010-05-02 Thread Jeff Johnson

On May 2, 2010, at 3:14 PM, Przemyslaw Iskra wrote:

 On Sun, May 02, 2010 at 02:57:39PM -0400, Jeff Johnson wrote:
 
 chroot(.) = 0
 -- chroots back to /tmp !
This way /tmp becomes new root.
 
 
 ... which re-establishes the cwd before embedded lua was run.
 
 It also establishes /tmp as new /, so now when you use path:
 /tmp/rpm/something it points to /tmp/tmp/rpm/something in real root.
 

Send along a patch if you want a fix. The code is in lib/psm.c,
and the patch is likely less than 5 lines (which is 2 orders of magnitude
fewer lines than have already been written about Glen's %pretrans script)

73 de Jeff

___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en