RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ psm.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Wed 13 Aug 2008 - 18:42:20 CEST
Message-Id: <20080813164220.91E7369A20@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   13-Aug-2008 18:42:20
  Branch: HEAD                             Handle: 2008081316421901

  Modified files:
    rpm                     CHANGES
    rpm/lib                 psm.c

  Log:
    - jbj: lua: don't exit chroot if already within running script.

  Summary:
    Revision    Changes     Path
    1.2514      +1  -0      rpm/CHANGES
    2.308       +5  -2      rpm/lib/psm.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2513 -r1.2514 CHANGES
  --- rpm/CHANGES	6 Aug 2008 06:20:20 -0000	1.2513
  +++ rpm/CHANGES	13 Aug 2008 16:42:19 -0000	1.2514
  @@ -1,5 +1,6 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: lua: don't exit chroot if already within running script.
       - at: gzdio: fixed and re-enabled rsyncable_gzwrite()
       - jbj: rpmku: create opaque keyutils keyring.
       - jbj: keyutils: permit configurable keyring.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.307 -r2.308 psm.c
  --- rpm/lib/psm.c	2 Aug 2008 17:56:46 -0000	2.307
  +++ rpm/lib/psm.c	13 Aug 2008 16:42:20 -0000	2.308
  @@ -494,6 +494,7 @@
       rpmlua lua = NULL; /* Global state. */
       rpmluav var;
       int * ssp = NULL;
  +    int inChroot = 0; /* Are we already in a chroot? */
   
       if (psm->sstates != NULL)
   	ssp = psm->sstates + tag2slx(psm->scriptTag);
  @@ -511,6 +512,7 @@
   
       /* Get into the chroot. */
       if (!rpmtsChrootDone(ts)) {
  +       inChroot = 0;
   	const char *rootDir = rpmtsRootDir(ts);
   	/*@-modobserver @*/
   	if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') {
  @@ -518,7 +520,8 @@
   	/*@=modobserver @*/
   	    xx = rpmtsSetChrootDone(ts, 1);
   	}
  -    }
  +    } else
  +       inChroot = 1;
   
       /* All lua scripts run with CWD == "/". */
       xx = Chdir("/");
  @@ -568,7 +571,7 @@
       rpmluaDelVar(lua, "arg");
   
       /* Get out of chroot. */
  -    if (rpmtsChrootDone(ts)) {
  +    if (rpmtsChrootDone(ts) && !inChroot) {
   	const char *rootDir = rpmtsRootDir(ts);
   	xx = fchdir(rootFdno);
   	/*@-modobserver@*/
  @@ .
Received on Wed Aug 13 18:42:20 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.