[Rpm-maint] [rpm-software-management/rpm] rpmuncompress: Support -C for zip and 7zip archives (PR #3263)

Panu Matilainen notifications at github.com
Fri Aug 30 05:35:19 UTC 2024


@pmatilai commented on this pull request.



>  	    rasprintf(&stripcd, " -C '%s' %s", dstpath, sr ? "--strip-components=1" : "");
+	else {
+	    char * moveup;
+	    if (sr)
+		rasprintf(&moveup, " ; tmp=`mktemp -u -p'%s'` ; mv %s/%s $tmp ; (shopt -s dotglob; mv $tmp/* %s) ; rmdir $tmp ", dstpath, dstpath, sr, dstpath);

We know the name of the directory the archive will create, we shouldn't need any globs here? Make a temporary directory, use that as the target directory to extract to (since all the relevant commands seem to support such an option), then rename to the intended location and remove the tmpdir? Assuming that's workable, we could use the same thing for tar and avoid using separate logic for it and the GNU specific --strip-components option. (Updating the tar to use the newly added field was implied in my comment in the ticket, sorry it wasn't entirely clear - always assuming it's possible, BUT our assumptions didn't exactly hold here)

This is all pretty hard to follow though, if we need a shell script then maybe we should write one, or at least make it move obvious by eg placing it in a multiline string section that *looks* like a shell script to begin with :sweat_smile: 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3263#pullrequestreview-2271220291
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3263/review/2271220291 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240829/a45a8dbd/attachment.html>


More information about the Rpm-maint mailing list