GithubHelp home page GithubHelp logo

fixtar's Introduction

ft ("fix tar")

ft is a commandline tool to extract as much data from corrupted tar archives as possible.

Some background information about the tool can be found in the docs folder of the project.

License

ft is distributed under the terms of the GNU General Public License (GPL), Version 2.0. The text of the license is included in the file LICENSE in the root of the project.

The tool is © by Thomas Graf

Building

In order to build ft, you will need the following build requisites:

  • gcc (pretty much any version will do
  • flex
  • sed
  • coreutils
  • make

Once you have those tools, change into the src folder and invoke make.

make test will run a couple of tests and make install will install the tool in /usr/local/bin

Installation

After building, run make install. ft will then be installed in /usr/local/bin

Usage

ft copies all data it can find, even if the data is moved within the archive. Usage:

	ft < damaged.tar > repaired.tar
	ft < damaged.tar | tee repaired.tar | tar -tf - | tee list.txt
	ft < damaged.tar | tar --backup=numbered -xvf -

Notes:

  • no options, no output.
  • a cut off file is filled with a line break (an error message will be shown).
  • it is not guaranteed that TAR extensions actually exist in the expected data. In order to avoid unwanted overwriting, you should use tar as follows: tar --backup=numbered -xvf repaired.tar or with option "-k"
  • vendor/POSIX extensions often start with names like ./@LongLink, ./@LongName or */PaxHeader/*, those are not shown by tar, but cpio or pax do show them.
  • it is quite difficult to deal with all possible situations, due to this the most likely have been chosen :)

fixtar's People

Contributors

daudo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fixtar's Issues

compile errors

~/d/f/src (master) $ make
gcc -g3 -I. -Wall -O2 -c ft.c
ft.c:41:5: error: expected parameter declarator
int snprintf(char _str, size_t size, const char *format, ...);
^
/usr/include/secure/_stdio.h:57:39: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), VA_ARGS)
^
ft.c:41:5: error: expected ')'
/usr/include/secure/_stdio.h:57:39: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), VA_ARGS)
^
ft.c:41:5: note: to match this '('
/usr/include/secure/stdio.h:57:28: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), VA_ARGS)
^
ft.c:41:5: error: conflicting types for '**builtin___snprintf_chk'
int snprintf(char str, size_t size, const char format, ...);
^
/usr/include/secure/_stdio.h:57:3: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS
)
^
ft.c:41:5: note: '**builtin___snprintf_chk' is a builtin with type 'int (char ,
unsigned long, int, unsigned long, const char , ...)'
/usr/include/secure/_stdio.h:57:3: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS
)
^
3 errors generated.
make: *
* [ft.o] Error 1

test script fails to work in dash

./test/testing fails to work in dash:

$ ./testing 
1+0 records in
1+0 records out
1023 bytes (1.0 kB) copied, 0.002233 s, 458 kB/s
3+0 records in
3+0 records out
7071 bytes (7.1 kB) copied, 6.2438e-05 s, 113 MB/s
LONG LABEL :: 2016-02-12
ERROR: unexpected end of file at "abc/tar2.txt", fillup with newlines
abc/
abc/
abc/tar.txt
abc/tar2.txt
./testing: 13: test: 0: unexpected operator
ERROR

Expected output (using bash):

$ ./testing 
1+0 records in
1+0 records out
1023 bytes (1.0 kB) copied, 0.00189486 s, 540 kB/s
3+0 records in
3+0 records out
23397 bytes (23 kB) copied, 0.000112276 s, 208 MB/s
LONG LABEL :: 2016-02-12
ERROR: unexpected end of file at "abc/tar2.txt", fillup with newlines
abc/
abc/
abc/tar.txt
abc/tar2.txt
»ERROR: unexpected end of file at "abc/tar2.txt", fillup with newlines« <-- this line was expected
LONG LABEL :: 2016-02-12
abc/
abc/
abc/tar.txt
abc/tar2.txt
test: ok

Solution: set interpreter to #!/bin/bash

"memory: Cannot allocate memory"

I am unable to execute first step in tar recovery. I've inputted

ft < archive.tar.bz2 > archive.tar.bz2.repaired

and I got message memory: Cannot allocate memory. Archive.tar.bz2 is an 13 GB large tar archive and the computer has about 6 gigs of RAM in it.

The OS is CentOS 6.7. Latest revision.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.