Home > Archive > Compression > November 2005 > How to untar .tar.gz when you don't have "-z" option?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to untar .tar.gz when you don't have "-z" option?
|
|
| phillip.s.powell@gmail.com 2005-10-24, 6:55 pm |
| I have TAR files compressed with gzip option "-z" that I must
uncompress on a different remote system that does not have the gzip
option with "tar -xvf". How do I uncompress without "-z"? I am not
given the luxury of reconfiguring the remote system to do anything
about this (it's a FreeBSD Unix platform).
Thanx
Phil
| |
| Willem 2005-10-24, 6:55 pm |
| phillip.s.powell@gmail.com wrote:
) I have TAR files compressed with gzip option "-z" that I must
) uncompress on a different remote system that does not have the gzip
) option with "tar -xvf". How do I uncompress without "-z"? I am not
) given the luxury of reconfiguring the remote system to do anything
) about this (it's a FreeBSD Unix platform).
gunzip -c <file.tar.gz> | tar -xvf -
If you don't have gunzip (or gzip -d) installed, you're basically screwed.
HTH, HAND.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
| |
| Dave Hinz 2005-10-24, 6:55 pm |
| On 24 Oct 2005 13:25:59 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
> I have TAR files compressed with gzip option "-z" that I must
> uncompress on a different remote system that does not have the gzip
> option with "tar -xvf". How do I uncompress without "-z"? I am not
> given the luxury of reconfiguring the remote system to do anything
> about this (it's a FreeBSD Unix platform).
A FreeBSD system without gzip? Are you sure it's not there? Could it
just not be in your path?
But, if it's really not there, then your only choice is to unzip it on a
system that does have gzip.
Dave Hinz
| |
| Doug Freyburger 2005-10-24, 6:55 pm |
| Willem wrote:
> phillip.s.powell@gmail.com wrote:
>
> ) I have TAR files compressed with gzip option "-z" that I must
> ) uncompress on a different remote system that does not have the gzip
> ) option with "tar -xvf". How do I uncompress without "-z"? I am not
> ) given the luxury of reconfiguring the remote system to do anything
> ) about this (it's a FreeBSD Unix platform).
>
> gunzip -c <file.tar.gz> | tar -xvf -
>
> If you don't have gunzip (or gzip -d) installed, you're basically screwed.
Nah, the file had to be transferred from the source host
to the target host somehow. If the target host lacks
gunzip, the source host had a -z option in tar and will
therefore had gzip and/or gunzip available.
ftp/scp/whatever file.tar.gz
zcat file.tar.gz | tar -xvf -
or
gzip -u file.tar.gz
ftp/scp/whatever file.tar
tar -xvf file.tar
| |
| Keith Thompson 2005-10-24, 6:55 pm |
| phillip.s.powell@gmail.com writes:
> I have TAR files compressed with gzip option "-z" that I must
> uncompress on a different remote system that does not have the gzip
> option with "tar -xvf". How do I uncompress without "-z"? I am not
> given the luxury of reconfiguring the remote system to do anything
> about this (it's a FreeBSD Unix platform).
It almost sounds like you're talking about a "-z" option to the gzip
program, but I'm sure you're referring to tar's "-z" option that
causes it to invoke gzip.
As long as you have tar and gzip commands, it's easy enough to invoke
them yourself, eg., "gzip -d < foo.tar.gz | tar xvf -".
Or you can install GNU tar. The latest version recognizes gzipped
tarballs automatically, so you don't even need to use the 'z' option
explicitly. This doesn't require reconfiguring the remote system; you
can just build and install it somwehere under your home directory.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
| |
|
| Begin <lnbr1ebojs.fsf@nuthaus.mib.org>
On 2005-10-24, Keith Thompson <kst-u@mib.org> wrote:
> phillip.s.powell@gmail.com writes:
^^^^^^^
[color=darkred]
> As long as you have tar and gzip commands, it's easy enough to invoke
> them yourself, eg., "gzip -d < foo.tar.gz | tar xvf -".
FreeBSD comes with both g(un)zip and tar in the base system.
> Or you can install GNU tar.
FreeBSD has gnu tar available in the base system as tar (4.*) or gtar
(5.*). The bsdtar that is `tar' on FreeBSD 5.* ignores -z on extraction
or test because it automatically recognizes compression anyway.
The only reason I can think of right now why OP would not be able to use
tar is because he's in a jail(8) and tar didn't get installed. In which
case it is probably a good idea to talk to the admin and ask for tar to
be copied as well.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
| |
| Michal Jaegermann 2005-10-25, 6:55 pm |
| In comp.compression Willem <willem@stack.nl> wrote:
> phillip.s.powell@gmail.com wrote:
> ) I have TAR files compressed with gzip option "-z" that I must
> ) uncompress on a different remote system that does not have the gzip
> ) option with "tar -xvf". How do I uncompress without "-z"? I am not
> ) given the luxury of reconfiguring the remote system to do anything
> ) about this
>
> gunzip -c <file.tar.gz> | tar -xvf -
>
> If you don't have gunzip (or gzip -d) installed, you're basically screwed.
Well, not necessary.
gunzip < file.tar.gz | ssh remote.system "cd $target_dir && tar x"
> (it's a FreeBSD Unix platform).
Sounds extremely unlikely that you are really missing required tools.
M.
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| Sorry, not an option in this case. It has to be packaged up and sent
to a system that doesn't have "tar -z" option (although it does have
gzip/gunzip though)
Phil
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| Basically I have to set it up so that the source and destination may,
or may not, have "g[un]zip" capabilities since this is a portable web
application and thus, the packager has to be equally portable (note
that it's a UNIX-only packager for now, will have to create a Windows
version whenever I feel like it).
An engineering co-worker helped stumble me onto this option:
blah=`which gunzip | grep -E 'no gunzip'`
# LOOK FOR STRING CONTENT IN $blah - IF IT HAS CONTENT, NO GUNZIP,
ELSE, GUNZIP
Phil
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 07:08:16 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
> Sorry, not an option in this case. It has to be packaged up and sent
> to a system that doesn't have "tar -z" option (although it does have
> gzip/gunzip though)
Nobody knows what or who you are answering, because you're using
google's brain-dead interface which doesn't default to including
context. Please change that default, if you'd like your messages to
make sense.
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| I am not used to this interface, sorry! AUGH!
Ok, an update.. I was able to to find an alternative to "tar -z", only
that it fails using FreeBSD UNIX:
[BASH]
cd $1
hasGunzip=`which gunzip | grep -E 'no gunzip'`
if [ -n $hasGunzip ]; then
gunzip -c $1/$3_$4.tar.gz | tar -xvf
else
echo "You can't unzip, you're screwed"
exit
fi
[/BASH]
However, upon using this code I get the following error message:
quote:
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
[blocksize] [[-C directory] file] ...
However, using Red Hat Enterprise Level 3 version of UNIX, the
untarring takes place with no faults of any kind.
The destination, however, is FreeBSD so it must work for both platforms
of UNIX.
Phil
phillip.s.powell@gmail.com wrote:
> Sorry, not an option in this case. It has to be packaged up and sent
> to a system that doesn't have "tar -z" option (although it does have
> gzip/gunzip though)
>
> Phil
| |
|
| On 26 Oct 2005 07:12:21 -0700, phillip.s.powell@gmail.com wrote:
>Basically I have to set it up so that the source and destination may,
>or may not, have "g[un]zip" capabilities since this is a portable web
>application and thus, the packager has to be equally portable (note
>that it's a UNIX-only packager for now, will have to create a Windows
>version whenever I feel like it).
>
>An engineering co-worker helped stumble me onto this option:
>
>blah=`which gunzip | grep -E 'no gunzip'`
># LOOK FOR STRING CONTENT IN $blah - IF IT HAS CONTENT, NO GUNZIP,
>ELSE, GUNZIP
Note that the behavior of which(1) is dependent on what system and what
shell you're running. I think it'd be more reliable to test the return
value of which rather than grepping its output.
As someone already pointed out, if you can externally decompress the archive
and pipe it to tar, you don't need a tar -z option.
If you have gzip, you also have gunzip capability via gzip -d.
Or you could just skip the compression and distribute a .tar file.
-Scott
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 08:31:51 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
> I am not used to this interface, sorry! AUGH!
If you subscribe to news.individual.net for 10 euro a year (13 bucks or
so), you can use a real newsreader and not have to suffer with google.
> hasGunzip=`which gunzip | grep -E 'no gunzip'`
All that proves is that it's not in your path. Ask your draconian
hosting company where gzip and whatever you need, is located. If they
don't know, or won't tell you, or it's not there and they won't fix
that, get a better hosting company.
| |
| ted@loft.tnolan.com (Ted Nolan 2005-10-26, 6:55 pm |
| In article <1130340711.877575.274190@g14g2000cwa.googlegroups.com>,
<phillip.s.powell@gmail.com> wrote:
>
>
>I am not used to this interface, sorry! AUGH!
>
>Ok, an update.. I was able to to find an alternative to "tar -z", only
>that it fails using FreeBSD UNIX:
>
>[BASH]
>cd $1
>hasGunzip=`which gunzip | grep -E 'no gunzip'`
>if [ -n $hasGunzip ]; then
> gunzip -c $1/$3_$4.tar.gz | tar -xvf
>else
> echo "You can't unzip, you're screwed"
> exit
>fi
>[/BASH]
>
>However, upon using this code I get the following error message:
>
>quote:
>
>tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
>[blocksize] [[-C directory] file] ...
>
>
>
>However, using Red Hat Enterprise Level 3 version of UNIX, the
>untarring takes place with no faults of any kind.
>
>The destination, however, is FreeBSD so it must work for both platforms
>of UNIX.
>
>Phil
>
>phillip.s.powell@gmail.com wrote:
>
Just a note:
If the FreeBSD system you are using doesn't support -z, then it is something
the hosting company has done to break it. Out of the box, both FreeBSD 4.x &
FreeBSD 5.x support 'z' in the default /usr/bin/tar
Ted
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| See below.. thanx
Dave Hinz wrote:
> On 26 Oct 2005 08:31:51 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> If you subscribe to news.individual.net for 10 euro a year (13 bucks or
> so), you can use a real newsreader and not have to suffer with google.
>
>
> All that proves is that it's not in your path. Ask your draconian
> hosting company where gzip and whatever you need, is located. If they
> don't know, or won't tell you, or it's not there and they won't fix
> that, get a better hosting company.
Thanx, but that is not quite my problem. The problem is that I get an
error message when I'm trying to pipe a gunzip command on the file into
a tar command.
[BASH]
gunzip -c $1/$3_$4.tar.gz | tar -xvf
[/BASH]
produces
quote:
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
[blocksize] [[-C directory] file] ...
Phil
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| On my Linux system, I can compress the archive and pipe it to tar; on
the FreeBSD UNIX system I cannot decompress the archive and pipe to tar
[BASH]
gunzip -c $1/$3_$4.tar.gz | tar -xvf
[/BASH]
produces
quote:
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
[blocksize] [[-C directory] file] ...
Phil
Scott wrote:
> On 26 Oct 2005 07:12:21 -0700, phillip.s.powell@gmail.com wrote:
>
>
> Note that the behavior of which(1) is dependent on what system and what
> shell you're running. I think it'd be more reliable to test the return
> value of which rather than grepping its output.
>
> As someone already pointed out, if you can externally decompress the archive
> and pipe it to tar, you don't need a tar -z option.
>
> If you have gzip, you also have gunzip capability via gzip -d.
>
> Or you could just skip the compression and distribute a .tar file.
>
> -Scott
| |
| Stephane CHAZELAS 2005-10-26, 6:55 pm |
| 2005-10-26, 08:31(-07), phillip.s.powell@gmail.com:
> I am not used to this interface, sorry! AUGH!
>
> Ok, an update.. I was able to to find an alternative to "tar -z", only
> that it fails using FreeBSD UNIX:
>
> [BASH]
> cd $1
> hasGunzip=`which gunzip | grep -E 'no gunzip'`
> if [ -n $hasGunzip ]; then
> gunzip -c $1/$3_$4.tar.gz | tar -xvf
> else
> echo "You can't unzip, you're screwed"
> exit
> fi
> [/BASH]
[...]
There are several issues in your code.
cd -P -- "$1" || exit
if
type gunzip > /dev/null 2>&1 || {
type gzip > /dev/null 2>&1 &&
gunzip() { gzip -d "$@"; }
}
then
gunzip -c < "$1/${3}_$4.tar.gz" | tar xvf -
else
echo >&2 "You can't gunzip, you're screwed"
fi
To sum up.
- leaving a variable unquoted has a very special meaning in
shells, you should (almost) never do that.
- cd without options defaults to cd -L (in POSIX shells). That
may not be what you want.
- if cd fails, you should not go on with the rest of the script.
- When passing "variable" arguments to commands, you should
ensure that the command doesn't take the argument for an
option by clearly marking the end of options with "--".
- which is a non-portable, non reliable command. type is the
Bourne equivalent of that (initially csh) command (and command
-v is the POSIX one)
- grep -E, though POSIX is not very portable
- the f option to find takes one argument which is the file name
- tar options historically don't start with "-"
--
Stéphane
| |
| Thomas Richter 2005-10-26, 6:55 pm |
| Hi,
> quote:
> tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
> [blocksize] [[-C directory] file] ...
>
$ man tar
So long,
Thomas
| |
| ted@loft.tnolan.com (Ted Nolan 2005-10-26, 6:55 pm |
| In article <1130343646.404574.79430@g47g2000cwa.googlegroups.com>,
<phillip.s.powell@gmail.com> wrote:
>
>
>See below.. thanx
>
>Dave Hinz wrote:
><phillip.s.powell@gmail.com> wrote:
>
>Thanx, but that is not quite my problem. The problem is that I get an
>error message when I'm trying to pipe a gunzip command on the file into
>a tar command.
>
>[BASH]
>gunzip -c $1/$3_$4.tar.gz | tar -xvf
>[/BASH]
>
>produces
>
>quote:
>tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
>[blocksize] [[-C directory] file] ...
>
>
>Phil
>
Explicitly specify stdin, never hurts to thrown in 'B' either:
gunzip -c $1/$3_$4.tar.gz | tar xBvf -
Ted
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
|
Thomas Richter wrote:
> Hi,
>
>
> $ man tar
>
> So long,
> Thomas
That did not help me one bit.
Phil
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| Following are the error messages the code generated:
quote:
gunzip: /home/adnetint/web/tools/adnet_10242005.tar.gz: No such file or
directory
tar: B: unknown option
When using
[BASH]
gunzip -c "$1/$3_$4.tar.gz" | tar xBvf -
Taking out the B option I then get this:
quote:
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
Tar: blocksize = 0; broken pipe?
So it appears that the option you and Stephane came up with ly also
breaks on this FreeBSD Unix platform as well. WOW
Phil
Ted Nolan <tednolan> wrote:
> In article <1130343646.404574.79430@g47g2000cwa.googlegroups.com>,
> <phillip.s.powell@gmail.com> wrote:
>
> Explicitly specify stdin, never hurts to thrown in 'B' either:
>
> gunzip -c $1/$3_$4.tar.gz | tar xBvf -
>
>
> Ted
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| Following are the error messages the code generated:
quote:
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
tar: B: unknown option
When using
[BASH]
gunzip -c "$1/$3_$4.tar.gz" | tar xBvf -
Taking out the B option I then get this:
quote:
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
Tar: blocksize = 0; broken pipe?
So it appears that the option you and Stephane came up with ly also
breaks on this FreeBSD Unix platform as well. WOW
Phil
Ted Nolan <tednolan> wrote:
> In article <1130343646.404574.79430@g47g2000cwa.googlegroups.com>,
> <phillip.s.powell@gmail.com> wrote:
>
> Explicitly specify stdin, never hurts to thrown in 'B' either:
>
> gunzip -c $1/$3_$4.tar.gz | tar xBvf -
>
>
> Ted
| |
| ted@loft.tnolan.com (Ted Nolan 2005-10-26, 6:55 pm |
| In article <1130345891.394947.85660@o13g2000cwo.googlegroups.com>,
<phillip.s.powell@gmail.com> wrote:
>
>
>Following are the error messages the code generated:
>
>quote:
>
>gunzip: /home/adnetint/web/tools/adnet_10242005.tar.gz: No such file or
>directory
>tar: B: unknown option
>
>
>
>When using
>
>[BASH]
>gunzip -c "$1/$3_$4.tar.gz" | tar xBvf -
>
>Taking out the B option I then get this:
>
>quote:
>
>gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
>directory
>Tar: blocksize = 0; broken pipe?
>
>
>
>So it appears that the option you and Stephane came up with ly also
>breaks on this FreeBSD Unix platform as well. WOW
>
>Phil
>
>
OK, there is definitely an odd version of tar on that platform, as
stock FreeBSD tar supports 'B'. However, that being said, your
problme here:
quote:
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
Tar: blocksize = 0; broken pipe?
is plain, as gunzip is telling you. For whatever reason, your transfer
failed, it transferred to the wrong place, whatever, the file
/home/me/web/tools/app_10242005.tar.gz
does not exist and thus cannot be unzipped. The 'broken pipe' error
from tar is logical in this case since there would have been no
input in the pipe, since gunzip was unable to put any there.
Ted
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 10:05:00 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
> Following are the error messages the code generated:
>
> [Quote]
>
> gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
> directory
Sounds like that .gz file doesn't exist. Fix that.
> tar: B: unknown option
Sounds like you're using an option that tar doesn't know. That's why
someone pointed you to the man page.
> When using
> [BASH]
> gunzip -c "$1/$3_$4.tar.gz" | tar xBvf -
Get rid of all the variables, and type it straight. You're
overcomplicating your problem.
> Taking out the B option I then get this:
> gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
That's because app_10242005.tar.gz STILL doesn't exist in
/home/me/web/tools.
> directory
> Tar: blocksize = 0; broken pipe?
Yes, if the file doesn't exist, you can't extract anything from it.
> So it appears that the option you and Stephane came up with ly also
> breaks on this FreeBSD Unix platform as well. WOW
No, it appears that you're blaiming people who are trying to help you,
for basic troubleshooting flaws and inability to read error messages on
your part. Tell you what - go read this article and learn from it:
http://www.catb.org/~esr/faqs/smart-questions.html
If you read it with an open mind, you'll recognize more than a couple
errors you're making in trying to get help. (not the least of which is
top-posting).
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| I'm sorry, but I cannot fully top-post this because I need to point out
specific issues that you brought up, so my intention is not to offend
but to be able to clearly illustrate the problem in the hopes that a
solution would be provided.
Dave Hinz wrote:
> On 26 Oct 2005 10:05:00 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> Sounds like that .gz file doesn't exist. Fix that.
>
The .gz file does exist. "ls -l" confirmed just that.
>
> Sounds like you're using an option that tar doesn't know. That's why
> someone pointed you to the man page.
>
That's why I took of the "B" option because apparently the version of
tar on the FreeBSD UNIX system I'm using remotely does not support that
option, just like it doesn't support the "z" option
>
> Get rid of all the variables, and type it straight. You're
> overcomplicating your problem.
>
I did just that:
[BASH]
gunzip -c /home/me/web/tools/app_10242005.tar.gz | tar xvf -
[/BASH]
Produced the same error:
Following are the error messages the code generated:
quote:
gunzip: /home/adnetint/web/tools/adnet_10242005.tar.gz: No such file or
directory
tar: B: unknown option
When using
[BASH]
gunzip -c "$1/$3_$4.tar.gz" | tar xBvf -
Taking out the B option I then get this:
quote:
ima_unpackager.sh: line 52: /home/me/web/tools/app_10242005.tar.gz: No
such file or directory
Phil
>
>
> That's because app_10242005.tar.gz STILL doesn't exist in
> /home/me/web/tools.
>
>
> Yes, if the file doesn't exist, you can't extract anything from it.
>
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 11:03:35 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
> I'm sorry, but I cannot fully top-post this because I need to point out
> specific issues that you brought up,
Exactly. Glad to see you stopped top-posting.
> so my intention is not to offend
> but to be able to clearly illustrate the problem in the hopes that a
> solution would be provided.
> Dave Hinz wrote:
[color=darkred]
> The .gz file does exist. "ls -l" confirmed just that.
So go into that directory and try to gunzip it. If you get a tar file,
then try to untar that. You're trying to hold too many moving parts
together at once. Once you break it down to the first failure, then
troubleshoot _that_, not a shell scipt full of variables and pipes and
conditionals.
>
> That's why I took of the "B" option because apparently the version of
> tar on the FreeBSD UNIX system I'm using remotely does not support that
> option, just like it doesn't support the "z" option
See above regarding doing too much at once.
[color=darkred]
> I did just that:
> gunzip -c /home/me/web/tools/app_10242005.tar.gz | tar xvf -
Stop. Just gunzip the file. Lose the -c, lose the pipe, lose the tar.
One step at a time. Script and pipe it later.
| |
| Stephane CHAZELAS 2005-10-26, 6:55 pm |
| 2005-10-26, 09:58(-07), phillip.s.powell@gmail.com:
[...]
> gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
> directory
> Tar: blocksize = 0; broken pipe?
>
> [/Quote]
>
> So it appears that the option you and Stephane came up with ly also
> breaks on this FreeBSD Unix platform as well. WOW
[...]
That's an error from gunzip, not tar.
Had you done
gunzip -c < "..." | tar xf -
as I suggested, you'd have had the error from the shell without
the need to start the gunzip command. gunzip tells you the file
doesn't exist.
--
Stéphane
| |
| S. Anthony Sequeira 2005-10-26, 6:55 pm |
| phillip.s.powell@gmail.com wrote:
>
> That did not help me one bit.
>
> Phil
A hint: what is tar going to untar in the command you have shown.
--
Tony
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
|
Dave Hinz wrote:
> On 26 Oct 2005 11:03:35 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> Exactly. Glad to see you stopped top-posting.
>
>
>
>
> So go into that directory and try to gunzip it. If you get a tar file,
> then try to untar that. You're trying to hold too many moving parts
> together at once. Once you break it down to the first failure, then
> troubleshoot _that_, not a shell scipt full of variables and pipes and
> conditionals.
I went to that file, and instead of a .tar.gz file, I see a .tar file,
thus, it appears that the decompression was successful, however, at
that point, gunzip then couldn't seem to find it, which makes no sense
considering it had to have found it from the beginning to do so.
I removed the pipe, the tar, everything, and the exact same error
occurred:
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
Before I ran the script I verified the file existed:
/home/me/web/tools/app_10242005.tar.gz
But after I ran the command it became:
command: gunzip -c /home/me/web/tools/app_10242005.tar.gz
/home/me/web/tools/app_10242005.tar
>
>
> See above regarding doing too much at once.
>
>
>
>
> Stop. Just gunzip the file. Lose the -c, lose the pipe, lose the tar.
> One step at a time. Script and pipe it later.
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 11:41:50 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> Dave Hinz wrote:
[color=darkred]
[color=darkred]
> I went to that file, and instead of a .tar.gz file, I see a .tar file,
Do you know why?
> thus, it appears that the decompression was successful, however, at
> that point, gunzip then couldn't seem to find it, which makes no sense
> considering it had to have found it from the beginning to do so.
It worked at least once, after which time the .gz file no longer
existed.
> I removed the pipe, the tar, everything, and the exact same error
> occurred:
> gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
> directory
YOU DON'T HAVE A .GZ FILE TO GUNZIP! You just showed yourself that.
The gunzip has succeeded. Now do the tar.
> Before I ran the script I verified the file existed:
> /home/me/web/tools/app_10242005.tar.gz
> But after I ran the command it became:
> command: gunzip -c /home/me/web/tools/app_10242005.tar.gz
> /home/me/web/tools/app_10242005.tar
What exactly do you _expect_ that command to do? Hint: it's working
right. You told it to uncompress the file, and it did. Now do the
next step.
Please go read that article.
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
|
Dave Hinz wrote:
> On 26 Oct 2005 11:41:50 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
>
>
>
> Do you know why?
DO I know why when I do this:
ls -l /home/me/web/tools/app_10242005.tar.gz
/home/me/web/tools/app_10242005.tar.gz
gunzip -c /home/me/web/tools/app_10242005.tar.gz
gunzip: /home/adnetint/web/tools/adnet_10242005.tar.gz: No such file or
directory
ls -l /home/me/web/tools/app_10242005.tar*
/home/me/web/tools/app_10242005.tar
No, can you tell me why?
Phil
| |
| phillip.s.powell@gmail.com 2005-10-26, 6:55 pm |
| Dave Hinz wrote:
> On 26 Oct 2005 11:41:50 -0700, phillip.s.pow...@gmail.com <phillip.s.pow...@gmail.com> wrote:
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
> Do you know why?
DO I know why when I do this:
ls -l /home/me/web/tools/app_10242005.tar.gz
/home/me/web/tools/app_10242005.tar.gz
gunzip -c /home/me/web/tools/app_10242005.tar.gz
gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
directory
ls -l /home/me/web/tools/app_10242005.tar*
/home/me/web/tools/app_10242005.tar
No, can you tell me why?
Phil
| |
| Dave Hinz 2005-10-26, 6:55 pm |
| On 26 Oct 2005 12:15:04 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> Dave Hinz wrote:
[color=darkred]
> DO I know why when I do this:
> ls -l /home/me/web/tools/app_10242005.tar.gz
> /home/me/web/tools/app_10242005.tar.gz
That file exists.
> gunzip -c /home/me/web/tools/app_10242005.tar.gz
You tell it to unzip /home/me/web/blah...
> gunzip: /home/adnetint/web/tools/adnet_10242005.tar.gz: No such file or
> directory
and it can't find /home/adnetint/web/blah... 'me' and 'adnetint' are
different.
> ls -l /home/me/web/tools/app_10242005.tar*
> /home/me/web/tools/app_10242005.tar
....and yet it uncompressed. Did you ever answer the question someone
else asked about if you're in a chroot jail?
| |
| Doug Freyburger 2005-10-26, 6:55 pm |
| phillip.s.powell@gmail.com wrote:
>
> Basically I have to set it up so that the source and destination may,
> or may not, have "g[un]zip" capabilities since this is a portable web
> application and thus, the packager has to be equally portable (note
> that it's a UNIX-only packager for now, will have to create a Windows
> version whenever I feel like it).
>
> An engineering co-worker helped stumble me onto this option:
>
> blah=`which gunzip | grep -E 'no gunzip'`
> # LOOK FOR STRING CONTENT IN $blah - IF IT HAS CONTENT, NO GUNZIP,
> ELSE, GUNZIP
>
> Phil
You are having problems with compression. Screw it.
Punt on doing the compression in the first place,
don't have problems with compression later.
Make your process simpler, have simpler results.
"gunzip" the source file in the beginning, work
with the uncompressed version from then on.
| |
| Alan Morgan 2005-10-26, 6:55 pm |
| In article <1130354643.122771.60090@g14g2000cwa.googlegroups.com>,
<phillip.s.powell@gmail.com> wrote:
>Dave Hinz wrote:
>
>
>
>
>
>
>
>DO I know why when I do this:
>
>ls -l /home/me/web/tools/app_10242005.tar.gz
>/home/me/web/tools/app_10242005.tar.gz
>gunzip -c /home/me/web/tools/app_10242005.tar.gz
>gunzip: /home/me/web/tools/app_10242005.tar.gz: No such file or
>directory
>ls -l /home/me/web/tools/app_10242005.tar*
>/home/me/web/tools/app_10242005.tar
>
>No, can you tell me why?
gunzip is ignoring the -c option and just unzipping the file (-c would
cause the unzipped contents to be printed to standard out but will leave
the original file unchanged). This might happen if gunzip is a creative
(read: stupid) alias to gzip or a bizarre shell script or something
like that.
What are the results of
% which gunzip
% gunzip --help
% file **path printed by which gunzip**
Usually gunzip is exactly the same as gzip (and gzcat) and changes its
behavior based on the name by which you invoke it. You can try
% gzip -d -c foo.tar.gz
which specifies decompression (gzip -d should be the same as gunzip) and
see if that gives you better luck.
Alan
--
Defendit numerus
| |
| Bill Marcum 2005-10-26, 6:55 pm |
| On 26 Oct 2005 12:15:04 -0700, phillip.s.powell@gmail.com
<phillip.s.powell@gmail.com> wrote:
>
> DO I know why when I do this:
>
> ls -l /home/me/web/tools/app_10242005.tar.gz
> /home/me/web/tools/app_10242005.tar.gz
> gunzip -c /home/me/web/tools/app_10242005.tar.gz
Do you have some sort of alias for "ls"? "ls -l" output should look
like this:
-rwxr----- 1 somebody somegroup 1234 April 1 2005 app_10242005.tar.gz
--
A fair exterior is a silent recommendation.
-- Publilius Syrus
| |
| phillip.s.powell@gmail.com 2005-10-27, 6:55 pm |
| Got it!!!!
Turns out that I simply had to call the hosting provider ask him how he
would do it. He uses the GNU version of tar called 'gtar' which works
perfectly!
[BASH]
unpack()
{
cd "$1" || exit; # GO TO PATH OR DIE TRYING
hasGtar=`which gtar | grep -E 'no gtar'`; # CHECK TO SEE IF gtar IS
AVAILABLE HERE
hasGunzip=`which gunzip | grep -E 'no gunzip'`; # CHECK TO SEE IF
gunzip IS AVAILABLE HERE
if [ -n $hasGtar ]; then
gtar -zxvf "$1/${3}_${4}.tar.gz"
elif [ -n $hasGunzip ]; then
gunzip -c "$1/${3}_${4}.tar.gz" | tar -xvf -
else
echo 'Unable to unpack due to lack of gtar/gzip support, exiting
now'
exit
fi
cp -pr "$1$2/*" "$1"; # REMOVE TARRED-STRUCTURED SUBFOLDER STRUCTURE
AND REPLACE INTO EXISTING PATH
pathRootName=`echo "$2" | cut -d'/' -f2`; # YOU HAVE TO FIND "var" OR
"home" OR WHATEVER IS THE ROOT PATH NAME OF $origPath
rm -R "$1/$pathRootName"; # REMOVE TARRED-STRUCTURED SUBFOLDER
RECURSIVELY
}
[/BASH]
| |
| phillip.s.powell@gmail.com 2005-10-27, 6:55 pm |
|
Dave Hinz wrote:
>
>
> ...and yet it uncompressed. Did you ever answer the question someone
> else asked about if you're in a chroot jail?
No, because I'm not a system admin, not an enginner, not a UNIX guru.
I'm a Web guy, PHP/TCL/ASP/JSP web application guy. In spite of
researching and reading
http://www.bpfh.net/simes/computing/chroot-break.html (which made
absolutely no sense to me whatsoever), I couldn't and still cannot
answer that question and proceeded on a different route: I called the
hosting provider and simply asked him how he would untar a compressed
tarball. He told me "gtar" because he uses GNU tar.
I tried it and it worked perfectly for me, so that's that.
Here's the code:
[BASH]
# SYNTAX: unpack $path $origPath $origName $today (as $1 $2 $3 $4)
unpack()
{
cd $1; # GO TO PATH
hasGtar=`which gtar | grep -E 'no gtar'`; # CHECK TO SEE IF gtar IS
AVAILABLE HERE
hasGunzip=`which gunzip | grep -E 'no gunzip'`; # CHECK TO SEE IF
gunzip IS AVAILABLE HERE
if [ -n $hasGtar ]; then
gtar -zxvf "$1/$3_$4.tar.gz"
elif [ -n $hasGunzip ]; then
gunzip -c "$1/$3_$4.tar.gz" | tar -xvf -
else
echo 'Unable to unpack due to lack of gtar/gzip support, exiting
now'
exit
fi
#tar -zxvf $3_$4.tar.gz; # UNPACK
cp -pr $1$2/* $1; # REMOVE TARRED-STRUCTURED SUBFOLDER STRUCTURE AND
REPLACE INTO EXISTING PATH
pathRootName=`echo $2 | cut -d'/' -f2`; # YOU HAVE TO FIND "var" OR
"home" OR WHATEVER IS THE ROOT PATH NAME OF $origPath
rm -R $1/$pathRootName; # REMOVE TARRED-STRUCTURED SUBFOLDER
RECURSIVELY
}
[/BASH]
Thanx for your help, though!
Phil
| |
| phillip.s.powell@gmail.com 2005-10-27, 6:55 pm |
|
Bill Marcum wrote:
> On 26 Oct 2005 12:15:04 -0700, phillip.s.powell@gmail.com
> <phillip.s.powell@gmail.com> wrote:
>
> Do you have some sort of alias for "ls"? "ls -l" output should look
> like this:
>
> -rwxr----- 1 somebody somegroup 1234 April 1 2005 app_10242005.tar.gz
>
>
No, I was simply paraphrasing the output, the output was formatted
normally.
Phil
> --
> A fair exterior is a silent recommendation.
> -- Publilius Syrus
| |
| Dave Hinz 2005-10-28, 7:55 am |
| On 27 Oct 2005 08:29:25 -0700, phillip.s.powell@gmail.com <phillip.s.powell@gmail.com> wrote:
>
> Dave Hinz wrote:
>
>
> No, because I'm not a system admin, not an enginner, not a UNIX guru.
> I'm a Web guy, PHP/TCL/ASP/JSP web application guy.
It could be related to why that path changes, which is why a couple
people asked.
> Thanx for your help, though!
Did you ever go read ESR's article? It really will help you.
| |
| Carl Lowenstein 2005-11-01, 6:55 pm |
| In article <1130343646.404574.79430@g47g2000cwa.googlegroups.com>,
<phillip.s.powell@gmail.com> wrote:
>See below.. thanx
>
>Dave Hinz wrote:
><phillip.s.powell@gmail.com> wrote:
>
>Thanx, but that is not quite my problem. The problem is that I get an
>error message when I'm trying to pipe a gunzip command on the file into
>a tar command.
>
>[BASH]
>gunzip -c $1/$3_$4.tar.gz | tar -xvf
>[/BASH]
>
>produces
>
>quote:
>tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile]
>[blocksize] [[-C directory] file] ...
>
That I can see, nobody has gone to the trouble of pointing out that you
have not specified the file source for the "tar -xvf" command. While GNU
tar defaults to stdin if the source is not specified, few others do.
Try "tar -xvf -"
carl
--
carl lowenstein marine physical lab u.c. san diego
clowenst@ucsd.edu
|
|
|
|
|