RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Elan Ruusamäe
  Root:   /v/rpm/cvs                       Email:  g...@rpm5.org
  Module: rpm                              Date:   17-Oct-2009 13:27:03
  Branch: rpm-4_5                          Handle: 2009101711270201

  Modified files:           (Branch: rpm-4_5)
    rpm                     CHANGES
    rpm/rpmio               rpmrpc.c

  Log:
    - strip possible chroot prefix from db opened paths in Open(2) wrapper. 
LP#347749
      chroot problems gone for good! yay~
    PR: LP#347749

  Summary:
    Revision    Changes     Path
    1.1360.2.129+1  -0      rpm/CHANGES
    2.49.2.7    +12 -1      rpm/rpmio/rpmrpc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1360.2.128 -r1.1360.2.129 CHANGES
  --- rpm/CHANGES       7 Jun 2009 14:29:49 -0000       1.1360.2.128
  +++ rpm/CHANGES       17 Oct 2009 11:27:02 -0000      1.1360.2.129
  @@ -1,4 +1,5 @@
   4.4.9 -> 4.5:
  +     - jbj/glen: strip possible chroot prefix from db opened paths in 
Open(2) wrapper. LP#347749
        - jbj: reserve ~1K in  RPMSIGTAG_PADDING for now.
        - jbj: add RPMSIGTAG_PADDING to force metadata header alignment in file.
        - jbj: ensure that PLD setup & FHS packages install correctly.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.49.2.6 -r2.49.2.7 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c        4 Jun 2009 23:09:36 -0000       2.49.2.6
  +++ rpm/rpmio/rpmrpc.c        17 Oct 2009 11:27:03 -0000      2.49.2.7
  @@ -164,6 +164,7 @@
   {
       const char * lpath;
       int ut = urlPath(path, &lpath);
  +    int fdno;
   
   if (_rpmio_debug)
   fprintf(stderr, "*** Chroot(%s)\n", path);
  @@ -230,7 +231,17 @@
       if (mode == 0)
        mode = 0644;
   #endif
  -    return open(path, flags, mode);
  +    fdno = open(path, flags, mode);
  +    /* XXX if the open(2) fails, try to strip a possible chroot(2) prefix. */
  +    if (fdno < 0 && errno == ENOENT) {
  +        const char *dbpath = rpmExpand("%{_dbpath}", "/", NULL);
  +        const char *fn = strstr(path + 1, dbpath);
  +        if (fn)
  +            fdno = open(fn, flags, mode);
  +        if (dbpath)
  +              dbpath = _free(dbpath);
  +    }
  +    return fdno;
   }
   
   /* XXX rpmdb.c: analogue to rename(2). */
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to