Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: othersrc/external/bsd/mat



Module Name:    othersrc
Committed By:   agc
Date:           Sat Jun 18 04:53:13 UTC 2011

Update of /cvsroot/othersrc/external/bsd/mat
In directory ivanova.netbsd.org:/tmp/cvs-serv4946

Log Message:
Initial import of mat into othersrc.

mat is an archiver program (the "minimalist archiving tool" program),
similar to tar or pax, but holding digests of the individual
components in the archive (right now, these are sha256 digests).  in
addition, mat has been designed to have no arbitrary restrictions on
sizes of meta-data fields, or of data itself.  it holds linked files
internally as efficiently as possible, and displays these linked files
in a manner analogous to ls(1) for a symbolic link. 

mat is a tar-like frontend for libmat(3). a pax-like frontend is also
under development. if i could work out cpio syntax, i might write a
cpio-like frontend.

there is a separate mat_verify() function exposed in the library, and
it will perform sanity and integral validity checks on an archive that
is presented to it.  internally, every archive is validated before any
listing or extraction can take place.  no filenames which start with
'/' are allowed, neither is any filename containing a "/../" string.

because mat is intended to be used as part of a layered solution, mat
does not include any compression, since it is usually much more
efficient to construct the archive itself, and then to compress the
whole archive, since there are "economies of scale" here.

mat also includes no signing facility, but has been designed to be
layered underneath such a signing program - by signing an inventory of
a mat archive, with the sha256 digests in the inventory, it would be
difficult to modify any part of the archive and still have a valid
signature on the archive.

the obligatory examples follow:

% cp /etc/group group
% ln -s Makefile m
% mat cvf archive.mat group m /etc/group
can't stat './etc/group'
% mat tf archive.mat
group
m
% mat tvf archive.mat
-rw-r--r--  1 agc  agc    510 Jun 16 18:27 group
lrwxr-xr-x  1 agc  agc      8 Jun 16 18:27 m -> Makefile
% mat tvvf archive.mat
-rw-r--r--  1 agc  agc    510 Jun 16 18:27 
d8008905d91a083115b2fb8bd469a36a94f07f9cafeb88c17a44add769d3c0a0 group
lrwxr-xr-x  1 agc  agc      8 Jun 16 18:27 
7a6378e1ee1f9098b9fb5219e6bb2ae17df33230171ee5c2a56f0cc4335d5dfd m -> Makefile
%

an example of multiply-linked files in a mat archive:

% mat tvf a.mat
drwxr-xr-x  2 agc  agc    512 Jun 16 18:27 a
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 a/m1 == a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 a/m2 == a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 a/m3 == a/Makefile
% mat tvvf a.mat
drwxr-xr-x  2 agc  agc    512 Jun 16 18:27 
0000000000000000000000000000000000000000000000000000000000000000 a
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 
13bc52eeb726edc6298ac9a4d1ca2f4ccc79a8b62412c5c4ab210ffbfefe1e35 a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 
13bc52eeb726edc6298ac9a4d1ca2f4ccc79a8b62412c5c4ab210ffbfefe1e35 a/m1 == 
a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 
13bc52eeb726edc6298ac9a4d1ca2f4ccc79a8b62412c5c4ab210ffbfefe1e35 a/m2 == 
a/Makefile
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 
13bc52eeb726edc6298ac9a4d1ca2f4ccc79a8b62412c5c4ab210ffbfefe1e35 a/m3 == 
a/Makefile
% mat tvvf a.mat '*/*3'
-rw-r--r--  4 agc  agc   1827 Jun 16 18:27 
13bc52eeb726edc6298ac9a4d1ca2f4ccc79a8b62412c5c4ab210ffbfefe1e35 a/m3 == 
a/Makefile
%

archives can be read from stdin, and written to stdout, and there
are checks to make sure we don't try to include the mat archive when
generating a new archive:

% mat tvvf - < archive2.mat
-rw-r--r--  1 agc  agc    510 Jun 16 18:27 
d8008905d91a083115b2fb8bd469a36a94f07f9cafeb88c17a44add769d3c0a0 group
lrwxr-xr-x  1 agc  agc      8 Jun 16 18:27 
7a6378e1ee1f9098b9fb5219e6bb2ae17df33230171ee5c2a56f0cc4335d5dfd m -> Makefile
% mat cvf archive2.mat group m archive2.mat /etc/group dir
ignoring attempt to add ourselves 'archive2.mat'
can't stat './etc/group'
can't stat 'dir'
% mkdir d
% cd d && mat xvf ../archive.mat
group
m
%

mat can also take its input from a template file, in the same format
as NetBSD's build.sh METALOG file.  The resulting mat archive uses the
uid and gid provided in the template file.  When extracting, using the
-p switch, the "original" uid and gid are used:

% cat dist/template 
./d type=dir uname=root gname=wheel
./d/group type=file uname=root gname=wheel mode=0644 size=510 
sha256=d8008905d91a083115b2fb8bd469a36a94f07f9cafeb88c17a44add769d3c0a0
./d/m type=link uname=root gname=wheel mode=0755 link=Makefile
% mat cvf matty -T dist/template
% mat tvvf matty
drwxr-xr-x  2 root  wheel    512 Jun 16 18:27 
0000000000000000000000000000000000000000000000000000000000000000 ./d
-rw-r--r--  1 root  wheel    510 Jun 16 18:27 
d8008905d91a083115b2fb8bd469a36a94f07f9cafeb88c17a44add769d3c0a0 ./d/group
lrwxr-xr-x  1 root  wheel      8 Jun 16 18:27 
7a6378e1ee1f9098b9fb5219e6bb2ae17df33230171ee5c2a56f0cc4335d5dfd ./d/m -> 
Makefile
% mkdir e
% cd e && sudo mat xvf ../matty -p
./d
./d/group
./d/m
% cd e && ls -ald d d/*
drwxr-xr-x  2 root  wheel  512 Jun 16 18:27 d
-rw-r--r--  1 root  wheel  510 Jun 16 18:27 d/group
lrwxr-xr-x  1 root  wheel    8 Jun 16 18:27 d/m -> Makefile
%

Status:

Vendor Tag:     CROOKS
Release Tags:   mat-base
                
N othersrc/external/bsd/mat/Makefile
N othersrc/external/bsd/mat/dist/Makefile
N othersrc/external/bsd/mat/dist/mat.c
N othersrc/external/bsd/mat/dist/mat.h
N othersrc/external/bsd/mat/dist/TODO
N othersrc/external/bsd/mat/dist/main.c
N othersrc/external/bsd/mat/dist/template
N othersrc/external/bsd/mat/dist/mat.1
N othersrc/external/bsd/mat/dist/libmat.3
N othersrc/external/bsd/mat/libmat/shlib_version
N othersrc/external/bsd/mat/libmat/Makefile
N othersrc/external/bsd/mat/mat/Makefile

No conflicts created by this import



Home | Main Index | Thread Index | Old Index