Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ttar: plain text archive, replacement for tar #59

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

ideaship
Copy link
Contributor

@ideaship ideaship commented Jul 2, 2017

This changeset adds ttar, a plain text replacement for tar, and uses it
for the sysfs fixture archive. The syntax is loosely based on tar(1).

Using a plain text archive makes it possible to review changes without
downloading and extracting the archive. Also, when working on the repo,
git diff and git log become useful again, allowing a committer to verify
and track changes over time.

The code is written in bash, because bash is available out of the box on
all major flavors of Linux and on macOS. The feature set used is
restricted to bash version 3.2 because that is what Apple is still
shipping.

The programm also works on Windows if bash is installed. Obviously, it
does not solve the Windows limitations (path length limited to 260
characters, no symbolic links) that prompted the move to an archive
format in the first place.

This changeset adds ttar, a plain text replacement for tar, and uses it
for the sysfs fixture archive. The syntax is loosely based on tar(1).

Using a plain text archive makes it possible to review changes without
downloading and extracting the archive. Also, when working on the repo,
git diff and git log become useful again, allowing a committer to verify
and track changes over time.

The code is written in bash, because bash is available out of the box on
all major flavors of Linux and on macOS. The feature set used is
restricted to bash version 3.2 because that is what Apple is still
shipping.

The programm also works on Windows if bash is installed. Obviously, it
does not solve the Windows limitations (path length limited to 260
characters, no symbolic links) that prompted the move to an archive
format in the first place.
@ideaship
Copy link
Contributor Author

ideaship commented Jul 2, 2017

This changeset is inspired by @grobie's comment in issue #54.

We needed an archive format because Windows fails when checking out repos with certain files (e.g., file paths that include colons or are longer than 260 characters).

For now, we are using tar: a binary format that is opaque as far as github reviews and git (diff, log -p) are concerned.

@grobie mentioned https://github.com/jtvaughan/ptar which addresses this problem but adds a dependency to another language, C.

This changeset implements a simple plain-text archive in bash 3.2, which is installed by default with all major Linux distributions and with all versions of macOS.

The script can handle plain-text files, symbolic links, and directories.

Copy link
Member

@grobie grobie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, looks great! Thanks a lot @ideaship!

Let's see if my trusty bash gurus @matthiasr and @SuperQ have any remaining comments, otherwise I'll merge tonight.

Copy link

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for writing this, it's a great solution.

@grobie grobie merged commit e645f4e into prometheus:master Jul 3, 2017
@SuperQ
Copy link
Member

SuperQ commented Jul 3, 2017

Yea, this is fine. Not my normal bash style, but reasonably good.

@ideaship ideaship deleted the ttar_07 branch July 3, 2017 10:21
remijouannet pushed a commit to remijouannet/procfs that referenced this pull request Oct 20, 2022
Add ttar: plain text archive, replacement for tar
bobrik pushed a commit to bobrik/procfs that referenced this pull request Jan 14, 2023
Implement Process.root() method to retrieve current root directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants