All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] static IDs bugs and usability
@ 2016-07-28  9:42 Patrick Ohly
  2016-07-28  9:43 ` [PATCH 1/1] useradd-staticids.bbclass: trigger reparsing when table files change Patrick Ohly
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Ohly @ 2016-07-28  9:42 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Rozhkov

In Ostro OS we just started to use useradd-staticids.bbclass. Dynamic
IDs are an error (USERADD_ERROR_DYNAMIC = "error") by default because
warnings probably wouldn't be noticed. I was a bit reluctant to make
this change because Ostro OS is supposed to be customizable, and that
becomes harder when developers also have to define IDs.

But we didn't have a choice because after updating to recent OE-core,
our dynamically assigned IDs started to change randomly between
builds, which (as we learned only because of that change) broke the
swupd update mechanism. Personally I suspect that Python3's
randomization feature is responsible for not getting deterministic
results anymore, but I haven't investigated further.

useradd-staticids.bbclass has a bug which impacts developers when they
edit the table files to fix a warning or error raised by the class:
the cached version of the affected recipe continues to be used and thus
editing the files has no effect. Patch fixing that follows.

There's also a caveat associated with how USERADD_ERROR_DYNAMIC = "error"
is implemented: it marks recipes as "skipped" with an error messages
from useradd-staticids.bbclass. This is not particularly developer-friendly.

For example, when the skipped recipe is deep down in the dependency
chain, then building will fail with rather difficult to understand
"nothing provides..." messages. It does mention eventually that a
recipe was skipped with the right error, so the information is at
least there.

However, it's also possible that a recipe exists in two versions, and
only the one normally picked as default gets skipped. In that case,
the remaining version will get build, i.e. useradd-staticids.bbclass
has the very undesirable effect of silently building something else
than expected instead of aborting the build because of the error.

I've not seen that in practice, though, so I don't know how big of a
problem it is.

The following changes since commit b32d430c3c7dccf3a8d06ab492d648893a05950f:

  dpkg: use snapshot.debian.org for SRC_URI (2016-07-26 08:56:08 +0100)

are available in the git repository at:

  git://github.com/pohly/openembedded-core static-ids
  https://github.com/pohly/openembedded-core/tree/static-ids

Patrick Ohly (1):
  useradd-staticids.bbclass: trigger reparsing when table files change

 meta/classes/useradd-staticids.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

-- 
2.1.4



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

* [PATCH 1/1] useradd-staticids.bbclass: trigger reparsing when table files change
  2016-07-28  9:42 [PATCH 0/1] static IDs bugs and usability Patrick Ohly
@ 2016-07-28  9:43 ` Patrick Ohly
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Ohly @ 2016-07-28  9:43 UTC (permalink / raw)
  To: openembedded-core

This addresses (among others) the following problem:
- USERADD_ERROR_DYNAMIC=error causes a recipe to get skipped
  because a static ID entry is missing
- the entry gets added to the file
- using the recipe still fails with the same error as before
  because the recipe gets loaded from the cache instead
  of re-parsing it with the new table content

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
---
 meta/classes/useradd-staticids.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index 149245b..46d4a4b 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -285,6 +285,19 @@ def update_useradd_static_config(d):
 
         return ";".join(newparams).strip()
 
+    # The parsing of the current recipe depends on the content of
+    # the files listed in USERADD_UID/GID_TABLES. We need to tell bitbake
+    # about that explicitly to trigger re-parsing and thus re-execution of
+    # this code when the files change.
+    bbpath = d.getVar('BBPATH', True)
+    for varname, default in (('USERADD_UID_TABLES', 'files/passwd'),
+                             ('USERADD_GID_TABLES', 'files/group')):
+        tables = d.getVar(varname, True)
+        if not tables:
+            tables = default
+        for conf_file in tables.split():
+            bb.parse.mark_dependency(d, bb.utils.which(bbpath, conf_file))
+
     # Load and process the users and groups, rewriting the adduser/addgroup params
     useradd_packages = d.getVar('USERADD_PACKAGES', True)
 
-- 
2.1.4



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

end of thread, other threads:[~2016-07-28  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28  9:42 [PATCH 0/1] static IDs bugs and usability Patrick Ohly
2016-07-28  9:43 ` [PATCH 1/1] useradd-staticids.bbclass: trigger reparsing when table files change Patrick Ohly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.