pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Ignore package-conflicts, when none of the "problematic" files actually exist

Open UnitedMarsupials opened this issue 1 year ago • 3 comments

It would seem reasonable, that, when the conflicting files do not actually exist on the filesystem, the installation should not fail. Instead of seeking, how to modify pkg's command line to "force" the installation, it may be easier to just delete the few problematic entries (when there are only a few, that is).

The below patch may be incomplete -- the same method may need extending to the config-files and directories -- but gives an idea, of what I mean...

--- libpkg/pkgdb.c      2023-07-12 03:48:26.000000000 -0400
+++ libpkg/pkgdb.c      2023-07-25 22:30:14.525498000 -0400
@@ -43,4 +43,5 @@
 #include <sys/param.h>
 #include <sys/mount.h>
+#include <sys/stat.h>
 
 #include <assert.h>
@@ -1671,4 +1672,6 @@
        while (pkg_files(pkg, &file) == EPKG_OK) {
                bool            permissive = false;
+               struct stat     sb;
+
                if (match_ucl_lists(file->path,
                    pkg_config_get("FILES_IGNORE_GLOB"),
@@ -1709,4 +1712,19 @@
                        ERROR_STMT_SQLITE(s, STMT(FILES_REPLACE));
                        goto cleanup;
+               }
+               if (stat(file->path, &sb) != 0) {
+                       switch (errno) {
+                       case ENOENT:
+                       case ENAMETOOLONG:
+                       case ELOOP:
+                               pkg_emit_error("%s-%s seems to conflict with %s-%s, "
+                                   "but the problematic %s does not exist, ignoring",
+                                   pkg->name, pkg->version, pkg2->name, pkg2->version,
+                                   file->path);
+                               pkg_free(pkg2);
+                               continue;
+                       default:
+                               warn("%s: stat", file->path);
+                       }
                }
                if (!forced) {

UnitedMarsupials avatar Jul 26 '23 02:07 UnitedMarsupials

In that circumstances would this be the case?

igalic avatar Jul 26 '23 10:07 igalic

In what circumstances would this be the case?

One example is when a family of related ports is rearranged, and trying to portupgrade them causes conflicts. Such as the multimedia/gstreamer1-plugins-ugly used to install a shared object, which is now provided by the multimedia/gstreamer1-plugins-bad...

UnitedMarsupials avatar Jul 26 '23 18:07 UnitedMarsupials

Hello everyone , I wanted to contribute to the freeBSD project , can someone assist me further for it.

Jay-sanjay avatar Sep 28 '23 15:09 Jay-sanjay