dcavalca / rpms / rpm

Forked from rpms/rpm a year ago
Clone
Florian Festi b86572
From c140768202e271b60910644c1e4bf848a50218d3 Mon Sep 17 00:00:00 2001
Florian Festi b86572
From: Panu Matilainen <pmatilai@redhat.com>
Florian Festi b86572
Date: Mon, 27 Nov 2023 11:52:34 +0200
Florian Festi b86572
Subject: [PATCH] Emit full paths for file disposition diagnostics on
Florian Festi b86572
 --fsmdebug
Florian Festi b86572
Florian Festi b86572
The full path is visible in the actual file operations later, but the
Florian Festi b86572
pre-flight disposition diagnostics is unreadable without the full path.
Florian Festi b86572
This regressed in the switch to relative paths for the *at() API family
Florian Festi b86572
for the symlink CVE fixes.
Florian Festi b86572
---
Florian Festi b86572
 lib/fsm.c | 12 ++++++------
Florian Festi b86572
 1 file changed, 6 insertions(+), 6 deletions(-)
Florian Festi b86572
Florian Festi b86572
diff --git a/lib/fsm.c b/lib/fsm.c
Florian Festi b86572
index 091e90554..fcd764648 100644
Florian Festi b86572
--- a/lib/fsm.c
Florian Festi b86572
+++ b/lib/fsm.c
Florian Festi b86572
@@ -482,14 +482,14 @@ static void removeSBITS(int dirfd, const char *path)
Florian Festi b86572
     }
Florian Festi b86572
 }
Florian Festi b86572
 
Florian Festi b86572
-static void fsmDebug(const char *fpath, rpmFileAction action,
Florian Festi b86572
+static void fsmDebug(const char *dn, const char *fpath, rpmFileAction action,
Florian Festi b86572
 		     const struct stat *st)
Florian Festi b86572
 {
Florian Festi b86572
-    rpmlog(RPMLOG_DEBUG, "%-10s %06o%3d (%4d,%4d)%6d %s\n",
Florian Festi b86572
+    rpmlog(RPMLOG_DEBUG, "%-10s %06o%3d (%4d,%4d)%6d %s%s\n",
Florian Festi b86572
 	   fileActionString(action), (int)st->st_mode,
Florian Festi b86572
 	   (int)st->st_nlink, (int)st->st_uid,
Florian Festi b86572
 	   (int)st->st_gid, (int)st->st_size,
Florian Festi b86572
-	    (fpath ? fpath : ""));
Florian Festi b86572
+	    (dn ? dn : ""), (fpath ? fpath : ""));
Florian Festi b86572
 }
Florian Festi b86572
 
Florian Festi b86572
 static int fsmSymlink(const char *opath, int dirfd, const char *path)
Florian Festi b86572
@@ -910,7 +910,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
Florian Festi b86572
 		      (fp->sb.st_nlink == 1 || fp->action == FA_TOUCH);
Florian Festi b86572
 
Florian Festi b86572
 	setFileState(fs, fx);
Florian Festi b86572
-	fsmDebug(fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
+	fsmDebug(rpmfiDN(fi), fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
 
Florian Festi b86572
 	fp->stage = FILE_PRE;
Florian Festi b86572
     }
Florian Festi b86572
@@ -975,7 +975,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
Florian Festi b86572
 		rpmlog(RPMLOG_DEBUG, "file %s vanished unexpectedly\n",
Florian Festi b86572
 			fp->fpath);
Florian Festi b86572
 		fp->action = FA_CREATE;
Florian Festi b86572
-		fsmDebug(fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
+		fsmDebug(rpmfiDN(fi), fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
 	    }
Florian Festi b86572
 
Florian Festi b86572
 	    /* When touching we don't need any of this... */
Florian Festi b86572
@@ -1138,7 +1138,7 @@ int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfiles files,
Florian Festi b86572
 
Florian Festi b86572
 	rc = fsmStat(di.dirfd, fp->fpath, 1, &fp->sb);
Florian Festi b86572
 
Florian Festi b86572
-	fsmDebug(fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
+	fsmDebug(rpmfiDN(fi), fp->fpath, fp->action, &fp->sb);
Florian Festi b86572
 
Florian Festi b86572
 	/* Run fsm file pre hook for all plugins */
Florian Festi b86572
 	rc = rpmpluginsCallFsmFilePre(plugins, fi, fp->fpath,
Florian Festi b86572
-- 
Florian Festi b86572
2.43.0
Florian Festi b86572