[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
--transform bug with match numbers
From: |
Anthony Heading |
Subject: |
--transform bug with match numbers |
Date: |
Sun, 11 Jul 2021 01:48:44 +0000 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-531-g1160beca77-fm-20210705.001-g1160beca |
Hi,
I believe this is a small bug in the filename transformation option.
Assuming that /etc/passwd exists, and trying to change the second letter 's' to
'@':
tar cf - /etc/passwd | tar tf - --transform='s:s:@:2' --show-transformed-names
tar: Removing leading `/' from member names
etc/paetc/pas@wd
A simple reordering of the code produces the expected result 'etc/pas@wd'
Anthony
diff --git a/src/transform.c b/src/transform.c
index 2b60235..2cc927e 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -493,9 +493,6 @@ _single_transform_name_to_obstack (struct transform *tf,
char *input)
disp = rmp[0].rm_eo;
- if (rmp[0].rm_so)
- obstack_grow (&stk, input, rmp[0].rm_so);
-
nmatches++;
if (tf->match_number && nmatches < tf->match_number)
{
@@ -504,6 +501,9 @@ _single_transform_name_to_obstack (struct transform *tf,
char *input)
continue;
}
+ if (rmp[0].rm_so)
+ obstack_grow (&stk, input, rmp[0].rm_so);
+
for (segm = tf->repl_head; segm; segm = segm->next)
{
switch (segm->type)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- --transform bug with match numbers,
Anthony Heading <=