[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] tar bug 1.25 info-script TAR_FD
From: |
Edward F Eaglehouse |
Subject: |
[Bug-tar] tar bug 1.25 info-script TAR_FD |
Date: |
Mon, 13 Feb 2012 22:23:12 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111229 Thunderbird/9.0 |
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:
address@hidden:/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
- [Bug-tar] tar bug 1.25 info-script TAR_FD,
Edward F Eaglehouse <=