You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a gzipped cpio_newc archive (Android ramdisk). The contents contain some root owned files so I am using sudo python3 to open the interpreter. The contents also include broken symlinks which need to remain intact as they are not broken once Android boots.
I am probably doing something wrong, but when I run the below command I get errors on the broken symlinks. It seems they are being followed but the destination does not exist.
Is there a way to say something like "follow_symlinks = False" so the broken symlinks are compressed with the archive but not followed?
Thanks for your time,
SuperR
sudo python3
[sudo] password for superr:
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libarchive
>>> with libarchive.file_writer("ramdisk.gz", "cpio_newc", "gzip") as archive:
... archive.add_files("ramdisk/")
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/superr/.local/lib/python3.5/site-packages/libarchive/write.py", line 64, in add_files
with open(entry_sourcepath(entry_p), 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: b'ramdisk/sdcard'
The text was updated successfully, but these errors were encountered:
superr
changed the title
cpio_newc
cpio_newc and broken symlinks
Dec 3, 2016
No, we don't have an option for this. We probably shouldn't try to read the contents of symlinks at all, so I'd say this issue is more a bug than a missing feature.
Basically we should skip the call to the open() function you see in the traceback if entry.issym is True, and maybe for other types of entry as well.
Can you send us a pull request or do you need someone else to do it?
Changaco
changed the title
cpio_newc and broken symlinks
ArchiveWrite.add_files() chokes on broken symlinks
Dec 3, 2016
Hello,
First, thanks for this wonderful project :)
I am trying to create a gzipped cpio_newc archive (Android ramdisk). The contents contain some root owned files so I am using sudo python3 to open the interpreter. The contents also include broken symlinks which need to remain intact as they are not broken once Android boots.
I am probably doing something wrong, but when I run the below command I get errors on the broken symlinks. It seems they are being followed but the destination does not exist.
Is there a way to say something like "follow_symlinks = False" so the broken symlinks are compressed with the archive but not followed?
Thanks for your time,
SuperR
The text was updated successfully, but these errors were encountered: