)]}'
{
  "commit": "ec192f7fc9b5cab9aa34c8135e60aba3670edf53",
  "tree": "8c60fa17fd28741ee4626fba31e5fd01e4695cd2",
  "parents": [
    "4ffd73054a515af570168d98d97c8644b06f1951"
  ],
  "author": {
    "name": "Zack Weinberg",
    "email": "zack@owlfolio.org",
    "time": "Wed Jun 26 14:42:44 2024 -0400"
  },
  "committer": {
    "name": "Zack Weinberg",
    "email": "zack@owlfolio.org",
    "time": "Wed Jun 26 16:03:57 2024 -0400"
  },
  "message": "WIP: replace AS_ESCAPE and _AS_QUOTE with AS_QUOTE_D.\n\nAS_ESCAPE is difficult or even impossible to use correctly,\ndepending on what you’re trying to do with it:\n\n+ AS_ESCAPE([text], [`\\\"]) is intended to permit variable interpolation\n  but prevent command substitution.  This does not work anymore,\n  because we have $(...) command substitution nowadays, Solaris 10\n  notwithstanding.\n+ It is incorrect to leave \\ or \" out of the [chars] argument, but people\n  do this all the dang time both in our own code and in third-party code.\n+ It is incorrect to put anything in [chars] besides $ ` \\ \", but people\n  also do this.  In particular, \u0027AS_ESCAPE([text], [\\\u0027])\u0027 *does not*\n  produce a correct single-quoted string, but at least one third-party\n  m4 macro does this anyway.\n+ In most cases you need to write AS_ESCAPE(m4_dquote(m4_expand([text])))\n  or else M4 macros inside [text] will be expanded *after* the quotation\n  process is complete, and the text they expand to won’t get escaped.\n  *Our* code using AS_ESCAPE was diligent about this, but almost no\n  no third-party uses bothered.\n+ Almost all uses of AS_ESCAPE are constructing double-quoted strings,\n  so it would be more ergonomic if it added the outermost quotes for you.\n\n(All assertions about third-party code courtesy of\n\u003chttp://codesearch.debian.net/search?q\u003d%5CbAS_ESCAPE%5Cb+-pkg%3Aautoconf+-pkg%3Aautoconf2.69\u0026literal\u003d0\u003e.)\n\nThe internal _AS_QUOTE macro is also almost impossible to use\ncorrectly, for the above reasons plus the fact that it includes some\n20-year-old *internal* backward compatibility logic that doesn’t\ndistinguish ${variable} from $(command) either.\n\nReplace with a safer API:\n\n+ New macro AS_QUOTE_S([text]) turns TEXT into a single-quoted string,\n  *correctly* escaping embedded single quotes, and supplying an outer\n  pair of quotes. Macros in TEXT are expanded once before quotation.\n\n+ New macro AS_QUOTE_D([text], [interpolation]) turns TEXT into a\n  double-quoted string, supplying an outer pair of quotes. Macros in\n  TEXT are expanded once before quotation.\n\n  The INTERPOLATION argument is a comma-separated list of keywords\n  specifying what types of interpolation will be permitted:\n\n    - ‘allow-vars’: Allow variable and arithmetic interpolation.\n    - ‘allow-commands’: Allow command substitution.\n\n  If the argument is empty or omitted, no interpolation is allowed.\n\n  This is intentionally verbose and there is no ‘allow-all’, because\n  I want people to think hard about if it’s really a good idea before\n  enabling command substitution, and I want it to be easy to find all\n  the place’s it’s being used.  (Almost all uses of AS_ESCAPE, both\n  internally and externally, want either no interpolation or only\n  variable interpolation.)  Both `...` and $(...) are handled correctly\n  in all modes.\n\n+ AS_ESCAPE is changed to map each of the valid possibilities for CHARS\n  to the AS_QUOTE_D interpolation mode that was probably intended,\n  papering over the bugs in third party macros.  (For example, both\n  [`\\\"] and [`] by itself will be mapped to allow-vars mode, because\n  we presume that someone who wrote [‘] didn’t think it through and\n  there’s a latent bug.)  Invalid CHARS arguments now raise an error\n  instead of silently doing something nonsensical.  All uses trigger\n  a -Wobsolete warning.  AS_ESCAPE cannot be autoupdated to AS_QUOTE_D\n  (because it’s an m4sh macro, and because autoupdate can’t edit out\n  the surrounding quote marks) so instead I wrote a whole bunch of\n  advice for manual conversion in the manual.\n\nWIP: buggy (partially but not entirely because of the bugs in\nm4_join_uniq); one internal use of AS_ESCAPE remains; need to\nwrite tests and NEWS; unresolved design decisions including\n\n+ should ‘allow-arithmetic’ be a third interpolation keyword, separate\n  from ‘allow-vars’?\n+ do we want a public API for escaping *without* adding surrounding\n  quotes? Autotest was doing this but it didn’t particularly need to.\n+ should the result of AS_QUOTE_[DS] be M4-quoted? Currently it isn’t.\n+ is expand-once-then-quote [i.e. shellquote(m4_dquote(m4_expand([text])))]\n  the most ergonomic behavior?\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a500de356a82d0786996f8d936927d0d12dbe15e",
      "old_mode": 33188,
      "old_path": "doc/autoconf.texi",
      "new_id": "c806286657207e7456875dd2bddb66239fc9b44f",
      "new_mode": 33188,
      "new_path": "doc/autoconf.texi"
    },
    {
      "type": "modify",
      "old_id": "99c0cf5e6db26d99dd3278c88df0d4d1864fe230",
      "old_mode": 33188,
      "old_path": "lib/autoconf/autoheader.m4",
      "new_id": "ba7d3f8ec460d0822da4a3327146375415605e16",
      "new_mode": 33188,
      "new_path": "lib/autoconf/autoheader.m4"
    },
    {
      "type": "modify",
      "old_id": "f5ad64baf832a7a4b90200fc716094cb501edcb8",
      "old_mode": 33188,
      "old_path": "lib/autoconf/general.m4",
      "new_id": "2953191b91c9238cdfd43d95373f9ee13f6b32e4",
      "new_mode": 33188,
      "new_path": "lib/autoconf/general.m4"
    },
    {
      "type": "modify",
      "old_id": "dec8538b3dfd9edcc1c984226a023805af56d1fa",
      "old_mode": 33188,
      "old_path": "lib/autoconf/headers.m4",
      "new_id": "15fc643f8b4c3a54c0c190597f5b52d0c7ac228d",
      "new_mode": 33188,
      "new_path": "lib/autoconf/headers.m4"
    },
    {
      "type": "modify",
      "old_id": "f231fcfcd9b06fa9f995aede601015224d4ad163",
      "old_mode": 33188,
      "old_path": "lib/autoconf/types.m4",
      "new_id": "ae66afffe89afea0516f98babcb3333894e785f8",
      "new_mode": 33188,
      "new_path": "lib/autoconf/types.m4"
    },
    {
      "type": "modify",
      "old_id": "a0668dde22abe5c37fd9e7728c99ded332412b81",
      "old_mode": 33188,
      "old_path": "lib/autotest/general.m4",
      "new_id": "4825bc60f6296171001293f7aa4d91a4fe0cb4d1",
      "new_mode": 33188,
      "new_path": "lib/autotest/general.m4"
    },
    {
      "type": "modify",
      "old_id": "ba6d54098acd1afef9ff4724e945ec12513a4e0e",
      "old_mode": 33188,
      "old_path": "lib/m4sugar/m4sh.m4",
      "new_id": "4538a3d4b0ea825a6b247bb0bbac36cd3d01c790",
      "new_mode": 33188,
      "new_path": "lib/m4sugar/m4sh.m4"
    }
  ]
}
