public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/, /, lib/portage/util/
@ 2024-06-27  6:12 Ulrich Müller
  0 siblings, 0 replies; only message in thread
From: Ulrich Müller @ 2024-06-27  6:12 UTC (permalink / raw
  To: gentoo-commits

commit:     4d17764863896903df4d18fe7c6b45635a18f6c4
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 19 08:08:04 2024 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Jun 19 18:17:06 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d177648

vartree, movefile: Warn when rewriting a symlink

See PMS section 13.4.1 (Rewriting):
Any absolute symlink whose link starts with D must be rewritten with
the leading D removed. The package manager should issue a notice when
doing this.

Bug: https://bugs.gentoo.org/934514
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 NEWS                         |  2 ++
 lib/portage/dbapi/vartree.py | 10 ++++++++++
 lib/portage/util/movefile.py |  5 +++++
 3 files changed, 17 insertions(+)

diff --git a/NEWS b/NEWS
index b4b378e7a0..d5a03533d9 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ Bug fixes:
   working ebuilds. Future EAPIs will need to adjust the logic
   added by this change. See bug #907061.
 
+* vartree, movefile: Warn when rewriting a symlink (bug #934514).
+
 portage-3.0.65 (2024-06-04)
 --------------
 

diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index beb1a6486f..0c41d408c3 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -5563,6 +5563,16 @@ class dblink:
                 myabsto = myabsto.lstrip(sep)
                 if self.settings and self.settings["D"]:
                     if myto.startswith(self.settings["D"]):
+                        self._eqawarn(
+                            "preinst",
+                            [
+                                _(
+                                    "QA Notice: Absolute symlink %s points to %s inside the image directory.\n"
+                                    "Removing the leading %s from its path."
+                                )
+                                % (mydest, myto, self.settings["D"])
+                            ],
+                        )
                         myto = myto[len(self.settings["D"]) - 1 :]
                 # myrealto contains the path of the real file to which this symlink points.
                 # we can simply test for existence of this file to see if the target has been merged yet

diff --git a/lib/portage/util/movefile.py b/lib/portage/util/movefile.py
index 75100a3acd..7b880d2e3e 100644
--- a/lib/portage/util/movefile.py
+++ b/lib/portage/util/movefile.py
@@ -210,6 +210,11 @@ def movefile(
         try:
             target = os.readlink(src)
             if mysettings and "D" in mysettings and target.startswith(mysettings["D"]):
+                writemsg(
+                    f"!!! {_('Absolute symlink points to image directory.')}\n",
+                    noiselevel=-1,
+                )
+                writemsg(f"!!! {dest} -> {target}\n", noiselevel=-1)
                 target = target[len(mysettings["D"]) - 1 :]
             # Atomically update the path if it exists.
             try:


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-27  6:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  6:12 [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/, /, lib/portage/util/ Ulrich Müller

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