This package contains test assets for the System.Formats.Tar assembly.
The files can be autogenerated with the GenerateTarFiles.sh script. This script needs to be executed in a Linux machine (preferably Ubuntu, since that's where it was tested). The OS should have the Unix tar tool available.
The user executing this script must be part of the sudo group (but should not execute the script with sudo).
The script is executed without arguments. Make sure to mark the script as executable before executing it:
$ chmod +x GenerateTarFiles.sh
$ ./GenerateTarFiles.shThe script generates uncompressed (*.tar) and compressed (*.tar.gz) files in all the supported formats: V7, Ustar, PAX and GNU.
In the case of GNU, there are two variants supported by the Unix tar tool. We generate both, inside the gnu and old_gnu folders.
In the case of PAX, the Unix tar tool can generate archives without and with a Global Extended Attributes entry at the beginning. For that, we generate files inside the pax and pax_gea folders, respectively.
The final *.nupkg also includes the unarchived folder, which contains all the files that are expected to be found inside the *.tar and *.tar.gz files. But there are some file categories that are excluded because either NuGet or Visual Studio do not support them:
- Files and directories with very long paths.
- Hard links. They get packged by
*.nupkgas regular files (this might be expected, since there is no way to differentiate between regular files or hard links). - Special files: Block device, character device, fifo.
These files are generated by the script on the fly, archived with the tar tool, and then deleted at the end of the script execution to prevent getting them packed.
The script makes sure all the unarchived files are marked with the following metadata information before archiving them:
uname:dotnetgname:devdivuid:7913gid:3579mode:744- This translates to u+rwx, g+r, o+r
Device files get the following numbers:
- Character devices:
devmajor:49devminor:86
- Block devices:
devmajor:71devminor:53
PAX files with a Global Extended Attribute entry at the beginning of the archive, get the following custom attribute added:
key: globexthdr.MyGlobalExtendedAttribute
value: hello
When running tests, the "current directory" is the location where all these test assets can be found.
To access an unarchived asset file:
string path = Path.Join(Directory.GetCurrentDirectory(), "unarchived", "file_hardlink", "file.txt");To access a tar file:
string path = Path.Join(Directory.GetCurrentDirectory(), "tar", "pax_gea", "file_hardlink.tar");To access a tar.gz file:
string path = Path.Join(Directory.GetCurrentDirectory(), "targz", "pax_gea", "file_hardlink.tar.gz");file: Contains a regular file namedfile.txtfile_hardlink: Contains a regular file namedfile.txtand a hard link namedhardlink.txtwhose target is thefile.txtinode.file_symlink: Contains a regular file namedfile.txtand a symboliclink namedlink.txtwhose target isfile.txt.folder_file: Contains a directory namedfolder, which contains a regular file namedfile.txt.folder_file_utf8: Contains a directory namedföldërwhich contains a regular file namedáöñ.txt.folder_subfolder_file: Contains a directory namedparent, which contains a directory namedchild, which contains a regular file namedfile.txt.foldersymlink_folder_subfolder_file: Contains at the root a directory namedparent, which contains a directory namedchild, which contains a regular file namedfile.txt, and at the root, it also contains a symbolic link namedchildlinkthat points to thechilddirectory.many_small_files: Contains 10 directories, named from0to9, and each directory contains 10 regular files, each file named0.txtto9.txt.