Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
patchmanagerobject.cpp: bugfix in doRefreshPatchList() about path
Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
  • Loading branch information
robang74 committed Jul 2, 2023
1 parent 8b7197c commit f247da6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/bin/patchmanager-daemon/patchmanagerobject.cpp
Expand Up @@ -1666,6 +1666,10 @@ void PatchManagerObject::doRefreshPatchList()
}
}

/* *****************************************************************************
* RAF: patch -p1 works with absolute path /path and relative path new|old/path.
* Bug to fix in this code: /usr/bin/newfile -> /newfile which is wrong.
*
while (!QFileInfo::exists(path) && path.count('/') > 1) {
path = path.mid(path.indexOf('/', 1));
}
Expand All @@ -1676,6 +1680,15 @@ void PatchManagerObject::doRefreshPatchList()
path = toPatch.mid(toPatch.indexOf('/', 1));
}
}
*
* Bug fixing: a simple approch considers the absolute /path always fine
* and the relative new|old/path always to strip the head/.
*
*/ if (!toPatch.startsWith(QChar('/'))) {
path = "/" + toPatch.mid(toPatch.indexOf('/', 1));
}
/* RAF: end of bugfix ******************************************************* */

if (!filesConflicts[path].contains(patchFolder)) {
qDebug() << Q_FUNC_INFO << "Possible conflict in: " << path;
filesConflicts[path].append(patchFolder);
Expand Down

0 comments on commit f247da6

Please sign in to comment.