[mod.computers.vax] Tar Reader & Bug

PENSTONE@QUCDNEE1.BITNET (Sid Penstone) (01/12/87)

(1)     Several people who recently asked me for a copy of our Tar Reader
may be wondering why they haven't heard from me: it appears that some
of the copies were undeliverable for a variety of reasons. Please ask
again, and I will try again. If you have an alternate address on a different
network, let me have that.

(2)     Quite a few people have copies of a Tar-to-VMS converter I sent them
by E-mail; my mailer has had some trouble getting the following bug-fix
note to several of them, so I would like to post it on info-vax, if I can:

        There is a bug in the function make_new() in the tar-to-vms
conversion program (Version 2.2 and earlier) that will cause it to bomb
or hang if the file on the tar tape is at the top level (i.e. no directory
path). The string 'name' in the function will have garbage in it.
        The fix is thanks to Ursula Meyer zu Natrup (natrup@vax.hmi.dfn)
in Germany, and consists of moving a  } bracket from its present position
to another:

        The code in make_new() reads:
                ...
         if (end != NULL)
            {
                ...
                ...
                ...
                strcat(name,a);
            }                                                   /* !!!! */

         if (access(name,0) < 0)        /* Does the directory exist ? */
            {
                ...
                ...
                ...
            return (0);
            }                                                   /* !!!! */
        return(0);
}

To fix it, the test for (end != NULL) should include both compound statements:

        Move the right brace } following the line "strcat(name,a);"
        to below the right brace } above the second "return(0)" line.
        The lines are indicated by the /* !!!! */ comments above.
        This forces an exit,if there is no '.' in the pathname,
        and writes the file in the current default directory.
        The source code can be cleaned up by indenting the code correctly.

Sid Penstone,
VLSI Group,
Dept. of Electrical Engineering,
Queen's University, Kingston, Ontario, Canada.

PENSTONE@QUCDNEE1.BITNET