git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-p4: fix bug with encoding of p4 client name

From
Tao Klerks <tao@klerks.biz>
Date
Jul 8, 2022, 11:28 UTC
Message-ID
<CAPMMpohwP1U4pr-G=fDDu_AHTY-2mn8hn8zBf-pAsmm=w0mSzw@mail.gmail.com>
In-Reply-To
<pull.1285.git.git.1657267260405.gitgitgadget@gmail.com>

This makes sense to me, and I don't see anything wrong with the "form" (and nor does GitGitGadget).

Not sure whether formal review sign-off is used on this list, I don't tend to see it, but do I see "Reviewed-by" on patches, so FWIW:

Reviewed-by: Tao Klerks <tao@klerks.biz>

On Fri, Jul 8, 2022 at 10:01 AM Kilian Kilger via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 51 quoted lines
>
> From: Kilian Kilger <kilian.kilger@sap.com>
>
> The Perforce client name can contain arbitrary characters
> which do not decode to UTF-8. Use the fallback strategy
> implemented in metadata_stream_to_writable_bytes() also
> for the client name.
>
> Signed-off-by: Kilian Kilger <kkilger@gmail.com>
> ---
>     git-p4: Fix bug with encoding of P4 client name
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1285%2Fcohomology%2Fmaint-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1285/cohomology/maint-v1
> Pull-Request: https://github.com/git/git/pull/1285
>
>  git-p4.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 8fbf6eb1fe3..e65d6a2b0e1 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -854,12 +854,12 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
>              if bytes is not str:
>                  # Decode unmarshalled dict to use str keys and values, except for:
>                  #   - `data` which may contain arbitrary binary data
> -                #   - `desc` or `FullName` which may contain non-UTF8 encoded text handled below, eagerly converted to bytes
> +                #   - `desc` or `client` or `FullName` which may contain non-UTF8 encoded text handled below, eagerly converted to bytes
>                  #   - `depotFile[0-9]*`, `path`, or `clientFile` which may contain non-UTF8 encoded text, handled by decode_path()
>                  decoded_entry = {}
>                  for key, value in entry.items():
>                      key = key.decode()
> -                    if isinstance(value, bytes) and not (key in ('data', 'desc', 'FullName', 'path', 'clientFile') or key.startswith('depotFile')):
> +                    if isinstance(value, bytes) and not (key in ('data', 'desc', 'FullName', 'path', 'clientFile', 'client') or key.startswith('depotFile')):
>                          value = value.decode()
>                      decoded_entry[key] = value
>                  # Parse out data if it's an error response
> @@ -871,6 +871,8 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
>                      continue
>              if 'desc' in entry:
>                  entry['desc'] = metadata_stream_to_writable_bytes(entry['desc'])
> +            if 'client' in entry:
> +                entry['client'] = metadata_stream_to_writable_bytes(entry['client'])
>              if 'FullName' in entry:
>                  entry['FullName'] = metadata_stream_to_writable_bytes(entry['FullName'])
>              if cb is not None:
>
> base-commit: e4a4b31577c7419497ac30cebe30d755b97752c5
> --
> gitgitgadget
Previous: Kilian Kilger via GitGitGadgetNext: Junio C Hamano
Message 2 of 9 in “git-p4: fix bug with encoding of p4 client name”
  1. git-p4: fix bug with encoding of p4 client nameKilian Kilger via GitGitGadget, Jul 8, 2022
  2. Tao KlerksJul 8, 2022
  3. Junio C HamanoJul 8, 2022
  4. git-p4: fix bug with encoding of p4 client nameKilian Kilger via GitGitGadget, Jul 18, 2022
  5. Junio C HamanoJul 18, 2022
  6. 0/2 git-p4: Fix bug with encoding of P4 client nameKilian Kilger via GitGitGadget, Jul 21, 2022
  7. 1/2 git-p4: fix bug with encoding of p4 client nameKilian Kilger via GitGitGadget, Jul 21, 2022
  8. 2/2 git-p4: refactoring of p4CmdList()Kilian Kilger via GitGitGadget, Jul 21, 2022
  9. Junio C HamanoJul 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.