In GNU tar version 1.25, the info script executed at end-of-volume for a
multi-volume archive fails. Compiled for Ubuntu Linux, running in a bash
shell on Ubuntu 11.10. The file descriptor stored in the TAR_FD
environment variable is eventually assigned an invalid number, making
the script fail and stopping the archiving process. The exact error is:

efe@pegasus:/media/mount2$ cat ascts.err
./ascts.newvolume: 12: Syntax error: Bad fd number
/bin/tar: `ascts.newvolume' command failed
/bin/tar: Error is not recoverable: exiting now

Here is a copy of the info-script file, modified slightly from the
example on the tar info page.

#! /bin/sh
echo "Preparing volume $TAR_VOLUME of $TAR_ARCHIVE (fd=$TAR_FD)."

name=`expr "$TAR_ARCHIVE" : '\(.*\)-.*'`
case $TAR_SUBCOMMAND in
-c)       ;;
-d|-x|-t) test -r "${name:-$TAR_ARCHIVE}-$TAR_VOLUME" || exit 1
          ;;
*)        exit 1
esac

echo "${name:-$TAR_ARCHIVE}-$TAR_VOLUME" >&$TAR_FD

Workaround: I modified the script to use a different shell (bash) so,
when TAR_FD becomes larger than a single digit, redirection will still
work. The problem is that sh uses single-digit file descriptors only;
other shells may allow file descriptors > 9. If they don't, the "syntax
error" will stop the archive process as it did with me.

My suggestion is adding a comment to the sample script stating that it
may not work in sh if TAR_FD > 9, or to use a shell that allows it.

--
Cordially,
Edward F Eaglehouse
SunCat Services


Reply via email to