[gentoo-portage-dev] [PATCH] selinux: encode os path arguments as UTF-8 (bug 741194)

2020-09-08 Thread Zac Medico
Encode path arguments as UTF-8, like portage.os wrapper.

Fixes: 6137290b2bb8 ("selinux: python3 unicode paths, bug #430488")
Bug: https://bugs.gentoo.org/741194
Signed-off-by: Zac Medico 
---
 lib/portage/_selinux.py | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/portage/_selinux.py b/lib/portage/_selinux.py
index e3e18c0b8..2423ff8d6 100644
--- a/lib/portage/_selinux.py
+++ b/lib/portage/_selinux.py
@@ -14,7 +14,7 @@ except ImportError:
 
 import portage
 from portage import _encodings
-from portage import _native_string
+from portage import _native_string, _unicode_encode
 from portage.localization import _
 
 def copyfile(src, dest):
@@ -41,7 +41,6 @@ def is_selinux_enabled():
return selinux.is_selinux_enabled()
 
 def mkdir(target, refdir):
-   target = _native_string(target, encoding=_encodings['fs'], 
errors='strict')
refdir = _native_string(refdir, encoding=_encodings['fs'], 
errors='strict')
(rc, ctx) = selinux.getfilecon(refdir)
if rc < 0:
@@ -51,20 +50,21 @@ def mkdir(target, refdir):
 
setfscreate(ctx)
try:
-   os.mkdir(target)
+   os.mkdir(_unicode_encode(target, encoding=_encodings['fs'], 
errors='strict'))
finally:
setfscreate()
 
 def rename(src, dest):
src = _native_string(src, encoding=_encodings['fs'], errors='strict')
-   dest = _native_string(dest, encoding=_encodings['fs'], errors='strict')
(rc, ctx) = selinux.lgetfilecon(src)
if rc < 0:
raise OSError(_("rename: Failed getting context of \"%s\".") % 
src)
 
setfscreate(ctx)
try:
-   os.rename(src, dest)
+   os.rename(
+   _unicode_encode(src, encoding=_encodings['fs'], 
errors='strict'),
+   _unicode_encode(dest, encoding=_encodings['fs'], 
errors='strict'))
finally:
setfscreate()
 
@@ -132,8 +132,6 @@ class spawn_wrapper:
return self._spawn_func(*args, **kwargs)
 
 def symlink(target, link, reflnk):
-   target = _native_string(target, encoding=_encodings['fs'], 
errors='strict')
-   link = _native_string(link, encoding=_encodings['fs'], errors='strict')
reflnk = _native_string(reflnk, encoding=_encodings['fs'], 
errors='strict')
(rc, ctx) = selinux.lgetfilecon(reflnk)
if rc < 0:
@@ -143,6 +141,8 @@ def symlink(target, link, reflnk):
 
setfscreate(ctx)
try:
-   os.symlink(target, link)
+   os.symlink(
+   _unicode_encode(target, encoding=_encodings['fs'], 
errors='strict'),
+   _unicode_encode(link, encoding=_encodings['fs'], 
errors='strict'))
finally:
setfscreate()
-- 
2.25.3




[gentoo-dev] Re: [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Hi,

This fix might not be so straightforward.  A configuration I tested
hit a dependency loop with shadow -> pambase -> systemd -> a bunch of
groups -> shadow.  It is possible to bootstrap around by emerging
shadow with no USE flags first, but I don't know how acceptable it is
to introduce new dep loops like this.

Thanks.

David



Re: [gentoo-dev] [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
On Tue, Sep 8, 2020 at 12:04 PM Michał Górny  wrote:
> On Tue, 2020-09-08 at 11:57 -0400, David Michael wrote:
> > Signed-off-by: David Michael 
> > ---
> >  eclass/acct-group.eclass | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> > index 19a378e0b06..56e6391ef42 100644
> > --- a/eclass/acct-group.eclass
> > +++ b/eclass/acct-group.eclass
> > @@ -34,8 +34,12 @@
> >  if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
> >  _ACCT_GROUP_ECLASS=1
> >
> > +# The groupadd utility is called in pkg_preinst.  It should be in IDEPEND.
> >  case ${EAPI:-0} in
> > - 7) ;;
> > + 7)
> > + BDEPEND="userland_GNU? ( sys-apps/shadow )"
>
> Nothing from shadow is used in src_install, so this BDEPEND is
> unnecessary.

It is a workaround for EAPI 7's lack of IDEPEND to attempt to handle
cross-compiling, where RDEPEND alone would never attempt to install
the package in the native root.  Other packages and eclasses have been
using this convention for the same reason (Emacs, fcaps.eclass, etc.).

Thanks.

David



Re: [gentoo-dev] [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread Michał Górny
On Tue, 2020-09-08 at 11:57 -0400, David Michael wrote:
> Signed-off-by: David Michael 
> ---
>  eclass/acct-group.eclass | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> index 19a378e0b06..56e6391ef42 100644
> --- a/eclass/acct-group.eclass
> +++ b/eclass/acct-group.eclass
> @@ -34,8 +34,12 @@
>  if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
>  _ACCT_GROUP_ECLASS=1
>  
> +# The groupadd utility is called in pkg_preinst.  It should be in IDEPEND.
>  case ${EAPI:-0} in
> - 7) ;;
> + 7)
> + BDEPEND="userland_GNU? ( sys-apps/shadow )"

Nothing from shadow is used in src_install, so this BDEPEND is
unnecessary.

> + RDEPEND="${BDEPEND}"
> + ;;
>   *) die "EAPI=${EAPI:-0} not supported";;
>  esac
>  

-- 
Best regards,
Michał Górny



signature.asc
Description: This is a digitally signed message part


[gentoo-dev] [PATCH 2/2] acct-user.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/acct-user.eclass | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index 56a4e83e8bf..96a076e106e 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -42,8 +42,12 @@
 if [[ -z ${_ACCT_USER_ECLASS} ]]; then
 _ACCT_USER_ECLASS=1
 
+# The useradd utility is called in pkg_preinst.  It should be in IDEPEND.
 case ${EAPI:-0} in
-   7) ;;
+   7)
+   BDEPEND="userland_GNU? ( sys-apps/shadow )"
+   RDEPEND="${BDEPEND}"
+   ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.26.2




[gentoo-dev] [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/acct-group.eclass | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 19a378e0b06..56e6391ef42 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -34,8 +34,12 @@
 if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
 _ACCT_GROUP_ECLASS=1
 
+# The groupadd utility is called in pkg_preinst.  It should be in IDEPEND.
 case ${EAPI:-0} in
-   7) ;;
+   7)
+   BDEPEND="userland_GNU? ( sys-apps/shadow )"
+   RDEPEND="${BDEPEND}"
+   ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.26.2




Re: [gentoo-dev] [PATCH] lua.eclass: initial implementation

2020-09-08 Thread Azamat Hackimov
Marek,

Is there any plans how to begin migrating lua packages to new eclass?
As I can see, the current stable dev-lang/lua:0 package is not suited
for it, while other slotted packages have major flaws about *.pc
handling.

вт, 8 сент. 2020 г. в 17:32, Marek Szuba :
>
> Merged, thank you everyone who has weighed in with their comments both
> on IRC and here.
>
> --
> MS
>


-- 
>From Siberia with Love!



Re: [gentoo-dev] [PATCH] lua.eclass: initial implementation

2020-09-08 Thread Marek Szuba
Merged, thank you everyone who has weighed in with their comments both
on IRC and here.

-- 
MS



signature.asc
Description: OpenPGP digital signature