RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/misc/ librpmmisc.vers rpm/rpmdb/ db3.c rpm...

From: Jeff Johnson <jbj@rpm5.org>
Date: Mon 24 Sep 2007 - 04:38:58 CEST
Message-Id: <20070924023858.2C42134845E@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:   24-Sep-2007 04:38:58
  Branch: HEAD                             Handle: 2007092403385601

  Modified files:
    rpm                     CHANGES
    rpm/misc                librpmmisc.vers
    rpm/rpmdb               db3.c rpmdb.c
    rpm/rpmio               librpmio.vers rpmio-stub.c rpmio-stub.h rpmio.h
                            rpmrpc.c

  Log:
    - jbj: ensure that PLD setup & FHS packages install correctly.
    - jbj: wrapper for open(2).

  Summary:
    Revision    Changes     Path
    1.1640      +2  -0      rpm/CHANGES
    1.6         +1  -0      rpm/misc/librpmmisc.vers
    1.72        +9  -0      rpm/rpmdb/db3.c
    1.159       +3  -2      rpm/rpmdb/rpmdb.c
    2.13        +2  -0      rpm/rpmio/librpmio.vers
    2.3         +1  -0      rpm/rpmio/rpmio-stub.c
    2.2         +1  -0      rpm/rpmio/rpmio-stub.h
    1.58        +11 -0      rpm/rpmio/rpmio.h
    2.55        +48 -0      rpm/rpmio/rpmrpc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1639 -r1.1640 CHANGES
  --- rpm/CHANGES	22 Sep 2007 21:25:16 -0000	1.1639
  +++ rpm/CHANGES	24 Sep 2007 02:38:56 -0000	1.1640
  @@ -1,4 +1,6 @@
   4.5 -> 5.0:
  +    - jbj: ensure that PLD setup & FHS packages install correctly.
  +    - jbj: wrapper for open(2).
       - rpm.org: ensure that yum's broken transaction checks "work" (#259961).
       - jbj: handle more white space in paths.
       - jbj: make the rpm hacker's entrance exam buggery harder (#281391).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/librpmmisc.vers
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 librpmmisc.vers
  --- rpm/misc/librpmmisc.vers	3 Jul 2007 16:33:58 -0000	1.5
  +++ rpm/misc/librpmmisc.vers	24 Sep 2007 02:38:57 -0000	1.6
  @@ -7,6 +7,7 @@
       rpmz_*;
       lua*;
       db_env_create_rpmdb;
  +    db_env_set_func_open_rpmdb;
       db_env_set_func_fsync_rpmdb;
       db_strerror_rpmdb;
       db_create_rpmdb;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/db3.c
  ============================================================================
  $ cvs diff -u -r1.71 -r1.72 db3.c
  --- rpm/rpmdb/db3.c	18 Aug 2007 23:40:36 -0000	1.71
  +++ rpm/rpmdb/db3.c	24 Sep 2007 02:38:57 -0000	1.72
  @@ -275,12 +275,21 @@
   		fileSystem @*/
   	/*@modifies dbi, *dbenvp, fileSystem @*/
   {
  +    static int oneshot = 0;
       rpmdb rpmdb = dbi->dbi_rpmdb;
       DB_ENV *dbenv = NULL;
       int eflags;
       int rc;
       int xx;
   
  +    if (!oneshot) {
  +#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR != 0) || (DB_VERSION_MAJOR == 4)
  +	xx = db_env_set_func_open(Open);
  +	xx = cvtdberr(dbi, "db_env_set_func_open", xx, _debug);
  +#endif
  +	oneshot++;
  +    }
  +
       if (dbenvp == NULL)
   	return 1;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.158 -r1.159 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	9 Sep 2007 19:06:51 -0000	1.158
  +++ rpm/rpmdb/rpmdb.c	24 Sep 2007 02:38:57 -0000	1.159
  @@ -3618,8 +3618,9 @@
       if (db == NULL) return 0;
   
       mi = rpmdbInitIterator(db, RPMTAG_BASENAMES, NULL, 0);
  -    if (mi == NULL)	/* XXX should  never happen */
  -	return 0;
  +assert(mi);	/* XXX will never happen. */
  +    if (mi == NULL)
  +	return 2;
   
   key = &mi->mi_key;
   data = &mi->mi_data;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.12 -r2.13 librpmio.vers
  --- rpm/rpmio/librpmio.vers	9 Sep 2007 20:32:43 -0000	2.12
  +++ rpm/rpmio/librpmio.vers	24 Sep 2007 02:38:57 -0000	2.13
  @@ -140,6 +140,8 @@
       _Mknod;
       Mount;
       noLibio;
  +    Open;
  +    _Open;
       Opendir;
       _Opendir;
       pgpArmorKeyTbl;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio-stub.c
  ============================================================================
  $ cvs diff -u -r2.2 -r2.3 rpmio-stub.c
  --- rpm/rpmio/rpmio-stub.c	19 Jul 2007 19:26:24 -0000	2.2
  +++ rpm/rpmio/rpmio-stub.c	24 Sep 2007 02:38:57 -0000	2.3
  @@ -34,6 +34,7 @@
   int (*_Chdir) (const char * path) = Chdir;
   int (*_Rmdir) (const char * path) = Rmdir;
   int (*_Chroot) (const char * path) = Chroot;
  +int (*_Open) (const char * path, int flags, mode_t mode) = Open;
   int (*_Rename) (const char * oldpath, const char * newpath) = Rename;
   int (*_Link) (const char * oldpath, const char * newpath) = Link;
   int (*_Unlink) (const char * path) = Unlink;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio-stub.h
  ============================================================================
  $ cvs diff -u -r2.1 -r2.2 rpmio-stub.h
  --- rpm/rpmio/rpmio-stub.h	15 Jul 2007 19:37:23 -0000	2.1
  +++ rpm/rpmio/rpmio-stub.h	24 Sep 2007 02:38:57 -0000	2.2
  @@ -25,6 +25,7 @@
   extern int (*_Chdir) (const char * path);
   extern int (*_Rmdir) (const char * path);
   extern int (*_Chroot) (const char * path);
  +extern int (*_Open) (const char * path, int flags, mode_t mode);
   extern int (*_Rename) (const char * oldpath, const char * newpath);
   extern int (*_Link) (const char * oldpath, const char * newpath);
   extern int (*_Unlink) (const char * path);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.57 -r1.58 rpmio.h
  --- rpm/rpmio/rpmio.h	28 Aug 2007 20:45:49 -0000	1.57
  +++ rpm/rpmio/rpmio.h	24 Sep 2007 02:38:57 -0000	1.58
  @@ -342,11 +342,22 @@
   	/*@globals errno, h_errno, fileSystem, internalState @*/
   	/*@modifies errno, fileSystem, internalState @*/;
   
  +/*@unchecked@*/ /*@observer@*/ /*@null@*/
  +extern const char * _chroot_prefix;
  +
   /**
    * chroot(2) clone.
    * @todo Implement remotely.
    */
   int Chroot(const char * path)
  +	/*@globals _chroot_prefix, errno, fileSystem, internalState @*/
  +	/*@modifies _chroot_prefix, errno, fileSystem, internalState @*/;
  +
  +/**
  + * open(2) clone.
  + * @todo Implement remotely.
  + */
  +int Open(const char * path, int flags, mode_t mode)
   	/*@globals errno, fileSystem, internalState @*/
   	/*@modifies errno, fileSystem, internalState @*/;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.54 -r2.55 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c	10 Jul 2007 18:00:30 -0000	2.54
  +++ rpm/rpmio/rpmrpc.c	24 Sep 2007 02:38:57 -0000	2.55
  @@ -160,6 +160,9 @@
       return rmdir(path);
   }
   
  +/*@unchecked@*/
  +const char * _chroot_prefix = NULL;
  +
   int Chroot(const char * path)
   {
       const char * lpath;
  @@ -183,11 +186,56 @@
   	return -2;
   	/*@notreached@*/ break;
       }
  +
  +    _chroot_prefix = _free(_chroot_prefix);
  +    if (strcmp(path, "."))
  +	_chroot_prefix = rpmGetPath(path, NULL);
  +
   /*@-superuser@*/
       return chroot(path);
   /*@=superuser@*/
   }
   
  +int Open(const char * path, int flags, mode_t mode)
  +{
  +    const char * lpath;
  +    int ut = urlPath(path, &lpath);
  +
  +if (_rpmio_debug)
  +fprintf(stderr, "*** Open(%s, 0x%x, 0%o)\n", path, flags, mode);
  +    switch (ut) {
  +    case URL_IS_PATH:
  +	path = lpath;
  +	/*@fallthrough@*/
  +    case URL_IS_UNKNOWN:
  +	break;
  +    case URL_IS_DASH:
  +    case URL_IS_HKP:
  +    case URL_IS_FTP:		/* XXX TODO: implement. */
  +    case URL_IS_HTTPS:		/* XXX TODO: implement. */
  +    case URL_IS_HTTP:		/* XXX TODO: implement. */
  +    default:
  +	errno = EINVAL;		/* XXX W2DO? */
  +	return -2;
  +	/*@notreached@*/ break;
  +    }
  +
  +    if (_chroot_prefix && _chroot_prefix[0] == '/' && _chroot_prefix[1] != '\0')
  +    {
  +	size_t nb = strlen(_chroot_prefix);
  +	size_t ob = strlen(path);
  +	while (nb > 0 && _chroot_prefix[nb-1] == '/')
  +	    nb--;
  +	if (ob > nb && !strncmp(path, _chroot_prefix, nb) && path[nb] == '/')
  +	    path += nb;
  +    }
  +#ifdef	NOTYET	/* XXX likely sane default. */
  +    if (mode == 0)
  +	mode = 0644;
  +#endif
  +    return open(path, flags, mode);
  +}
  +
   /* XXX rpmdb.c: analogue to rename(2). */
   
   int Rename (const char * oldpath, const char * newpath)
  @@ .
Received on Mon Sep 24 04:38:58 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.