Skip to content

Instantly share code, notes, and snippets.

@acdha
Last active January 23, 2017 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acdha/9726164f1e3ac7fdc81d38aae960ada8 to your computer and use it in GitHub Desktop.
Save acdha/9726164f1e3ac7fdc81d38aae960ada8 to your computer and use it in GitHub Desktop.
Example using Git attributes to make human-friendly output from custom file formats
bagit.xml diff=xml2rfc
[diff "xml2rfc"]
textconv = xml2rfc --quiet --out=/dev/stdout
commit e6770927bbd594d4a0a3e49dd7b8bc5897e4a394
Author: Chris Adams <cadams@loc.gov>
Date: Mon Jan 23 10:07:57 2017 -0500
Update “special directory characters” prose
diff --git a/bagit.xml b/bagit.xml
index 96e466a..8ad9fd6 100644
--- a/bagit.xml
+++ b/bagit.xml
@@ -564,18 +564,20 @@ Internet-Draft BagIt December 2016
5.1. Special directory characters
- The paths specified in the payload manifest, and tag manifest file do
- not prohibit special directory characters which might be significant
- on implementing systems. Implementors MUST ensure that files outside
- the bag directory structure are not accessed when reading or writing
- files based on paths specified in a bag.
+ The paths specified in the payload manifest and tag manifest file do
+ not prohibit special directory characters which have special meaning
+ on some operating systems. Implementors MUST ensure that files
+ outside the bag directory structure are not accessed when reading or
+ writing files based on paths specified in a bag.
+
+ All implementations SHOULD have a test suite to guard against these
+ cases.
For example, a maliciously crafted "tagmanifest-md5.txt" file might
contain entries which begin with a path character such as "/", "..",
or a "~username" home directory reference in an attempt to cause a
- naive implementation to leak or overwrite targeted files. All
- implementations SHOULD have a test suite to guard against these
- cases.
+ naive implementation to leak or overwrite targeted files on a POSIX
+ operating system.
Windows implementations SHOULD test their implementations to ensure
that safety-checks prevent use of drive letters and the less commonly
@@ -608,16 +610,16 @@ Internet-Draft BagIt December 2016
multiple files which differ only in case: "example.txt" and
"Example.txt" are separate files
+
+
+
+Boyko, et al. Expires June 9, 2017 [Page 11]
+
+Internet-Draft BagIt December 2016
+
+
o NTFS and HFS+ usually preserve case when storing files but are
case-insensitive when retrieving them. A file saved as
-
-
-
-Boyko, et al. Expires June 9, 2017 [Page 11]
-
-Internet-Draft BagIt December 2016
-
-
"Example.txt" will be retrieved by that name but will also be
retrieved as "EXAMPLE.TXT", "example.txt", etc.
@@ -667,8 +669,6 @@ Internet-Draft BagIt December 2016
-
-
Boyko, et al. Expires June 9, 2017 [Page 12]
Internet-Draft BagIt December 2016
commit 0257f7bc35bc8e56a990d52e196459b33c66381e
Author: Chris Adams <cadams@loc.gov>
Date: Mon Jan 23 10:07:37 2017 -0500
Update “filesystem” reference in “complete” requirements
Since people may wish to use things which aren’t commonly
considered filesystems (object stores, archive files, etc.)
this should be more generic.
diff --git a/bagit.xml b/bagit.xml
index a23c515..96e466a 100644
--- a/bagit.xml
+++ b/bagit.xml
@@ -93,7 +93,7 @@ Table of Contents
3. Complete, Incomplete, and Valid bags . . . . . . . . . . . . 9
4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1. Example of a basic bag . . . . . . . . . . . . . . . . . 10
- 5. Security Considerations . . . . . . . . . . . . . . . . . . . 11
+ 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10
5.1. Special directory characters . . . . . . . . . . . . . . 11
6. Practical Considerations (non-normative) . . . . . . . . . . 11
6.1. Interoperability . . . . . . . . . . . . . . . . . . . . 11
@@ -506,11 +506,9 @@ Boyko, et al. Expires June 9, 2017 [Page 9]
Internet-Draft BagIt December 2016
- 2. Every file in every tag manifest MUST be present on the
- filesystem.
+ 2. Every file listed in every tag manifest MUST be present.
- 3. Every file in every payload manifest MUST be present on the
- filesystem.
+ 3. Every file listed in every payload manifest MUST be present.
4. Every payload file MUST be listed in every payload manifest.
@@ -551,19 +549,19 @@ Internet-Draft BagIt December 2016
| (... OCR text ... )
....
-
-
-
-
-
-
-Boyko, et al. Expires June 9, 2017 [Page 10]
-
-Internet-Draft BagIt December 2016
-
-
5. Security Considerations
+
+
+
+
+
+
+Boyko, et al. Expires June 9, 2017 [Page 10]
+
+Internet-Draft BagIt December 2016
+
+
5.1. Special directory characters
The paths specified in the payload manifest, and tag manifest file do
@@ -610,16 +608,16 @@ Internet-Draft BagIt December 2016
multiple files which differ only in case: "example.txt" and
"Example.txt" are separate files
-
-
-
-Boyko, et al. Expires June 9, 2017 [Page 11]
-
-Internet-Draft BagIt December 2016
-
-
o NTFS and HFS+ usually preserve case when storing files but are
case-insensitive when retrieving them. A file saved as
+
+
+
+Boyko, et al. Expires June 9, 2017 [Page 11]
+
+Internet-Draft BagIt December 2016
+
+
"Example.txt" will be retrieved by that name but will also be
retrieved as "EXAMPLE.TXT", "example.txt", etc.
@@ -669,6 +667,8 @@ Internet-Draft BagIt December 2016
+
+
Boyko, et al. Expires June 9, 2017 [Page 12]
Internet-Draft BagIt December 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment