star/sfind The Marriage of two powerful programs
Joerg Schilling <[email protected]> Wed, 02 Nov 2005 00:16:41 +0100
| Newsgroups | gmane.comp.archivers.star.user |
|---|---|
| Message-ID | <4367F759.nailIO111BI7O@burner> |
Two powerfull programs (star & sfind) announce their marriage that results in a feature enhanced star. This code integration was originally planned for the star-1.6 development cycle, but it turned out that it is possible to implement a subset of the full set of features without causing any harm to the rest of the code as long as the find code is not actually used. To the beginning of the 1980's, AT&T included a simplified cpio implementation to find(1) but this venture did not result in added value (there was only a minor speed up by avoiding a second stat(2) for every file) and the cpio archive format is outdated since a while. As a sice effect, the functionality of the find(1) program is now available as a library implementation. BTW: Although the sfind(1) source is written more cleanly than the UNIX find(1) source, it did take more time to create the library code from the original sfind(1) source than it took to write sfind from scratch. The integrated find code has been enhanced compared to the standard sfind(1) code by the following primary operators: -chgrp <gname> The primary always evaluates as true; it sets the group of the file to gname. -chmod <mode> The primary always evaluates as true; it sets the permissions of the file to mode. Octal and sym- bolic permissions are accepted for mode as with chmod(1). Note that this version of star does not yet implement the 'X' character from chmod(1), but uture versions of star will add support for 'X' permission mods. Meanwhile you could use something like: star -c -find . ( -type d -chmod a=rx -o -chmod a=r ) -chown <uname> The primary always evaluates as true; it sets the owner of the file to uname. -false The primary always evaluates as false; it allows to make the result of the full expression dif- ferent from the result of a part of the expres- sion. -true The primary always evaluates as true; it allows to make the result of the full expression different from the result of a part of the expression. The first three operators allow to modify the file meta data between the time when star fetches the meta data from the filesystem or from the archive and the time when star evaluates the file meta data while adding the file to the archive or extracting the file to the filesystem. The last two operators make it more convenient to use find(1) expressions to control an archiver like star. The basic idea behind the find(1) integration is: Define a find expression and let star evaluate the expression for every file as the first possible "filter" operation. If the "find expression" returns TRUE for the current file, this file is either archived, extracted, diffed or listed as usual. If the "find expression" returns FALSE for the current file, the file is skipped. Note that the find primaries -chgrp/-chown/-chmod modify the file meta data as a side effect. New option -find acts as a separator between the "star" command line interface and the "sfind" command line interface. To the left of the -find option, star accepts well known star options from the past. To the right of the -find option, star expects a list of path names followed by a find(1) expression. As with future star-1.6 versions of star, star will allow more new features, it is possible to omit the find(1) expression. This results in the same behavior as if star ... -find <path list> -true had been specified. For more information, check the star and the sfind man page. Star intermediate -find implementation currently suffers from the following problems: - If the archive is stdin or stdout, star redefines stdin or stdout. As 'find -exec ...' propagates stdin/stdout/stderr to the called program, this causes unplanned problems. - If the archive is stdout, star redefines stdout. As 'find -print', 'find -printnnl' and 'find -ls' outputs to stdout, this also caused unplanned problems. - Find primaries like '-linkedto' cannot be implemented in extract/list mode as they need to wo preparation work on the local filesystem that cannot be converted to work on an archive. - find options like -H -L -P are not yet implemented in star -find mode ftp://ftp.berlios.de/pub/star/alpha/star-1.5a69.tar.bz2 Jörg -- EMail:[email protected] (home) Jörg Schilling D-13353 Berlin [email protected] (uni) [email protected] (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily