Kristýna Streitová <[email protected]> wrote:

> We bumped into a potential bug in spax. According to the manual, spax 
> should support backreferences with the '-s' option:
>
> <quoting from spax manual>
> -s replstr
> (...)
> The format shall be:
>       -s /old/new/[gp]
> where  as  in  ed,  old is a basic regular expression and new can 
> contain an ampersand, '\n' (where n is a digit) backreferences, or 
> subexpression matching.
> (...)
> </quoting from spax manual>

This is text used from the POSIX standard.

> But it seems that backreferences are not working/supported. We also 
> tested the same with the old pax and it's working there.
>
>
> Steps to reproduce:
> -------------------
> 1) Create a working dir and move to it.
> # mkdir ptar
> # cd ptar
>
> 2) Create a 3 level dir structure and put some files in the lowest level:
> # mkdir -p dir1/{sdi1,sdi2}/cfg
> # touch dir1/{sdi1,sdi2}/cfg/fich.cfg
>
> 3) Create a package with the files we've created:
> # tar czvf ptar.tgz dir1/
>
> 4) Now we want the files to be placed in a different path, and instead 
> of having 3 subdirectory levels place them in 2, the 2nd's gonna be a 
> concatenation of the 2nd and 3rd level subdirectory names.
>
> 4a) With old pax it works:
> # pax -z -v -f ptar.tgz -s ',dir1/\([^/]*\)/\([^/]*\),dir2/\1-\2,' *.cfg
> -rw-rw---- 1 ut06121 cargas 0 Apr 20 12:24 dir2/sdi1-cfg/fich.cfg
> -rw-rw---- 1 ut06121 cargas 0 Apr 20 12:24 dir2/sdi2-cfg/fich.cfg
>
> 4b) With the latest spax it doesn't:
> # spax -z -v -f ptar.tgz -s ',dir1/\([^/]*\)/\([^/]*\),dir2/\1-\2,' *.cfg
> -rw-r--r-- 0 ut06121 integ 0 Apr 20 12:30 dir1/sdi1/cfg/fich.cfg
> -rw-r--r-- 0 ut06121 integ 0 Apr 20 12:30 dir1/sdi2/cfg/fich.cfg
>
>
> Can you please help here? Are we missing something?

Star did support this feature in the 1980s already when the UNIX platforms did 
not even have a uniform pattern matcher in their libc.

As a result, this feature was implemented based on the pattern matcher from

 Martin Richards from: 
 
      "A Compact Function for Regular Expression Pattern Matching", 
      Software-Practice and Experience, Vol. 9, 527-534 (1979) 

There is however not yet support for () grouping and \# references.
 
This and the current implementation of -o in spax are not yet fully POSIX 
compliant, but e.g. the ony -o implementation that is POSIX compliant is 
currently in the closed source pax from Solaris/AIX/HP-UX.

Both are on my to-do list.

Are you planning to replace another pax imlementation by spax and need specific 
features?

Do you know about a library implementation for this substition method?

BTW: please register for the mailing list.

Jörg

-- 
 EMail:[email protected]                    (home) Jörg Schilling D-13353 Berlin
    [email protected] (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'


_______________________________________________
S-tar-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s-tar-developers

Reply via email to