Re: How to get the filename of files in an archive correctly?

Stefan Hammerl via Dar-support <[email protected]>
Newsgroups gmane.comp.sysutils.backup.dar.support
Message-ID <CAA27OgRHUOK39ZiCvj9wftb014wX13Om7XnhGbBEvC+A0zNGpQ@mail.gmail.com>
Hello,

while using the XML output works very well I am getting validation errors.
I am validating against dar-catalog.dtd in catalog format version 1.2
(which I found here:
https://fossies.org/linux/privat/dar-2.7.0.tar.gz/dar-2.7.0/doc/dar-catalog.dtd?m=t)
. The parser complains about missing required attributes.
For example I have the following dar list output (of a differential archive):
<Catalog format="1.2">
</File>
<File name="&quot;
">
<Attributes data="deleted" metadata="absent" user="" group=""
permissions="" atime="" mtime="1620218204" ctime="" />
</File>
</Catalog>

and in the DTD:
[...]
<!ELEMENT File (Attributes)>
<!ATTLIST File name CDATA #REQUIRED>             <!-- string, entry
name             -->
<!ATTLIST File size CDATA #REQUIRED>             <!-- decimal, file
size in bytes    -->
<!ATTLIST File stored CDATA "" >                 <!-- decimal, stored
size in bytes  -->
<!ATTLIST File crc CDATA "" >                    <!-- hexadecimal, crc
sum of file   -->
<!ATTLIST File dirty CDATA #REQUIRED>            <!-- string, whether
file changed during backup -->
<!ATTLIST File sparse CDATA #REQUIRED>          <!-- string, whether
file is sparse -->
<!ATTLIST File delta_sig CDATA #REQUIRED>        <!-- string, whether
delta signature is present -->
<!ATTLIST File patch_base_crc CDATA "">          <!-- hexadecimal, crc
sum of the delta patch when present -->
<!ATTLIST File patch_result_crc CDATA "">        <!-- hexadecimal, crc
sum of the delta patch resulting file when present -->
[...]

Given these parameters the parser consequently complains about missing
attributes "size", "dirty", "sparse" and "delta_sig".

The easiest way for me to fix that as a workaround is to remove the
#required annotation in the DTD.

Best regards,
Stefan

Am Mi., 28. Apr. 2021 um 18:04 Uhr schrieb Stefan Hammerl
<stefanhammerl91-gM/[email protected]>:
>
> Thank you, that helps :).
>
> Am Di., 27. Apr. 2021 um 21:44 Uhr schrieb Denis Corbin <[email protected]>:
> >
> >
> > On 27/04/2021 18:59, Stefan Hammerl via Dar-support wrote:
> > > Hello,
> >
> > Hello,
> >
> > >
> > > currently I am using the dar --list command to get a list of files in
> > > the archive. Usually this works for parsing the output and extracting
> > > the filename.
> > > I am having problems if the file ends with a whitespace as the list
> > > command shows for example:
> > >
> > > [Data ][D][ EA  ][FSA][Compr][S]| Permission | User  | Group | Size
> > > |          Date                 |    filename
> > > --------------------------------+------------+-------+-------+---------+-------------------------------+------------
> > > [Saved][ ]       [-L-][     ][ ]  -rw-rw-r--   stefan  stefan 0
> > > Tue Apr 27 18:43:50 2021        spaceAtTheEnd
> > >
> > > 'spaceAtTheEnd     ' is a valid unix file name but there is no chance
> > > to get that via command line interface. Extraction of that file is
> > > working as expected.
> > >
> > > Is there a better way to get the filename?
> >
> > have you tried the XML output? (see -Txml option)
> >
> > >
> > >
> > > Best regards,
> > > Stefan
> > >
> > >
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.