• Bug#265879: afio: Missing nullbyte separator for filelists and missing

    From Christian Schrader@1:229/2 to All on Sun Aug 15 16:50:08 2004
    From: [email protected]

    Package: afio
    Version: 2.5-2
    Severity: wishlist
    Tags: patch



    -- System Information
    Debian Release: 3.0
    Architecture: i386
    Kernel: Linux loba 2.6.7 #2 Wed Jun 16 12:23:14 CEST 2004 i686
    Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro

    Versions of packages afio depends on:
    ii libc6 2.2.5-11.5 GNU C Library: Shared libraries an


    Hi,

    afio is able to use a nullbyte as separator for building the archive
    (find ... -print0 | afio -o -0 ... ) but it is not possible to rebuild a filelist out of the archive via "afio -t ..." with using a nullbyte
    separator. If you got a filename with newlines the filelist contains
    invalid filenames. I think it should be possible to use -0 also in
    conjuction with -t (and may be other functions).

    The second problem is that it is impossible to tell afio the exact names
    for which files it should fetch from an archive. eg. If i use "-w filelist"
    all names are used as glob patterns so that I can't simply use entries
    of the archive toc als filelist. A filename like '/www/*html' would
    extract all files which end on 'html' under /www. And it is not easy to
    quote all possible chars to prevent globbing. Patterns which contains
    newlines are impossible.

    The following patch adds two switches:

    -0 all entries in filelist use \0 as delimiter. "afio -t -0" generates
    a filelist with this delimiter instead of \n. If a patternfile is
    used with -w or -W it has to use \0 as delimiter.

    -7 this disables globbing so that it is possible to use -w to specify
    a filelist for which files to extract

    This patch is just an example (sorry but I can't program). It is
    possible that it breakes other functions and contains thousands of bugs. :)

    I think afio should be robust against strange filenames because all
    characters beside / and \0 are allowed in filenames especially when it
    is used as backup backend. The is no reason to use -0 only for building
    the archive and not for restoring the files.

    regards,
    Christian Schrader


    ---------------------- afio-nullbyte-globbing.patch ----------------------
    diff -u afio-2.5.orig/afio.c afio-2.5/afio.c
    --- afio-2.5.orig/afio.c Sun Aug 15 01:08:52 2004
    +++ afio-2.5/afio.c Sun Aug 15 13:21:37 2004
    @@ -309,6 +309,7 @@
    STATIC Dir *DirP=NULL; /* list of directories with their saved timestamps */
    STATIC char firstfilename[PATHSIZE]=""; /* for temp storage during -o */
    STATIC int useoutmodetoc=0; /* used in tocentry() */
    + STATIC short noglob=0; /* disable globbing */

    int main (int ac, char **av)
    {
    @@ -343,7 +344,7 @@
    */

    while ((c = options (ac, av,
    - "aioprtIOVCb:c:de:fghjklmns:uvxXy:Y:zFKZL:R:qAE:G:M:w:W:T:SBD:P:Q:U4JH:0@:N:3:1:92:56:"))
    + "aioprtIOVCb:c:de:fghjklmns:uvxXy:Y:zFKZL:R:qAE:G:M:w:W:T:SBD:P:Q:U4JH:0@:N:3:1:92:56:7"))
    )
    {
    switch (c)
    @@ -437,6 +438,9 @@
    case 'n':
    ++nflag;
    break;
    + case '7':
    + noglob = 1;
    + break;
    case 's':
    /* Do a 'dry run' to check all values for syntax errors */
    aruntil_string = strdup(optarg);
    @@ -4481,8 +4485,12 @@
    if (ISCONTROL(asb))
    res = printf("//--%s