Меню

Tar short read ошибка

I get an error when I uncompress my tar.

I do this:

tar xvf VM_DECOMPTES.tar

and after some time I get the following error:

tar: short read

What is going wrong here?

tar: unrecognized option `—version’ BusyBox
v1.9.1-VMware-visor-klnext-2965 (2010-04-19 12:53:48 PDT) multi-call
binary

asked Aug 23, 2013 at 10:24

Mercer's user avatar

MercerMercer

7765 gold badges10 silver badges22 bronze badges

3

I suspect that your tarfile is corrupted or truncated.

The header of a tarfile contains a size field that contains the length of the file.¹ If the actual file is shorter than the header says it should be, tar will try to read past the filesystem end of file and get back a read shorter than it expected, thus generating the message you see.

¹ This feature dates to when tar was used primarily for Tape ARchiving where you could only know the length of a «file» by reading until you hit an EOF marker on the tape. It was retained for backwards compatibility and also provides a nice (if kinda cheap) check on header and file consistency.

answered Aug 23, 2013 at 10:38

msw's user avatar

mswmsw

10.4k1 gold badge30 silver badges43 bronze badges

Usually this message appears if the tar archive is incomplete. If you run tar tvf ./VM_DECOMPTEST.tar it will check the tar file for inconsistencies.

Michael Mrozek's user avatar

answered Aug 23, 2013 at 10:37

Kamiccolo's user avatar

4

This may be due to the version of tar that you’re running, especially if you are unable to reproduce this issue with GNU tar.

You can build a new version of busybox for your platform by running something like the following commands:

$ wget https://busybox.net/downloads/busybox-1.31.0.tar.bz2
$ tar xjf busybox-1.31.0.tar.bz2
$ cd busybox-1.31.0
$ LDFLAGS=--static make -j16  # if applicable: CROSS_COMPILE=...-linux-gnu-

In particular, there seems to be some sort of bug in unpacking with busybox v1.22.1 (other versions too, perhaps) that has been fixed by v1.31.0.

answered Oct 19, 2019 at 9:10

flaviut's user avatar

flaviutflaviut

7151 gold badge6 silver badges13 bronze badges

I enter this command
su -c busybox tar -xvf /storage/emulated/0/Download/andrax.r5-build5.tar.xz -C /data/data/com.thecrackertechnology.andrax/ANDRAX/

and such an error appears
tar:invalid magic
tar:short read

asked Feb 2, 2021 at 21:04

Yaroslav Morozovskiy's user avatar

1

Automatic detection of the compression format is a GNU feature.

For BusyBox and other tars, specify the format explicitly (busybox tar --help):

    -Z      (De)compress using compress
    -z      (De)compress using gzip
    -J      (De)compress using xz
    -j      (De)compress using bzip2
    -a      (De)compress using lzma

In your case:

busybox tar -xJvf file.tar.xz

(note that if passing it to su -c, the whole command needs to be quoted to be passed as a single argument)

answered Feb 2, 2021 at 21:52

that other guy's user avatar

that other guythat other guy

114k11 gold badges166 silver badges192 bronze badges


tar reports ‘short read’ and fails to untar archive

This bug affects 1 person

Affects Status Importance Assigned to Milestone


Linaro OpenEmbedded

New

Undecided



Riku Voipio

Linaro OpenEmbedded 13.08

Bug Description

Steps to reproduce:

root@genericarmv8:~# curl -s -O ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.10.tar.gz
root@genericarmv8:~# tar zxf autoconf-2.10.tar.gz
tar: short read
root@genericarmv8:~# echo $?
1

root@genericarmv8:~# tar —version
tar: unrecognized option ‘—version’
BusyBox v1.21.1 (2013-07-17 13:47:15 BST) multi-call binary.

Usage: tar -[cxtZzjahvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]…

I see similar problems with other archives.


Я устанавливаю sqlite на Alpine Linux. Я скачиваю, sqlite-autoconf-3130000.tar.gzно tarне могу открыть. Я попробовал этот ответ, но он не работает. tarдает это сообщение:

tar: invalid magic
tar: short read

Я написал эти команды.

wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
tar -zxvf sqlite-autoconf-3090100.tar.gz




Ответы:


Попробуйте установить пакет tar (apk add tar). Tary Busybox (по умолчанию) не поддерживает все функции.



Это не обязательно означает, что альпийская версия tarнесовместима, так как Франческо указал, что вы действительно должны проверить контрольные суммы файлов.

Я столкнулся с этим, делая curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzfв моем Dockerfile.

Оказывается, то, что я забыл, это то, что он curlбудет следовать за перенаправлениями, только если вы разрешите это -L, и поэтому он никогда не попадал в реальный файл, он буквально загружал html, сообщая, что было перенаправление. Добавление -Lпозволило мне сохранить файл без раздувания моего контейнера с новым tar(за исключением «раздувания», добавленного curl).


tar: неверная магия означает, что файл поврежден.

Пожалуйста, проверьте md5sum, если совпадает … вот что я получил:

 md5sum  sqlite-autoconf-3090100.tar.gz 
 74931054399a2d7acf35637efe8d6f45  sqlite-autoconf-3090100.tar.gz


Я получил ту же проблему и решил ее, но я не уверен, что вы столкнулись с той же проблемой.

Код, вызвавший ошибку :

wget www.example.com/file.tar.gz
tar -zxvf file.tar.gz

Код, который разрешил это:

wget https://www.example.com/file.tar.gz
tar -zxvf file.tar.gz

Обратите внимание, что я забыл «https: //», в котором файл был загружен, но tar дал мне ту же ошибку. Если файл не найден, убедитесь, что вы используете

сборка докера —no-cache

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ятрогенная патология врачебные ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Sniper ghost warrior 3 вылетает ошибка