LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   tar error in shell script (https://www.linuxquestions.org/questions/programming-9/tar-error-in-shell-script-497423/)

fanoliv 10-31-2006 11:38 PM

tar error in shell script
 
Hi everyone. I hope this is the appropriate forum.

I was trying to run a shell script to install some software. (I didn't write script and really don't know anything much about shell scripting, unfortunately.) There's a part in the script where it's tryting to uncompress some files using for loops. But every iteration of the loops resulted in the error below, and no file gets uncompressed. Can anyone please tell me what might be the problem here? Thanks.

Quote:

tar: dynamic-link.h:57: elf_get_dynamic_info: Assertion `! "bad dynamic tag"' failed.
./install.sh: line 228: 3241 Aborted tar -C ${INSTALL_DIR} -${BZIPOPT}xpf $x
PS: I'm using Fedora Core 5.

jschiwal 10-31-2006 11:59 PM

The error sounds more like a problem with the .tar.bz file or the tar command itself.

One thing about the line I noticed:
Aborted tar -C ${INSTALL_DIR} -${BZIPOPT}xpf $x
The "x" option is for extracting, the "p" option is to preserve permissions. The "f" option precedes the file you want to untar. The error variable BZIPOPT sounds like it is options for bzip2. However the bzip2 compression option is "j" but I don't see it. Try sourcing the script so that you can find out what the value of BZIPOPT is. If it doesn't contain the letter "j" then you may need to add it somewhere. You can also use the "find" command to examine the tarball and find out if it indeed used bzip2 compression.

fanoliv 11-01-2006 12:17 AM

The BZIPOPT value is below. Do I have to add the j option in this case? The files to be uncompressed are .tar.bz2 files. So hopefully they are really bzip2.

BZIPOPT='-use-compress-program=bunzip2 -'

jschiwal 11-01-2006 11:44 PM

The particular error itself looks like it is coming from tar or a library that tar uses. But an assertion could be from an illegal input to a routine.

Your line would expand to something like:
tar -C /usr/local/bin --use-compress-program=bunzip2 -xpf tarball.tar.bz2

This command line is OK. The dash at the end of $BZIPOPT threw me off for a second. However it expands to the dash in 'xpf'. If compression wasn't used and BZIPOPT was empty, then the line would be like:
tar -C /usr/local/bin xpf tarball.tar.bz2
which is also OK. Tar was written before the convention on arguments.

If $INSTALL_DIR is an existing directory and $x is the name of a tarball, then this command looks correct. I had never used that long option and tried it out to make sure. I used bzip2 during compression and bunzip2 when extracting and it was successful.

---

What is this script you are trying to run? Is it an autoconf generated "configure" script? If so, and there is a configure.ac file present, you might try running autoconfig to recreate a new configure file. Also, running "ldconf" as root may update your library paths.

--

I downloaded the tar source code. There isn't a dynamic_link.h in the code, but perhaps it is loaded by another included file.

fanoliv 11-04-2006 03:52 AM

Thank you very much for your help. The part about the config file is way over my head, I'm afraid. But I definitely need an attitude like yours to become a better programmer.

In any case, the script I was trying to run was for the RTLinuxPro installation. So I really had no idea why it wouldn't work since supposedly the company should have tested it. But since I was having so much problem with that version, I went and got another newer version that I've been able to install and boot successfully. Now that that's over with, I just have to figure out what exactly I'm gonna do for my final project. ;)

Thank you very much for your help.


All times are GMT -5. The time now is 08:51 AM.