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

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   22-Jun-2008 21:28:55
  Branch: rpm-4_5                          Handle: 2008062219285202

  Modified files:           (Branch: rpm-4_5)
    rpm                     CHANGES
    rpm/lib                 package.c
    rpm/rpmio               librpmio.vers rpmdav.c rpmio.h rpmrpc.c
    rpm/tools               rpmmtree.c rpmrepo.c

  Log:
    - fix: python ts.hdrFromFdno(fdno) segfault.
    - use Realpath(3) so that RPMTAG_PACKAGEORIGIN has absolute path.
    - rpmio: add Realpath(3).

  Summary:
    Revision    Changes     Path
    1.1360.2.113+3  -0      rpm/CHANGES
    2.134.2.5   +1  -1      rpm/lib/package.c
    2.2.2.5     +2  -0      rpm/rpmio/librpmio.vers
    2.32.2.6    +7  -0      rpm/rpmio/rpmdav.c
    1.51.2.5    +7  -0      rpm/rpmio/rpmio.h
    2.49.2.4    +91 -0      rpm/rpmio/rpmrpc.c
    2.1.6.4     +2  -2      rpm/tools/rpmmtree.c
    1.1.2.10    +0  -1      rpm/tools/rpmrepo.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1360.2.112 -r1.1360.2.113 CHANGES
  --- rpm/CHANGES       22 Jun 2008 18:12:24 -0000      1.1360.2.112
  +++ rpm/CHANGES       22 Jun 2008 19:28:52 -0000      1.1360.2.113
  @@ -1,4 +1,7 @@
   4.4.9 -> 4.5:
  +     - jbj: fix: python ts.hdrFromFdno(fdno) segfault.
  +     - jbj: use Realpath(3) so that RPMTAG_PACKAGEORIGIN has absolute path.
  +     - jbj: rpmio: add Realpath(3).
        - robert: python: backport rpm.archscore() and rpm.platformscore()
            for smart depsolving usage
        - robert: rpmrepo: enable/disable sqlite dependent on rest of rpm
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/package.c
  ============================================================================
  $ cvs diff -u -r2.134.2.4 -r2.134.2.5 package.c
  --- rpm/lib/package.c 27 May 2008 15:52:56 -0000      2.134.2.4
  +++ rpm/lib/package.c 22 Jun 2008 19:28:52 -0000      2.134.2.5
  @@ -959,7 +959,7 @@
        int ut = urlPath(origin, &lpath);
        ut = ut;        /* XXX keep gcc quiet. */
        if (lpath && *lpath != '/') {
  -         char * rpath = realpath(origin, NULL);
  +         char * rpath = Realpath(origin, NULL);
            (void) headerSetOrigin(h, rpath);
            rpath = _free(rpath);
        } else
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.2.2.4 -r2.2.2.5 librpmio.vers
  --- rpm/rpmio/librpmio.vers   5 Jun 2008 20:00:19 -0000       2.2.2.4
  +++ rpm/rpmio/librpmio.vers   22 Jun 2008 19:28:53 -0000      2.2.2.5
  @@ -39,6 +39,7 @@
       davOpendir;
       davRead;
       davReaddir;
  +    davRealpath;
       davRename;
       davReq;
       davResp;
  @@ -142,6 +143,7 @@
       prpsoffsets64;
       Readdir;
       Readlink;
  +    Realpath;
       Rename;
       _RequestPass;
       Rmdir;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdav.c
  ============================================================================
  $ cvs diff -u -r2.32.2.5 -r2.32.2.6 rpmdav.c
  --- rpm/rpmio/rpmdav.c        10 Jun 2008 08:27:45 -0000      2.32.2.5
  +++ rpm/rpmio/rpmdav.c        22 Jun 2008 19:28:53 -0000      2.32.2.6
  @@ -1829,3 +1829,10 @@
   /[EMAIL PROTECTED]@*/
   }
   /[EMAIL PROTECTED]@*/
  +
  +char * davRealpath(const char * path, char * resolved_path)
  +{
  +assert(resolved_path == NULL);        /* XXX no POSIXly broken realpath(3) 
here. */
  +    /* XXX TODO: handle redirects. For now, just dupe the path. */
  +    return xstrdup(path);
  +}
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.51.2.4 -r1.51.2.5 rpmio.h
  --- rpm/rpmio/rpmio.h 31 May 2008 18:59:06 -0000      1.51.2.4
  +++ rpm/rpmio/rpmio.h 22 Jun 2008 19:28:53 -0000      1.51.2.5
  @@ -409,6 +409,13 @@
        /[EMAIL PROTECTED] *dir, errno, fileSystem @*/;
   
   /**
  + * realpath(3) clone.
  + */
  +char * Realpath(const char * path, /[EMAIL PROTECTED]@*/ /[EMAIL 
PROTECTED]@*/ char * resolved_path)
  +     /[EMAIL PROTECTED] errno, fileSystem, internalState @*/
  +     /[EMAIL PROTECTED] *resolved_path, errno, fileSystem, internalState @*/;
  +
  +/**
    * lseek(2) clone.
    * @todo Implement SEEK_HOLE/SEEK_DATA.
    */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.49.2.3 -r2.49.2.4 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c        31 May 2008 18:59:06 -0000      2.49.2.3
  +++ rpm/rpmio/rpmrpc.c        22 Jun 2008 19:28:53 -0000      2.49.2.4
  @@ -1286,6 +1286,15 @@
   }
   /[EMAIL PROTECTED]@*/
   
  +
  +static char * ftpRealpath(const char * path, /[EMAIL PROTECTED]@*/ char * 
resolved_path)
  +     /[EMAIL PROTECTED]/
  +{
  +assert(resolved_path == NULL);       /* XXX no POSIXly broken realpath(3) 
here. */
  +    /* XXX TODO: handle redirects. For now, just dupe the path. */
  +    return xstrdup(path);
  +}
  +
   int Stat(const char * path, struct stat * st)
   {
       const char * lpath;
  @@ -1776,6 +1785,88 @@
       return closedir(dir);
   }
   
  +char * Realpath(const char * path, /[EMAIL PROTECTED]@*/ char * 
resolved_path)
  +{
  +    const char * lpath;
  +    int ut = urlPath(path, &lpath);
  +    char * rpath;
  +
  +if (_rpmio_debug)
  +fprintf(stderr, "*** Realpath(%s, %s)\n", path, (resolved_path ? 
resolved_path : "NULL"));
  +/[EMAIL PROTECTED]@*/
  +    /* XXX if POSIXly broken realpath(3) is desired, do that. */
  +    /* XXX note: preserves current rpmlib realpath(3) usage cases. */
  +    if (path == NULL || resolved_path != NULL)
  +     return realpath(path, resolved_path);
  +/[EMAIL PROTECTED]@*/
  +
  +    switch (ut) {
  +    case URL_IS_FTP:
  +     return ftpRealpath(path, resolved_path);
  +     /[EMAIL PROTECTED]@*/ break;
  +    case URL_IS_HTTPS:       
  +    case URL_IS_HTTP:
  +    case URL_IS_HKP:
  +#ifdef WITH_NEON
  +     return davRealpath(path, resolved_path);
  +     /[EMAIL PROTECTED]@*/ break;
  +#endif
  +     /[EMAIL PROTECTED]@*/
  +    default:
  +     return xstrdup(path);
  +     /[EMAIL PROTECTED]@*/ break;
  +    case URL_IS_DASH:
  +     /* non-GLIBC systems => EINVAL. non-linux systems => EINVAL */
  +#if defined(__linux__)
  +     lpath = "/dev/stdin";
  +#else
  +     lpath = NULL;
  +#endif
  +     break;
  +    case URL_IS_PATH:                /* XXX note: file:/// prefix is 
dropped. */
  +    case URL_IS_UNKNOWN:
  +     path = lpath;
  +     break;
  +    }
  +
  +    if (lpath == NULL || *lpath == '/')
  +/[EMAIL PROTECTED]@*/        /* XXX glibc extension */
  +     rpath = realpath(lpath, resolved_path);
  +/[EMAIL PROTECTED]@*/
  +    else {
  +     char * t;
  +#if defined(__GLIBC__)
  +     char * dn = NULL;
  +#else
  +     char dn[PATH_MAX];
  +     dn[0] = '\0';
  +#endif
  +     /*
  +      * Using realpath on lpath isn't correct if the lpath is a symlink,
  +      * especially if the symlink is a dangling link.  What we 
  +      * do instead is use realpath() on `.' and then append lpath to
  +      * the result.
  +      */
  +     if ((t = realpath(".", dn)) != NULL) {
  +/[EMAIL PROTECTED]@*/        /* XXX no rpmGlobalMacroContext mods please. */
  +         rpath = (char *) rpmGetPath(t, "/", lpath, NULL);
  +         /* XXX preserve the pesky trailing '/' */
  +         if (lpath[strlen(lpath)-1] == '/') {
  +             char * s = rpath;
  +             rpath = rpmExpand(s, "/", NULL);
  +             s = _free(s);
  +         }
  +/[EMAIL PROTECTED]@*/
  +     } else
  +         rpath = NULL;
  +#if defined(__GLIBC__)
  +     t = _free(t);
  +#endif
  +    }
  +
  +    return rpath;
  +}
  +
   off_t Lseek(int fdno, off_t offset, int whence)
   {
   if (_rpmio_debug)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmmtree.c
  ============================================================================
  $ cvs diff -u -r2.1.6.3 -r2.1.6.4 rpmmtree.c
  --- rpm/tools/rpmmtree.c      16 Jun 2008 13:22:26 -0000      2.1.6.3
  +++ rpm/tools/rpmmtree.c      22 Jun 2008 19:28:54 -0000      2.1.6.4
  @@ -3742,9 +3742,9 @@
        /* Convert to absolute/clean/malloc'd path. */
        if (lpath[0] != '/') {
            /* XXX GLIBC: realpath(path, NULL) return malloc'd */
  -         rpath = realpath(lpath, NULL);
  +         rpath = Realpath(lpath, NULL);
            if (rpath == NULL)
  -             rpath = realpath(lpath, fullpath);
  +             rpath = Realpath(lpath, fullpath);
            if (rpath == NULL)
                mtree_error("Realpath(%s): %s", lpath, strerror(errno));
            lpath = rpmGetPath(rpath, NULL);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmrepo.c
  ============================================================================
  $ cvs diff -u -r1.1.2.9 -r1.1.2.10 rpmrepo.c
  --- rpm/tools/rpmrepo.c       21 Jun 2008 19:45:19 -0000      1.1.2.9
  +++ rpm/tools/rpmrepo.c       22 Jun 2008 19:28:54 -0000      1.1.2.10
  @@ -2,7 +2,6 @@
    * \file rpmio/rpmrepo.c
    */
   
  -#define      Realpath        realpath
   #define      Closedir        closedir
   
   #define      rpmioInit       rpmcliInit
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to