TeamWin / Team-Win-Recovery-Project

Core recovery files for the Team Win Recovery Project (T.W.R.P) - this is not up to date, please see https://github.com/TeamWin/android_bootable_recovery/
http://twrp.me
1.95k stars 741 forks source link

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

Open mmortal03 opened 2 years ago

mmortal03 commented 2 years ago

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.