https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293071

            Bug ID: 293071
           Summary: bsdtar -s pattern does not support delimiter quoting
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

I tried to add a prefix for a tarball. bsdtar has an option -s pattern.

     -s pattern
             Modify file or archive member names according to pattern.  The
             pattern has the format /old/new/[bghHprRsS] where old is a basic
             regular expression, new is the replacement string of the matched
             part, and the optional trailing letters modify how the
             replacement is handled

It works well except if I include a slash:

touch a.c b.c
bsdtar -cvf c.tar -s '/^/foobar/\/' a.c b.c
bsdtar: Invalid replacement flag /

After some trial and error I find out that you can use other delimiters, as '|'
or '#'

$ bsdtar -cvf c.tar -s '|^|foobar/|' a.c b.c
a foobar/a.c
a foobar/b.c

I don't know if this is intentional or worth fixing. At least we should
document the current behaviour in the manual page, and add an example.

E.g.:
---------------------
Note: you cannot quote the / delimiter. In that case use an other characters as
'|'
bsdtar -cvf c.tar -s '|^|new-dir/|' a.c b.c
---------------------

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to