Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2005 15:40:15 +0200
From:      "Simon L. Nielsen" <simon@FreeBSD.org>
To:        Jon Noack <noackjr@alumni.rice.edu>
Cc:        ports@freebsd.org
Subject:   Re: portupgrade regression?
Message-ID:  <20050505134015.GG703@arthur.nitro.dk>
In-Reply-To: <20050429091043.GD16549@eddie.nitro.dk>
References:  <42689D49.4050908@alumni.rice.edu> <20050422140619.GA785@zaphod.nitro.dk> <42694383.7090500@alumni.rice.edu> <20050429091043.GD16549@eddie.nitro.dk>

next in thread | previous in thread | raw e-mail | index | archive | help

--iAL9S67WQOXgEPD9
Content-Type: multipart/mixed; boundary="i3lJ51RuaGWuFYNw"
Content-Disposition: inline


--i3lJ51RuaGWuFYNw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2005.04.29 11:10:43 +0200, Simon L. Nielsen wrote:

[portupgrade regression in portupgrade-20041226_2]

> I think I have found the way to fix this both so it works for
> non-root, make pkgdb.db not be updated all the time, and so it does
> not cause new security problems, but I need to work out a few quirks
> (my first version did not work correctly).  Hopefully I will get it
> working this weekend, if not I will add a bandaid so you can make it
> work by setting an environment variable.

OK, I think the attached patch should fix the issues so portversion
works again as non-root and the package database is only regenerated
when needed.

I would appreciate if somebody could test the attached patch to
minimize the risk that I have broken something else.

--=20
Simon L. Nielsen

--i3lJ51RuaGWuFYNw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="port-portupgrade-CAN-2005-0610_2.patch"
Content-Transfer-Encoding: quoted-printable

Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/sysutils/portupgrade/Makefile,v
retrieving revision 1.195
diff -u -d -r1.195 Makefile
--- Makefile	12 Apr 2005 08:24:48 -0000	1.195
+++ Makefile	5 May 2005 13:27:54 -0000
@@ -7,7 +7,7 @@
=20
 PORTNAME=3D	portupgrade
 PORTVERSION=3D	20041226
-PORTREVISION=3D	2
+PORTREVISION=3D	3
 CATEGORIES=3D	sysutils
 MASTER_SITES=3D	ftp://ftp.iDaemons.org/pub/distfiles/ \
 		${MASTER_SITE_LOCAL}
Index: files/patch-CAN-2005-0610
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/sysutils/portupgrade/files/patch-CAN-2005-0610,v
retrieving revision 1.1
diff -u -d -r1.1 patch-CAN-2005-0610
--- files/patch-CAN-2005-0610	12 Apr 2005 08:24:48 -0000	1.1
+++ files/patch-CAN-2005-0610	5 May 2005 13:27:48 -0000
@@ -1,46 +1,34 @@
-diff -ru ../orig.pkgtools-20041224/lib/pkgdb.rb ./lib/pkgdb.rb
---- ../orig.pkgtools-20041224/lib/pkgdb.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgdb.rb	Tue Mar 29 00:27:02 2005
-@@ -97,7 +97,7 @@
+diff -ru orig.pkgtools-20041224/lib/pkgdb.rb pkgtools-20041224/lib/pkgdb.rb
+--- orig.pkgtools-20041224/lib/pkgdb.rb	Wed Mar 23 21:37:47 2005
++++ pkgtools-20041224/lib/pkgdb.rb	Tue May  3 19:37:40 2005
+@@ -96,8 +96,13 @@
+     @db_dir =3D File.expand_path(new_db_dir || ENV['PKG_DBDIR'] || '/var/=
db/pkg')
 =20
      @db_file =3D File.join(@db_dir, 'pkgdb.db')
-     @tmp_dir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
+-    @tmp_dir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
 -    @fixme_file =3D File.join(@tmp_dir, 'pkgdb.fixme')
-+    @fixme_file =3D File.join(@db_dir, 'pkgdb.fixme')
++    if ! ENV['PKG_FIXME_FILE'] then
++      if $tmpdir.nil? then
++	init_tmpdir
++      end
++      ENV['PKG_FIXME_FILE'] =3D $tmpdir + "/pkgdb.fixme"
++    end
++    @fixme_file =3D ENV['PKG_FIXME_FILE']
      @db_filebase =3D @db_file.sub(/\.db$/, '')
      close_db
 =20
-diff -ru ../orig.pkgtools-20041224/lib/pkgsqldb.rb ./lib/pkgsqldb.rb
---- ../orig.pkgtools-20041224/lib/pkgsqldb.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgsqldb.rb	Tue Mar 29 00:29:51 2005
-@@ -74,7 +74,7 @@
-=20
-     @db_file =3D File.join(@db_dir, 'pkgdb.sqldb')
-     @tmp_dir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
--    @fixme_file =3D File.join(@tmp_dir, 'pkgdb.fixme')
-+    @fixme_file =3D File.join(@db_dir, 'pkgdb.fixme')
-     close_db
-=20
-     @db_dir
-diff -ru ../orig.pkgtools-20041224/lib/pkgtools.rb ./lib/pkgtools.rb
---- ../orig.pkgtools-20041224/lib/pkgtools.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgtools.rb	Wed Mar 30 23:51:50 2005
-@@ -204,7 +204,7 @@
-   $ports_dir =3D $portsdb.ports_dir
-   $packages_base =3D ENV['PACKAGES'] || File.join($ports_dir, 'packages')
-   $packages_dir =3D File.join($packages_base, 'All')
--  $tmpdir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
-+  init_tmpdir
-   $pkg_path =3D ENV['PKG_PATH'] || $packages_dir
-=20
-   $pkg_sites =3D (ENV['PKG_SITES'] || '').split
-@@ -222,6 +222,31 @@
-=20
-   $portsdb.ignore_categories =3D config_value(:IGNORE_CATEGORIES) || []
-   $portsdb.extra_categories =3D config_value(:EXTRA_CATEGORIES) || []
-+end
+diff -ru orig.pkgtools-20041224/lib/pkgmisc.rb pkgtools-20041224/lib/pkgmi=
sc.rb
+--- orig.pkgtools-20041224/lib/pkgmisc.rb	Wed Mar 23 21:37:47 2005
++++ pkgtools-20041224/lib/pkgmisc.rb	Thu May  5 14:09:37 2005
+@@ -95,3 +95,31 @@
+     end
+   end
+ end
 +
 +def init_tmpdir
++  if ! $tmpdir.nil? && $tmpdir !=3D "" then
++    return
++  end
 +  maintmpdir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
 +  if !FileTest.directory?(maintmpdir)
 +    raise "Temporary directory #{maintmpdir} does not exist"
@@ -63,6 +51,34 @@
 +    end
 +    }
 +  $tmpdir=3Dtmpdir
- end
++end
+diff -ru orig.pkgtools-20041224/lib/pkgsqldb.rb pkgtools-20041224/lib/pkgs=
qldb.rb
+--- orig.pkgtools-20041224/lib/pkgsqldb.rb	Wed Mar 23 21:37:47 2005
++++ pkgtools-20041224/lib/pkgsqldb.rb	Tue May  3 19:46:35 2005
+@@ -74,7 +74,13 @@
 =20
- def parse_pattern(str, regex =3D false)
+     @db_file =3D File.join(@db_dir, 'pkgdb.sqldb')
+     @tmp_dir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
+-    @fixme_file =3D File.join(@tmp_dir, 'pkgdb.fixme')
++    if ! ENV['PKG_FIXME_FILE'] then
++      if $tmpdir.nil? then
++	init_tmpdir
++      end
++      ENV['PKG_FIXME_FILE'] =3D $tmpdir + "/pkgdb.fixme"
++    end
++    @fixme_file =3D ENV['PKG_FIXME_FILE']
+     close_db
+=20
+     @db_dir
+diff -ru orig.pkgtools-20041224/lib/pkgtools.rb pkgtools-20041224/lib/pkgt=
ools.rb
+--- orig.pkgtools-20041224/lib/pkgtools.rb	Wed Mar 23 21:37:47 2005
++++ pkgtools-20041224/lib/pkgtools.rb	Tue May  3 19:29:59 2005
+@@ -204,7 +204,7 @@
+   $ports_dir =3D $portsdb.ports_dir
+   $packages_base =3D ENV['PACKAGES'] || File.join($ports_dir, 'packages')
+   $packages_dir =3D File.join($packages_base, 'All')
+-  $tmpdir =3D ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
++  init_tmpdir
+   $pkg_path =3D ENV['PKG_PATH'] || $packages_dir
+=20
+   $pkg_sites =3D (ENV['PKG_SITES'] || '').split

--i3lJ51RuaGWuFYNw--

--iAL9S67WQOXgEPD9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFCeiI/h9pcDSc1mlERAnTpAKCMhRHDIVbPZ5BF2rvULOMyxyYOswCgwrxd
o8+4qK+cFixvuFu0ZYLn5tU=
=KUBL
-----END PGP SIGNATURE-----

--iAL9S67WQOXgEPD9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050505134015.GG703>