TeamWin/Team-Win-Recovery-Project

Can't extract files from a backup to a relative path, using the built-in tar

mmortal03 opened this issue · 0 comments

  • [ X] I am running an official build of TWRP, downloaded from https://twrp.me/Devices/
  • [ X] I am running the latest version of TWRP
  • [ X] I have read the FAQ (https://twrp.me/FAQ/)
  • [ X] I have searched for my issue and it does not already exist

Device codename: hima
TWRP version: twrp-3.6.2_9-0-hima.img

WHAT IS THE EXPECTED RESULT?

Extracting files from a backup to a relative path, using the built-in tar in TWRP, should be possible.

WHAT STEPS WILL REPRODUCE THE PROBLEM?

Extracting files from a backup to a relative path, using the built-in tar in TWRP, isn't working.

To be clear, I'm using the tar that is included in twrp-3.6.2_9-0-hima.img from an adb shell in recovery.
(tangential, but tar --version reports toybox 0.7.4, but it'd make more sense for the TWRP devs to modify this version information if it includes extensions that are not identical to toybox 0.7.4 tar)

Here's an example:

tar -tvf system.ext4.win002 | grep system/vendor/lib64/libmdmdetect.so

-rw-r--r-- root/root 18344 2017-04-05 05:53:31 /system/vendor/lib64/libmdmdetect.so

tar -xvf system.ext4.win002 system/vendor/lib64/libmdmdetect.so

tar: 'system/vendor/lib64/libmdmdetect.so' not in archive

If I add the leading '/':

tar -xvf system.ext4.win002 /system/vendor/lib64/libmdmdetect.so

it will extract the file to the absolute path.

If I add the leading '/' and append -C new_directory to the end of the command:

tar -xvf system.ext4.win002 /system/vendor/lib64/libmdmdetect.so -C new_directory

it will ignore the appended argument pointing to the new_directory, and will still extract the file to the absolute path.

If I cd to the new_directory and run:

tar -xvf ../system.ext4.win002 /system/vendor/lib64/libmdmdetect.so

it will still extract the file to the absolute path.