[build-path-prefix-map-spec] 36/50: Change %pec to %#+. as suggested by Ian

Ximin Luo infinity0 at debian.org
Fri Mar 10 15:17:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository build-path-prefix-map-spec.

commit 5d3909b5a9235badde9b4b46779d2ddf0bd69a29
Author: Ximin Luo <infinity0 at debian.org>
Date:   Thu Feb 23 19:50:44 2017 +0100

    Change %pec to %#+. as suggested by Ian
---
 consume/pecsplit.c                         |  6 +++---
 consume/pecsplit.js                        |  4 ++--
 consume/pecsplit.py                        |  4 ++--
 consume/pecsplit.rs                        |  8 ++++----
 consume/testcases/0.ordering.pecsplit.env  |  2 +-
 consume/testcases/pecsplit.0.empty-ok.env  |  2 +-
 consume/testcases/pecsplit.0.non-utf8.env  |  2 +-
 consume/testcases/pecsplit.1.long-pc-1.env |  2 +-
 consume/testcases/pecsplit.1.long-pc-2.env |  2 +-
 consume/testcases/pecsplit.1.long-pc-3.env |  2 +-
 consume/testcases/pecsplit.1.long-pc-4.env |  2 +-
 consume/testcases/pecsplit.1.long-pc-5.env |  2 +-
 spec-draft.rst                             | 18 +++++++++---------
 13 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/consume/pecsplit.c b/consume/pecsplit.c
index ede8ece..d62c767 100644
--- a/consume/pecsplit.c
+++ b/consume/pecsplit.c
@@ -15,13 +15,13 @@ unquote (char *src)
       case '%':
 	switch (*(src + 1))
 	  {
-	  case 'c':
+	  case '.':
 	    *dest = ':';
 	    goto unquoted;
-	  case 'e':
+	  case '+':
 	    *dest = '=';
 	  unquoted:
-	  case 'p':
+	  case '#':
 	    ++src;
 	    break;
 	  default:
diff --git a/consume/pecsplit.js b/consume/pecsplit.js
index aa659aa..43effcf 100755
--- a/consume/pecsplit.js
+++ b/consume/pecsplit.js
@@ -3,9 +3,9 @@
 // Parsing the variable
 
 var unquote = function(x) {
-  if (x.search(/%[^pec]|%$/) >= 0)
+  if (x.search(/%[^#+\.]|%$/) >= 0)
     throw "invalid value: bad escape: " + x;
-  return x.replace(/%c/g, ':').replace(/%e/g, '=').replace(/%p/g, '%');
+  return x.replace(/%\./g, ':').replace(/%\+/g, '=').replace(/%#/g, '%');
 };
 
 var parse_prefix_map = function(x) {
diff --git a/consume/pecsplit.py b/consume/pecsplit.py
index c9a1f1a..5da172d 100755
--- a/consume/pecsplit.py
+++ b/consume/pecsplit.py
@@ -7,9 +7,9 @@ import sys
 # Parsing the variable
 
 def _dequote(part):
-  if re.search(r"%[^pec]|%$", part):
+  if re.search(r"%[^#+\.]|%$", part):
     raise ValueError("bad escape: %s" % part)
-  return part.replace("%c", ':').replace("%e", '=').replace("%p", '%');
+  return part.replace("%.", ':').replace("%+", '=').replace("%#", '%');
 
 def decode(prefix_str):
   tuples = (part.split("=") for part in prefix_str.split(":") if part)
diff --git a/consume/pecsplit.rs b/consume/pecsplit.rs
index 633c4d6..2d1bb18 100644
--- a/consume/pecsplit.rs
+++ b/consume/pecsplit.rs
@@ -13,7 +13,7 @@ fn pathbuf_to_u8(path: &PathBuf) -> &[u8] {
 /* the polymorphism is to handle u8 (POSIX) and u16 (windows) */
 fn dequote<T>(s: &[T]) -> Result<Vec<T>, &'static str> where u16: From<T>, T: From<u8>, T: Copy {
   // unfortunately we can't do sting-replace on arbitrary Vecs
-  // s.replace("%c", ':').replace("%e", '=').replace("%p", '%')
+  // s.replace("%.", ':').replace("%+", '=').replace("%#", '%')
   let mut v = Vec::with_capacity(s.len());
   let mut escaped = false;
   for c in s {
@@ -24,9 +24,9 @@ fn dequote<T>(s: &[T]) -> Result<Vec<T>, &'static str> where u16: From<T>, T: Fr
       0x3D /* = */ => unreachable!(),
       _ => if escaped {
         match c16 {
-          0x70 /* p */ => { v.pop(); v.pop(); v.push(T::from(b'%')) },
-          0x65 /* e */ => { v.pop(); v.pop(); v.push(T::from(b'=')) },
-          0x63 /* c */ => { v.pop(); v.pop(); v.push(T::from(b':')) },
+          0x23 /* # */ => { v.pop(); v.pop(); v.push(T::from(b'%')) },
+          0x2B /* + */ => { v.pop(); v.pop(); v.push(T::from(b'=')) },
+          0x2E /* . */ => { v.pop(); v.pop(); v.push(T::from(b':')) },
           _ => break // to the "Err" clause
         }
       }
diff --git a/consume/testcases/0.ordering.pecsplit.env b/consume/testcases/0.ordering.pecsplit.env
index cac1660..685a938 100644
--- a/consume/testcases/0.ordering.pecsplit.env
+++ b/consume/testcases/0.ordering.pecsplit.env
@@ -1 +1 @@
-/a/b%eyyy=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/b%eyyy=libbar-3-bison++_41%c10.5-3~rc1pre3+dfsg1.1-3nmu1+b4
+/a/b%+yyy=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/b%+yyy=libbar-3-bison++_41%.10.5-3~rc1pre3+dfsg1.1-3nmu1+b4
diff --git a/consume/testcases/pecsplit.0.empty-ok.env b/consume/testcases/pecsplit.0.empty-ok.env
index 11e575a..8b4ea22 100644
--- a/consume/testcases/pecsplit.0.empty-ok.env
+++ b/consume/testcases/pecsplit.0.empty-ok.env
@@ -1 +1 @@
-:/a/b%eyyy=ERROR:/a=lol::/b=foo:/a/b%eyyy=libbar-3-bison++_41%c10.5-3~rc1pre3+dfsg1.1-3nmu1+b4:
+:/a/b%+yyy=ERROR:/a=lol::/b=foo:/a/b%+yyy=libbar-3-bison++_41%.10.5-3~rc1pre3+dfsg1.1-3nmu1+b4:
diff --git a/consume/testcases/pecsplit.0.non-utf8.env b/consume/testcases/pecsplit.0.non-utf8.env
index 5215f13..d7693b8 100644
--- a/consume/testcases/pecsplit.0.non-utf8.env
+++ b/consume/testcases/pecsplit.0.non-utf8.env
@@ -1 +1 @@
-/a/b%eyyy=result�:/a=lol%p%p:/b%p=foo%p%p:/a/b%eyyy=result�:/a/b%eyyy�=sec%creteh
+/a/b%+yyy=result�:/a=lol%#%#:/b%#=foo%#%#:/a/b%+yyy=result�:/a/b%+yyy�=sec%.reteh
diff --git a/consume/testcases/pecsplit.1.long-pc-1.env b/consume/testcases/pecsplit.1.long-pc-1.env
index 1498a1b..b7c0bf6 100644
--- a/consume/testcases/pecsplit.1.long-pc-1.env
+++ b/consume/testcases/pecsplit.1.long-pc-1.env
@@ -1 +1 @@
-%%p/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar
+%%#/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar
diff --git a/consume/testcases/pecsplit.1.long-pc-2.env b/consume/testcases/pecsplit.1.long-pc-2.env
index bffaf74..9c04704 100644
--- a/consume/testcases/pecsplit.1.long-pc-2.env
+++ b/consume/testcases/pecsplit.1.long-pc-2.env
@@ -1 +1 @@
-/a/zzz%%p=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar
+/a/zzz%%#=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar
diff --git a/consume/testcases/pecsplit.1.long-pc-3.env b/consume/testcases/pecsplit.1.long-pc-3.env
index 89026b6..5b128af 100644
--- a/consume/testcases/pecsplit.1.long-pc-3.env
+++ b/consume/testcases/pecsplit.1.long-pc-3.env
@@ -1 +1 @@
-/a/zzz=ERROR:/a=%%plol:/b/1234=ERROR:/b=foo:/a/yyy=bar
+/a/zzz=ERROR:/a=%%#lol:/b/1234=ERROR:/b=foo:/a/yyy=bar
diff --git a/consume/testcases/pecsplit.1.long-pc-4.env b/consume/testcases/pecsplit.1.long-pc-4.env
index 343bec5..d6521be 100644
--- a/consume/testcases/pecsplit.1.long-pc-4.env
+++ b/consume/testcases/pecsplit.1.long-pc-4.env
@@ -1 +1 @@
-/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo%%p:/a/yyy=bar
+/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo%%#:/a/yyy=bar
diff --git a/consume/testcases/pecsplit.1.long-pc-5.env b/consume/testcases/pecsplit.1.long-pc-5.env
index 1b712bd..b7026cd 100644
--- a/consume/testcases/pecsplit.1.long-pc-5.env
+++ b/consume/testcases/pecsplit.1.long-pc-5.env
@@ -1 +1 @@
-/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar%%p
+/a/zzz=ERROR:/a=lol:/b/1234=ERROR:/b=foo:/a/yyy=bar%%#
diff --git a/spec-draft.rst b/spec-draft.rst
index 73e5e2c..b18b30b 100644
--- a/spec-draft.rst
+++ b/spec-draft.rst
@@ -60,12 +60,12 @@ The encoding is as follows:
 
 - Each encoded pair element is encoded with the following mapping:
 
-  1. ``%`` → ``%p``
-  2. ``=`` → ``%e``
-  3. ``:`` → ``%c``
+  1. ``%`` → ``%#``
+  2. ``=`` → ``%+``
+  3. ``:`` → ``%.``
 
   When decoding, ``%`` characters at the end of a string are a parse error, as
-  are ``%[X]`` substrings where ``[X]`` is any character not in ``pec``.
+  are ``%[X]`` substrings where ``[X]`` is any character not in ``#+.``.
 
   This encoding allows paths containing ``%``, ``=``, ``:`` to be mapped; since
   users may want to run their builds under such paths. However as a producer,
@@ -75,20 +75,20 @@ The encoding is as follows:
   Implementation notes: due to our choice of characters, there is flexibility
   in the order in which these mappings may be applied; this is meant to ease
   implementation in a variety of programming languages. The only restriction is
-  that the ``%`` → ``%p`` mapping for encoding must not be applied on
-  already-encoded %-substrings; and that the ``%e`` → ``=``, ``%c`` → ``:``
+  that the ``%`` → ``%#`` mapping for encoding must not be applied on
+  already-encoded %-substrings; and that the ``%+`` → ``=``, ``%.`` → ``:``
   mappings for decoding must not be applied on already-decoded %-substrings.
 
   Our recommended approach for a high-level language with string replace:
 
   A. decoding:
 
-     1. check elem does not match the regex ``/%[^pec]|%$/g``, then
-     2. ``elem.replace("%c", ':').replace("%e", '=').replace("%p", '%')``
+     1. check elem does not match the regex ``/%[^#+\.]|%$/g``, then
+     2. ``elem.replace("%.", ':').replace("%+", '=').replace("%#", '%')``
 
   B. encoding:
 
-     1. ``elem.replace("%p", '%').replace("%e", '=').replace("%c", ':')``
+     1. ``elem.replace("%#", '%').replace("%+", '=').replace("%.", ':')``
 
   Our recommended approach for a low-level language without string replace:
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/build-path-prefix-map-spec.git



More information about the Reproducible-commits mailing list