Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Lachu:SystemServices
Lachu-PackageKit
0012-Repair-many-bugs-related-to-communication-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0012-Repair-many-bugs-related-to-communication-between-zy.patch of Package Lachu-PackageKit
From fab1b023b32bec5e0e6ab2d76de719a2cd2d7e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl> Date: Tue, 6 Oct 2020 20:20:03 +0200 Subject: [PATCH 12/46] - Repair many bugs related to communication between zypp backend and tool to solving dependency --- backends/zypp/pk-backend-zypp.cpp | 4 -- helpers/dependency-solving-helper.cpp | 54 +++++++++++++++++---------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp index 0d407d10a..4d7a121d6 100644 --- a/backends/zypp/pk-backend-zypp.cpp +++ b/backends/zypp/pk-backend-zypp.cpp @@ -2429,18 +2429,14 @@ zypp_perform_execution (PkBackendJob *job, ZYpp::Ptr zypp, PerformType type, gbo for (it = transaction_problems.problems.begin(); it != transaction_problems.problems.end(); ++it) { string = (*it)->description ().c_str (); - puts(string); write(output, string, strlen(string)+1); for (sol_it = (**it).solutions().begin(); sol_it != (**it).solutions().end(); ++sol_it) { string = (*sol_it)->description ().c_str (); - puts(string); write(output, string, strlen(string)+1); string = (*sol_it)->details ().c_str (); - puts(string); write(output, string, strlen(string)+1); - write(output, "", sizeof("")); } write(output, "", sizeof("")); diff --git a/helpers/dependency-solving-helper.cpp b/helpers/dependency-solving-helper.cpp index f2f33048a..a595c6134 100644 --- a/helpers/dependency-solving-helper.cpp +++ b/helpers/dependency-solving-helper.cpp @@ -8,23 +8,26 @@ static char *get_record(int fd) { static char *buffer = NULL; - static int curr = 0; + static int curr_old = 0; static int loaded = 0; + static int buff_len = 0; int count = 0; - int buff_len = 0; bool done = false; - int curr2 = curr; + int curr = 0; + int curr2 = curr_old; + while (loaded >= curr2 + 1) { - ++curr2; if ('\0' == buffer[curr2]) { - curr = curr2; - return &buffer[curr2+1]; + curr = curr_old ; + curr_old = curr2 + 1; + return &buffer[curr]; } + ++curr2; } buff_len += 512; @@ -35,7 +38,7 @@ static char *get_record(int fd) return NULL; } - while ((count = read(fd, buffer, buff_len - 1 - loaded)) > 0) { + while ((count = read(fd, &buffer[loaded], buff_len - 1 - loaded)) > 0) { curr = loaded; @@ -69,9 +72,11 @@ static char *get_record(int fd) return NULL; } - //buffer[loaded] = '\0'; + buffer[loaded] = '\0'; - return buffer; + curr2 = curr_old; + curr_old = curr + 1; + return &buffer[curr2]; } @@ -97,17 +102,22 @@ static bool show_solutions(int fd) while ((buffer = get_record(fd)) && ('\0' != buffer[0])) { - puts(buffer); text = xmlNewText(BAD_CAST buffer); xmlAddChild(form, text); + + text = xmlNewNode(NULL, BAD_CAST "br"); + xmlAddChild(form, text); + while ((buffer = get_record(fd)) && ('\0' != buffer[0])) { - puts("A"); - puts(buffer); checkbox = xmlNewNode(NULL, BAD_CAST "checkbox"); - text = xmlNewText(BAD_CAST buffer); + + char *prev = buffer; + char *curr = buffer; + + text = xmlNewText(BAD_CAST prev); xmlAddChild(checkbox, text); xmlAddChild(form, checkbox); @@ -122,10 +132,11 @@ static bool show_solutions(int fd) if ('\n' == *curr) { *curr = '\0'; + text = xmlNewText(BAD_CAST prev); - xmlAddChild(form, text); + xmlAddChild(checkbox, text); text = xmlNewNode(NULL, BAD_CAST "br"); - xmlAddChild(form, text); + xmlAddChild(checkbox, text); prev = curr + 1; } @@ -135,6 +146,7 @@ static bool show_solutions(int fd) text = xmlNewText(BAD_CAST prev); xmlAddChild(checkbox, text); + } length = snprintf(NULL, 0, "%d_%d", problem, solution) + 1; buffer = (char*) malloc(length); snprintf(buffer, length, "%d_%d", problem, solution); @@ -142,11 +154,14 @@ static bool show_solutions(int fd) xmlSetProp(checkbox, BAD_CAST "name", BAD_CAST buffer); buffer = NULL; - } ++solution; - - } + + text = xmlNewNode(NULL, BAD_CAST "br"); + xmlAddChild(form, text); + } + text = xmlNewNode(NULL, BAD_CAST "br"); + xmlAddChild(form, text); ++problem; } @@ -490,8 +505,7 @@ int main(int argc, char **argv) puts(error.message); goto exit; } - -#if 1 +#if 1 dup_0 = dup(0); dup_1 = dup(1); dup_2 = dup(2); -- 2.32.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor