public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] Two bugfix patches
@ 2014-04-04 19:36 Brian Dolbec
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428) Brian Dolbec
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-04-04 19:36 UTC (permalink / raw
  To: gentoo-portage-dev

[PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428)
[PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186)

These are the fixes for 2 recent bugs.  I'd like to merge them and push out a release
again soon.  Perhaps this weekend.

Is there any other bugfixes to go in? 
I am merging some other patches submitted to the list as well.

The merging emaint module we'll commit after this bugfix release so it can spend some
time in -9999 before going into a release.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428)
  2014-04-04 19:36 [gentoo-portage-dev] Two bugfix patches Brian Dolbec
@ 2014-04-04 19:36 ` Brian Dolbec
  2014-04-04 20:10   ` Alexander Berntsen
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186) Brian Dolbec
  2014-04-04 20:01 ` [gentoo-portage-dev] Two bugfix patches Alexander Berntsen
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Dolbec @ 2014-04-04 19:36 UTC (permalink / raw
  To: gentoo-portage-dev

Use /proc/self/mountinfo which only contains the relevant chroot mounts.
Mountinfo changes are thanks to jcallen for the valuable info he provided.
---
 pym/portage/util/writeable_check.py | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/pym/portage/util/writeable_check.py b/pym/portage/util/writeable_check.py
index e6ddce6..745fbf0 100644
--- a/pym/portage/util/writeable_check.py
+++ b/pym/portage/util/writeable_check.py
@@ -13,7 +13,6 @@ from __future__ import unicode_literals
 
 import io
 import logging
-import re
 
 from portage import _encodings
 from portage.util import writemsg_level
@@ -34,8 +33,8 @@ def get_ro_checker():
 
 def linux_ro_checker(dir_list):
 	"""
-	Use /proc/mounts to check that no directories installed by the ebuild are set
-	to be installed to a read-only filesystem.
+	Use /proc/self/mountinfo to check that no directories installed by the
+	ebuild are set to be installed to a read-only filesystem.
 
 	@param dir_list: A list of directories installed by the ebuild.
 	@type dir_list: List
@@ -46,18 +45,26 @@ def linux_ro_checker(dir_list):
 	ro_filesystems = set()
 
 	try:
-		with io.open("/proc/mounts", mode='r', encoding=_encodings['content'],
-			errors='replace') as f:
-			roregex = re.compile(r'(\A|,)ro(\Z|,)')
-			for line in f:
-				if roregex.search(line.split(" ")[3].strip()) is not None:
-					romount = line.split(" ")[1].strip()
-					ro_filesystems.add(romount)
+		with io.open("/proc/self/mountinfo", mode='r',
+			encoding=_encodings['content'], errors='replace') as f:
+			for line in f.readlines():
+				# we're interested in dir and both attr fileds which always
+				# start with either 'ro' or 'rw'
+				# example line:
+				# 14 1 8:3 / / rw,noatime - ext3 /dev/root rw,errors=continue,commit=5,barrier=1,data=writeback
+				#        dir ^ ^ attr                      ^ attr
+				# there can be a variable number of fields
+				# to the left of the ' - ', after the attr's, so split it there
+				mount = line.split(' - ')
+				mountl = mount[0].split()
+				mountr = mount[1].split()
+				if mountl[5].startswith('ro') or mountr[2].startswith('ro'):
+					ro_filesystems.add(mountl[4])
 
-	# If /proc/mounts can't be read, assume that there are no RO
+	# If /proc/self/mountinfo can't be read, assume that there are no RO
 	# filesystems and return.
 	except EnvironmentError:
-		writemsg_level(_("!!! /proc/mounts cannot be read"),
+		writemsg_level(_("!!! /proc/self/mountinfo cannot be read"),
 			level=logging.WARNING, noiselevel=-1)
 		return []
 
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186)
  2014-04-04 19:36 [gentoo-portage-dev] Two bugfix patches Brian Dolbec
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428) Brian Dolbec
@ 2014-04-04 19:36 ` Brian Dolbec
  2014-04-04 20:13   ` Alexander Berntsen
  2014-04-04 20:01 ` [gentoo-portage-dev] Two bugfix patches Alexander Berntsen
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Dolbec @ 2014-04-04 19:36 UTC (permalink / raw
  To: gentoo-portage-dev

---
 pym/_emerge/TaskSequence.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/TaskSequence.py b/pym/_emerge/TaskSequence.py
index 1fecf63..b4bfefe 100644
--- a/pym/_emerge/TaskSequence.py
+++ b/pym/_emerge/TaskSequence.py
@@ -30,8 +30,9 @@ class TaskSequence(CompositeTask):
 		CompositeTask._cancel(self)
 
 	def _start_next_task(self):
-		self._start_task(self._task_queue.popleft(),
-			self._task_exit_handler)
+		if self._task_queue:
+			self._start_task(self._task_queue.popleft(),
+				self._task_exit_handler)
 
 	def _task_exit_handler(self, task):
 		if self._default_exit(task) != os.EX_OK:
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] Two bugfix patches
  2014-04-04 19:36 [gentoo-portage-dev] Two bugfix patches Brian Dolbec
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428) Brian Dolbec
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186) Brian Dolbec
@ 2014-04-04 20:01 ` Alexander Berntsen
  2014-04-04 21:29   ` Brian Dolbec
  2 siblings, 1 reply; 7+ messages in thread
From: Alexander Berntsen @ 2014-04-04 20:01 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 04/04/14 21:36, Brian Dolbec wrote:
> Is there any other bugfixes to go in? I am merging some other
> patches submitted to the list as well.
There's my/your/our patch(es) for bug 505944. Any idea on what to do
about that? No one has offered a better way yet.

- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlM/D6MACgkQRtClrXBQc7WCQAEAhe8CidDlizeuyhp9tq9eslVM
boeWSmXwAMjCSjwqbdkBAJ3pxtvq/BvdIm1rVUzLTry7t6pN7OjO3MzmpxrZl6fH
=5KQr
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428)
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428) Brian Dolbec
@ 2014-04-04 20:10   ` Alexander Berntsen
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Berntsen @ 2014-04-04 20:10 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 04/04/14 21:36, Brian Dolbec wrote:
> -	Use /proc/mounts to check that no directories installed by the ebuild are set
> -	to be installed to a read-only filesystem.
> +	Use /proc/self/mountinfo to check that no directories installed by the
> +	ebuild are set to be installed to a read-only filesystem.
This chunk is unrelated to what you are actually doing.

On 04/04/14 21:36, Brian Dolbec wrote:> +				mount = line.split(' - ')
> +				mountl = mount[0].split()
> +				mountr = mount[1].split()
> +				if mountl[5].startswith('ro') or mountr[2].startswith('ro'):
> +					ro_filesystems.add(mountl[4])
I'm not sure assigning mountl and mountr is worth it. They're not more mnemonic than just doing mount[0].split() and mount[1].split directly.

Also, fix the commit message. "bug" goes in the parens as well as the number. It's also >50 chars. I'd prefer something like "portage/util: Fix RO check bug (bug 505428)".
- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlM/EawACgkQRtClrXBQc7VgBAD/TOeyiJBO+AzoiebNGA2BrtFw
IXdzAVr65rq29zXYTPcBAJDU2luO07AGoB0imoxc/QX7jYqe/HNFUgwIb4L5pEzA
=jW4U
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186)
  2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186) Brian Dolbec
@ 2014-04-04 20:13   ` Alexander Berntsen
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Berntsen @ 2014-04-04 20:13 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 04/04/14 21:36, Brian Dolbec wrote:
> --- pym/_emerge/TaskSequence.py | 5 +++-- 1 file changed, 3
> insertions(+), 2 deletions(-)
> 
> diff --git a/pym/_emerge/TaskSequence.py
> b/pym/_emerge/TaskSequence.py index 1fecf63..b4bfefe 100644 ---
> a/pym/_emerge/TaskSequence.py +++ b/pym/_emerge/TaskSequence.py @@
> -30,8 +30,9 @@ class TaskSequence(CompositeTask): 
> CompositeTask._cancel(self)
> 
> def _start_next_task(self): -
> self._start_task(self._task_queue.popleft(), -
> self._task_exit_handler) +		if self._task_queue: +
> self._start_task(self._task_queue.popleft(), +
> self._task_exit_handler)
> 
> def _task_exit_handler(self, task): if self._default_exit(task) !=
> os.EX_OK:
> 
I assume the check doesn't have to be atomic, so LGTM. Too long commit
msg though. Should be something like "TaskSequence: Don't start empty
queue (bug 506186)".

- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlM/EnsACgkQRtClrXBQc7WzCQD/W40mrQvUOlvnwXxZV3ZEOw5O
q02iC0nrH5shF8jpcwwA/0Yfgw5OLgyZYjrCpzWdxJZnZe2TbX0R8DtJIl9gCGTa
=fkZ3
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] Two bugfix patches
  2014-04-04 20:01 ` [gentoo-portage-dev] Two bugfix patches Alexander Berntsen
@ 2014-04-04 21:29   ` Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-04-04 21:29 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Fri, 04 Apr 2014 22:01:39 +0200
Alexander Berntsen <bernalex@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 04/04/14 21:36, Brian Dolbec wrote:
> > Is there any other bugfixes to go in? I am merging some other
> > patches submitted to the list as well.
> There's my/your/our patch(es) for bug 505944. Any idea on what to do
> about that? No one has offered a better way yet.
> 
> - -- 
> Alexander
> 

Yeah, I was thinking the same thing.  let's do the:

if dep.atom and dep.atom.unevaluated_atom and
	dep.atom is not dep.atom.unevaluated_atom:


- -- 
Brian Dolbec <dolsen>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQF8BAEBCgBmBQJTPyREXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4Njg4RkQxQ0M3MUMxQzA0RUFFQTQyMzcy
MjE0RDkwQTAxNEYxN0NCAAoJECIU2QoBTxfLT38H/jszGW1hMLxVFtujWFVwLjAt
StcFqGn1JyWkfdABATtrgsgxFApdzfQAghHStpWbKZwjdT0pcMcfc07l7S/cXzuh
eACMb6hjlkcuwywgF8Yf1iug28T7XKJCLlgJ3KCyHDyPYNhieBykEAPyjAVHdjQe
SSgJOudHskmFGRoIrkfMEeB3I+q+p3vf20qVIrthjZ3ooq4iNu2Hply3whOPF2S/
2O3cFc0ykxL/OHJWhuyksRUzCcwr1ZmaEhBcli7IU/lmSQAq1994FNCrn130myC4
ZH+nqqMb2NRvs1lIxlEMGnDWVDb+H8PZuIZcGgYcvPY8TJtibf7V3H0q2DWTTcs=
=k5tB
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-04 21:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-04 19:36 [gentoo-portage-dev] Two bugfix patches Brian Dolbec
2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 1/2] portage/util/writeable_check.py: Fix RO check bug (505428) Brian Dolbec
2014-04-04 20:10   ` Alexander Berntsen
2014-04-04 19:36 ` [gentoo-portage-dev] [PATCH 2/2] TaskSequence.py: Fix starting an empty queue (bug 506186) Brian Dolbec
2014-04-04 20:13   ` Alexander Berntsen
2014-04-04 20:01 ` [gentoo-portage-dev] Two bugfix patches Alexander Berntsen
2014-04-04 21:29   ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox