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

Re: [PATCH] git-am: force egrep to use correct characters set

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 28, 2009, 09:53 UTC
Message-ID
<4AC0877E.7020204@viscovery.net>
In-Reply-To
<20090928093216.GA31459@lamagra.informatik.uni-ulm.de>
Christian Himpel schrieb:
Show 6 quoted lines
> After doing a quick:
> 
> LC_ALL=C find . -name '*.sh' -exec \
>          egrep -Hne '(grep|awk|sed).*\[.*-.*\]' {} \;
> 
> As far as I can see, range expressions are used:
0. The test suite scripts are not critical because test-lib.sh sets LANG=C
LC_ALL=C
> 1. to replace or grep hexadecimal numbers (SHA1 sums).  This shouldn't
> be a problem, if we can assume that these numbers are never malformed.

The assumption is valid if the input is piped from a git command, and such uses aren't critical.

> 2. to replace or grep numbers (with digits).  This shouldn't be a
> problem, since digits should be in dictionary order in every language
> (?!).
I agree.
> 3. in git-rebase--interactive.sh:742 to grep for a previously generated
> string.  So it should be safe here.
I agree.
Show 7 quoted lines
>> The case identified by Christian is certainly important because it is
>> applied to a file whose contents can be anything, and the purpose of the
>> check is to identify the text as an mbox file, whose header section can be
>> only US-ASCII by definition. So, I think it has merit to apply the patch.
> 
> Yes.  It seems that this is the only place where it is important to match
> just the ASCII printable characters.

There is another place in git-am.sh where a sed expression with a range looks at the input file, doesn't it? Isn't it critical, too?

		if test -f "$dotest/rebasing" &&
			commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
				-e q "$dotest/$msgnum") &&
			test "$(git cat-file -t "$commit")" = commit
		then ...
-- Hannes
Previous: Christian HimpelNext: Christian Himpel
Message 10 of 11 in “git-am: fixed patch_format detection according to RFC2822”
  1. 1/2 git-am: fixed patch_format detection according to RFC2822Christian Himpel, Sep 25, 2009
  2. 2/2 git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  3. 2/2 git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  4. git-am: force egrep to use correct characters setChristian Himpel, Sep 25, 2009
  5. Jeff KingSep 27, 2009
  6. Christian HimpelSep 28, 2009
  7. Jeff KingSep 28, 2009
  8. Johannes SixtSep 28, 2009
  9. Christian HimpelSep 28, 2009
  10. Johannes SixtSep 28, 2009
  11. Christian HimpelSep 28, 2009

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.