File conflict: owned by {package} #1

Closed
opened 2026-06-05 21:15:46 +01:00 by charlie · 2 comments
Owner

When installing a package doing the following process:

  • sudo vpm get merk
  • sudo vpm install merk
  • sudo vpm list

You'll see merk has been installed. However, if you then try to do the following process:

  • sudo vpm get hello
  • sudo vpm install hello

You'll be met with a conflict bug, despite the fact, that it shouldn't conflict. They're two entirely different packages.

I've believe I've made the issue in: static int install_files(const char *stage, const char *pkg), as this program was written over 2-3 very long days, I've borked the logic and not commented where in typical-me-fashion. I'll review the code myself over this weekend and once resolved if no one does it before me by then I'll push an update via a fix/file-conflict fork-and-merge process before putting vpm into Vulpine Linux.

Just thought I'd open the floor to bug fixing if anyone wants to try tackling it.

img

When installing a package doing the following process: - `sudo vpm get merk` - `sudo vpm install merk` - `sudo vpm list` You'll see `merk` has been installed. However, if you then try to do the following process: - `sudo vpm get hello` - `sudo vpm install hello` You'll be met with a conflict bug, despite the fact, that it shouldn't conflict. They're two entirely different packages. I've believe I've made the issue in: `static int install_files(const char *stage, const char *pkg)`, as this program was written over 2-3 very long days, I've borked the logic and not commented where in typical-me-fashion. I'll review the code myself over this weekend and once resolved _if no one does it before me by then_ I'll push an update via a `fix/file-conflict` fork-and-merge process before putting `vpm` into Vulpine Linux. Just thought I'd open the floor to bug fixing if anyone wants to try tackling it. ![img](https://cdn.dnsrail.org/uploads/1/media/screenshots/conflict_bug.png)
Author
Owner

@taylor identified the trouble code blocks as:

{
            FILE *fp = fopen(FILE_DB, "r");

            if (fp)
            {
                char owner[64];
                char fpath[PATH_MAX];

                while (fscanf(fp,
                    "%63s %1023s",
                    owner,
                    fpath) == 2)
                {
                    if (file_owned_by_other(pkg, fpath))
                    {
                        fprintf(stderr,
                                "file conflict: %s owned by %s\n",
                                fpath, owner);
                        fclose(fp);
                        return 1;
                    }
                }

                fclose(fp);
            }
        }

and also in this block

static int file_owned_by_other(const char *pkg,
                               const char *path)
{
    FILE *fp = fopen(FILE_DB, "r");

    if (!fp)
        return 0;

    char owner[64];
    char fpath[PATH_MAX];

    while (fscanf(fp,
        "%63s %1023s",
        owner,
        fpath) == 2)
    {
        if (!strcmp(fpath, path) &&
            strcmp(owner, pkg))
        {
            fclose(fp);
            return 1;
        }
    }

    fclose(fp);
    return 0;
}

I'll resolve the code over the next hour or two and make a pull request for @taylor to review.

@taylor identified the trouble code blocks as: ``` { FILE *fp = fopen(FILE_DB, "r"); if (fp) { char owner[64]; char fpath[PATH_MAX]; while (fscanf(fp, "%63s %1023s", owner, fpath) == 2) { if (file_owned_by_other(pkg, fpath)) { fprintf(stderr, "file conflict: %s owned by %s\n", fpath, owner); fclose(fp); return 1; } } fclose(fp); } } ``` and also in this block ``` static int file_owned_by_other(const char *pkg, const char *path) { FILE *fp = fopen(FILE_DB, "r"); if (!fp) return 0; char owner[64]; char fpath[PATH_MAX]; while (fscanf(fp, "%63s %1023s", owner, fpath) == 2) { if (!strcmp(fpath, path) && strcmp(owner, pkg)) { fclose(fp); return 1; } } fclose(fp); return 0; } ``` I'll resolve the code over the next hour or two and make a pull request for @taylor to review.
Author
Owner
Resolved and merged in [https://forge.dnsrail.org/vulpinelinux/vpm/pulls/2](https://forge.dnsrail.org/vulpinelinux/vpm/pulls/2)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vulpinelinux/vpm#1
No description provided.