public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic
@ 2014-09-11  8:51 Bertrand Simonnet
  2014-09-11 22:07 ` Zac Medico
  2014-09-11 23:45 ` Zac Medico
  0 siblings, 2 replies; 3+ messages in thread
From: Bertrand Simonnet @ 2014-09-11  8:51 UTC (permalink / raw
  To: gentoo-portage-dev


[-- Attachment #1.1: Type: text/plain, Size: 543 bytes --]

Hi everyone,

I think there is a bug in the read only detection logic: portage will check
the write permission on the system relative to / and not relative to ROOT.

I found this when emerging a package with --root=/usr/local on my system
with:
* / read only
* /usr/local read-write

Note, the error message was also wrong as it indicated that /usr/local was
read only when it actually detected / as read only and prefixed it with
ROOT in the message.

I attached a patch that fix the detection logic and the error message.

Bertrand Simonnet

[-- Attachment #1.2: Type: text/html, Size: 705 bytes --]

[-- Attachment #2: 0001-Fix-read-only-detection-logic.patch --]
[-- Type: application/octet-stream, Size: 1121 bytes --]

From fda8818cebe62d05ded45cd467c91e6b789fe312 Mon Sep 17 00:00:00 2001
From: Bertrand SIMONNET <bsimonnet@chromium.org>
Date: Thu, 11 Sep 2014 01:06:37 -0700
Subject: [PATCH] Fix read only detection logic

Portage should check for a read only file system relative to ROOT and not /.
---
 pym/portage/dbapi/vartree.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5b947dd..8bc6073 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3723,7 +3723,7 @@ class dblink(object):
 					break
 
 				relative_path = parent[srcroot_len:]
-				dirlist.append(os.path.join("/", relative_path))
+				dirlist.append(os.path.join(destroot, relative_path))
 
 				for fname in files:
 					try:
@@ -3849,8 +3849,7 @@ class dblink(object):
 			msg = textwrap.wrap(msg, 70)
 			msg.append("")
 			for f in rofilesystems:
-				msg.append("\t%s" % os.path.join(destroot,
-					f.lstrip(os.path.sep)))
+				msg.append("\t%s" % f)
 			msg.append("")
 			self._elog("eerror", "preinst", msg)
 
-- 
2.1.0.rc2.206.gedb03e5


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

* Re: [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic
  2014-09-11  8:51 [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic Bertrand Simonnet
@ 2014-09-11 22:07 ` Zac Medico
  2014-09-11 23:45 ` Zac Medico
  1 sibling, 0 replies; 3+ messages in thread
From: Zac Medico @ 2014-09-11 22:07 UTC (permalink / raw
  To: gentoo-portage-dev

On 09/11/2014 01:51 AM, Bertrand Simonnet wrote:
> Hi everyone,
> 
> I think there is a bug in the read only detection logic: portage will
> check the write permission on the system relative to / and not relative
> to ROOT.
> 
> I found this when emerging a package with --root=/usr/local on my system
> with:
> * / read only
> * /usr/local read-write
> 
> Note, the error message was also wrong as it indicated that /usr/local
> was read only when it actually detected / as read only and prefixed it
> with ROOT in the message.
> 
> I attached a patch that fix the detection logic and the error message.
> 
> Bertrand Simonnet

LGTM.
-- 
Thanks,
Zac


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

* Re: [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic
  2014-09-11  8:51 [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic Bertrand Simonnet
  2014-09-11 22:07 ` Zac Medico
@ 2014-09-11 23:45 ` Zac Medico
  1 sibling, 0 replies; 3+ messages in thread
From: Zac Medico @ 2014-09-11 23:45 UTC (permalink / raw
  To: gentoo-portage-dev

On 09/11/2014 01:51 AM, Bertrand Simonnet wrote:
> Hi everyone,
> 
> I think there is a bug in the read only detection logic: portage will
> check the write permission on the system relative to / and not relative
> to ROOT.
> 
> I found this when emerging a package with --root=/usr/local on my system
> with:
> * / read only
> * /usr/local read-write
> 
> Note, the error message was also wrong as it indicated that /usr/local
> was read only when it actually detected / as read only and prefixed it
> with ROOT in the message.
> 
> I attached a patch that fix the detection logic and the error message.
> 
> Bertrand Simonnet

This is in git, for release in portage-2.2.13:

https://github.com/gentoo/portage/commit/34e3661b76e6c8a95e57c95d78ba673be32cc2b1
-- 
Thanks,
Zac


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

end of thread, other threads:[~2014-09-11 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  8:51 [gentoo-portage-dev] [PATCH] Fix read only filesystem detection logic Bertrand Simonnet
2014-09-11 22:07 ` Zac Medico
2014-09-11 23:45 ` Zac Medico

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