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

cmd/go/internal/txtar: no escaping for file separator #32003

Closed
gaal opened this issue May 13, 2019 · 3 comments
Closed

cmd/go/internal/txtar: no escaping for file separator #32003

gaal opened this issue May 13, 2019 · 3 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gaal
Copy link

gaal commented May 13, 2019

The txtar file format is simple, but too simple. For example, an archive containing the file go/src/cmd/go/internal/txtar/archive_test.go itself will not round-trip correctly, because that file contains literals that look like file separators.

The spec should include an escaping/quoting scheme.

@rogpeppe
Copy link
Contributor

Personally, I like the ultra-simple nature of the file format, although it's true that sometimes you do want to have a file that contains the separators. That's possible to work around, however. In this fork of testscript, I've provided unquote as a standard primitive. It just removes the leading > from the start of each line. I also changed the txtar-c command so that you can ask it to do the quoting for you.

Perhaps that approach might work for the internal testscript code too.

@andybons andybons changed the title txtar: no escaping for file separator cmd/go/internal/txtar: no escaping for file separator May 13, 2019
@andybons andybons added modules NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 13, 2019
@andybons andybons added this to the Unplanned milestone May 13, 2019
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 13, 2019
@andybons
Copy link
Member

@jayconrod @bcmills

@jayconrod
Copy link
Contributor

Agree with @rogpeppe, the simplicity of this format is really valuable. I'd rather not add features to it.

@ianthehat mentioned another case that doesn't roundtrip correctly: files that don't end with a newline. As with the unquote feature above, he recommends processing these files before and after packing them into txtar (adding newlines to files before packing, removing newlines after).

@golang golang locked and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants