Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Outline

System.Formats.Tar.TestData

This package contains test assets for the System.Formats.Tar assembly.

Script

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.sh

Output

The 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.

Excluded unarchived files

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 *.nupkg as 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.

Expected metadata

The script makes sure all the unarchived files are marked with the following metadata information before archiving them:

  • uname: dotnet
  • gname: devdiv
  • uid: 7913
  • gid: 3579
  • mode: 744 - This translates to u+rwx, g+r, o+r

Device files get the following numbers:

  • Character devices:
    • devmajor: 49
    • devminor: 86
  • Block devices:
    • devmajor: 71
    • devminor: 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

Consumption in dotnet/runtime

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");

Test cases

  • file: Contains a regular file named file.txt
  • file_hardlink: Contains a regular file named file.txt and a hard link named hardlink.txt whose target is the file.txt inode.
  • file_symlink: Contains a regular file named file.txt and a symboliclink named link.txt whose target is file.txt.
  • folder_file: Contains a directory named folder, which contains a regular file named file.txt.
  • folder_file_utf8: Contains a directory named földër which contains a regular file named áöñ.txt.
  • folder_subfolder_file: Contains a directory named parent, which contains a directory named child, which contains a regular file named file.txt.
  • foldersymlink_folder_subfolder_file: Contains at the root a directory named parent, which contains a directory named child, which contains a regular file named file.txt, and at the root, it also contains a symbolic link named childlink that points to the child directory.
  • many_small_files: Contains 10 directories, named from 0 to 9, and each directory contains 10 regular files, each file named 0.txt to 9.txt.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.