Panu Matilainen de6dc7
From cbcd9dd38dd1d0379e5d25ed3c1b1e96353e4014 Mon Sep 17 00:00:00 2001
Panu Matilainen de6dc7
Message-Id: <cbcd9dd38dd1d0379e5d25ed3c1b1e96353e4014.1651130985.git.pmatilai@redhat.com>
Panu Matilainen de6dc7
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen de6dc7
Date: Thu, 28 Apr 2022 10:17:16 +0300
Panu Matilainen de6dc7
Subject: [PATCH] Fix regression in rubygem unpacking (#2040)
Panu Matilainen de6dc7
Panu Matilainen de6dc7
Externalizing the source unpack in commit
Panu Matilainen de6dc7
cd5d667e99f931504a512b591fcde7ed92cee344 required changing the way
Panu Matilainen de6dc7
rubygems are unpacked, and now the .gemspec file gets unpacked into
Panu Matilainen de6dc7
different place. Oops. Reported and initial patch by Vit Ondruch.
Panu Matilainen de6dc7
Panu Matilainen de6dc7
Fixes: #2040
Panu Matilainen de6dc7
---
Panu Matilainen de6dc7
 tools/rpmuncompress.c | 5 +++--
Panu Matilainen de6dc7
 1 file changed, 3 insertions(+), 2 deletions(-)
Panu Matilainen de6dc7
Panu Matilainen de6dc7
diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c
Panu Matilainen de6dc7
index 609fb0f53..55aac4c44 100644
Panu Matilainen de6dc7
--- a/tools/rpmuncompress.c
Panu Matilainen de6dc7
+++ b/tools/rpmuncompress.c
Panu Matilainen de6dc7
@@ -97,12 +97,13 @@ static char *doUntar(const char *fn)
Panu Matilainen de6dc7
 	if (needtar) {
Panu Matilainen de6dc7
 	    rasprintf(&buf, "%s '%s' | %s %s -", zipper, fn, tar, taropts);
Panu Matilainen de6dc7
 	} else if (at->compressed == COMPRESSED_GEM) {
Panu Matilainen de6dc7
-	    size_t nvlen = strlen(fn) - 3;
Panu Matilainen de6dc7
+	    const char *bn = basename(fn);
Panu Matilainen de6dc7
+	    size_t nvlen = strlen(bn) - 3;
Panu Matilainen de6dc7
 	    char *gem = rpmGetPath("%{__gem}", NULL);
Panu Matilainen de6dc7
 	    char *gemspec = NULL;
Panu Matilainen de6dc7
 	    char gemnameversion[nvlen];
Panu Matilainen de6dc7
 
Panu Matilainen de6dc7
-	    rstrlcpy(gemnameversion, fn, nvlen);
Panu Matilainen de6dc7
+	    rstrlcpy(gemnameversion, bn, nvlen);
Panu Matilainen de6dc7
 	    gemspec = rpmGetPath("", gemnameversion, ".gemspec", NULL);
Panu Matilainen de6dc7
 
Panu Matilainen de6dc7
 	    rasprintf(&buf, "%s '%s' && %s spec '%s' --ruby > '%s'",
Panu Matilainen de6dc7
-- 
Panu Matilainen de6dc7
2.35.1
Panu Matilainen de6dc7