Menu

#241 tar doesn't handle -f - option (read from stdin)

Tar
open
GnuWin
Binaries (396)
5
2012-07-26
2005-04-25
Paul Moore
No

I cannot get tar to read from stdin. This appears to be a
recent change, although I don't see a new build which
may have introduced this problem.

Here is a sample:

tar cvf test.tar path.py init.py
path.py
init.py

tar tvf test.tar
-rw-rw-rw- UK03306/0 27123 2005-01-11 16:21 path.py
-rw-rw-rw- UK03306/0 75184 2005-04-20 14:33
init.py

cat test.tar | tar tvf -
C:\Utils\GnuWin32\bin\tar.exe: Cannot open -: Invalid
argument
C:\Utils\GnuWin32\bin\tar.exe: Error is not recoverable:
exiting now
cat: write error: Invalid argument

For confirmation of the version:

which tar
tar is an external : C:\Utils\GnuWin32\bin\tar.exe

tar --version
tar (GNU tar) 1.13

Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free
Software Foundation, Inc.
This is free software; see the source for copying
conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

Written by John Gilmore and Jay Fenlason.

type c:\Utils\GnuWin32\manifest\tar-1.13-1-bin.ver
Tar 1.13: Binaries
Tar: archiver tool

Discussion

  • Paul Moore

    Paul Moore - 2005-04-25

    Logged In: YES
    user_id=113328

    Actually, this works fine on my (XP Pro) PC at home, but not
    on my (Win 2000) PC at work. I'll do some more testing, and
    see if I can isolate the issue any further.

     
  • Paul Moore

    Paul Moore - 2005-04-25

    Logged In: YES
    user_id=113328

    I can confirm that the problem remains on a clean Windows
    2000 Professional build, with nothing but the gnuwin32
    tar-1.13-1-bin and tar-1.13-1-dep zipfiles installed.

     
  • GnuWin

    GnuWin - 2005-04-26

    Logged In: YES
    user_id=217802

    If you're using Tar only for disk files, then Bsdtar may be an
    alternative; see
    http://gnuwin32.sourceforge.net/packages/bsdtar.htm

     
  • Paul Moore

    Paul Moore - 2005-04-26

    Logged In: YES
    user_id=113328

    Yes, bsdtar works as a fix. Longer term, I'd like to see tar
    fixed, but in some ways bsdtar is better (the -z flag to
    handle compressed archives works, so my main need for tar
    from stdin, namely gzip -dc xx.tar.gz | tar xvf -, is gone!)

    Thanks,
    Paul

     
  • John Bollinger

    John Bollinger - 2005-04-28

    Logged In: YES
    user_id=598605

    tar -f - also doesn't work in archive creation mode (write
    to stdout). I get "tar: Cannot open -: Bad file
    descriptor". This also happens when I do not specify any
    'f' option at all. I'm using the same version of tar (1.13)
    reported by Paul Moore.

    Tarring to stdout is important for working around the lack
    of operability of tar's -z option.

    Running Win2K SP 4.