From: Junio C Hamano <gitster@pobox.com>
To: Joel Holdsworth <jholdsworth@nvidia.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Tzadik Vanderhoof <tzadik.vanderhoof@gmail.com>,
Dorgon Chang <dorgonman@hotmail.com>,
Joachim Kuebart <joachim.kuebart@gmail.com>,
Daniel Levin <dendy.ua@gmail.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>,
Luke Diamand <luke@diamand.org>, Ben Keene <seraphire@gmail.com>,
Andrew Oakley <andrew@adoakley.name>
Subject: Re: [PATCH 4/4] git-p4: resolve RCS keywords in binary
Date: Wed, 15 Dec 2021 13:41:01 -0800 [thread overview]
Message-ID: <xmqqczlx4kcy.fsf@gitster.g> (raw)
In-Reply-To: <BN8PR12MB336146CB8B6FD458AE3BE42BC8759@BN8PR12MB3361.namprd12.prod.outlook.com> (Joel Holdsworth's message of "Tue, 14 Dec 2021 13:12:13 +0000")
Joel Holdsworth <jholdsworth@nvidia.com> writes:
>> Makes sense, and I am with others who commented on the previous
>> discussion thread that the right approach to take is to take the stuff coming
>> from Perforce as byte strings, process them as such and write them out as
>> byte strings, UNLESS we positively know what the source and destination
>> encodings are.
>>
>> And this change we see here, matching with patterns, is perfectly in line with
>> that direction. Very nice.
>
> Not bad. Fortunately, it's not possible for $ characters to appear as a component of a multi-byte UTF-8 character, so it's possible to do the matching byte-wise.
>
>>
>> > try:
>> > - with os.fdopen(handle, "w+") as outFile, open(file, "r") as inFile:
>> > + with os.fdopen(handle, "wb") as outFile, open(file, "rb") as inFile:
>>
>> We seem to have lost "w+" and now it is "wb". I do not see a reason to make
>> outFile anything but write-only, so the end result looks good to me, but is it
>> an unrelated "bug"fix that should be explained as such (e.g. "there is no
>> reason to make outFile read-write, so instead of using 'w+' just use 'wb'
>> while we make it unencoded output by adding 'b' to it")?
>
> I am happy to split this change into a separate patch if this is preferred.
I do not think this is big enough for a separate patch; just a
mention in the log message is sufficient.
next prev parent reply other threads:[~2021-12-15 21:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 22:54 [PATCH 0/4] git-p4: fix RCS keyword processing encoding errors Joel Holdsworth
2021-12-13 22:54 ` [PATCH 1/4] git-p4: use with statements to close files after use in patchRCSKeywords Joel Holdsworth
2021-12-13 22:54 ` [PATCH 2/4] git-p4: pre-compile RCS keyword regexes Joel Holdsworth
2021-12-13 22:54 ` [PATCH 3/4] git-p4: add raw option to read_pipelines Joel Holdsworth
2021-12-13 22:54 ` [PATCH 4/4] git-p4: resolve RCS keywords in binary Joel Holdsworth
2021-12-13 23:34 ` Junio C Hamano
2021-12-14 13:12 ` Joel Holdsworth
2021-12-15 21:41 ` Junio C Hamano [this message]
2021-12-14 22:36 ` [PATCH 0/4] git-p4: fix RCS keyword processing encoding errors Andrew Oakley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqczlx4kcy.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andrew@adoakley.name \
--cc=dendy.ua@gmail.com \
--cc=dorgonman@hotmail.com \
--cc=git@vger.kernel.org \
--cc=jholdsworth@nvidia.com \
--cc=joachim.kuebart@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=luke@diamand.org \
--cc=seraphire@gmail.com \
--cc=tzadik.vanderhoof@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).