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

Re: [PATCH] Fix mishandling of $Id$ expanded in the repository copy in convert.c

From
Junio C Hamano <junkio@cox.net>
Date
May 26, 2007, 08:09 UTC
Message-ID
<7vlkfcm2eu.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200705251150.09439.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
> I've included the comments I wrote while debugging in this patch, which
> I'm sure will annoy you, because you'd rather the fix and the comments
> separately.  I'll supply that if you wish - just holler.

Actually I like well commented code, although some of your comments feel a tad too much at places. For example,

Show 6 quoted lines
>  	for (dst = buf; size; size--) {
>  		const char *cp;
> +		/* Fetch next source character, move the pointer on */
>  		char ch = *src++;
> +		/* Copy the current character to the destination */
>  		*dst++ = ch;
These are too much.
Show 13 quoted lines
> +		/* If the current character is "$" or there are less than three
> +		 * remaining bytes or the two bytes following this one are not
> +		 * "Id", then simply read the next character */
>  		if ((ch != '$') || (size < 3) || memcmp("Id", src, 2))
>  			continue;
> +		/*
> +		 * Here when
> +		 *  - There are more than 2 bytes remaining
> +		 *  - The current three bytes are "$Id$"
> +		 * with
> +		 *  - ch == "$"
> +		 *  - src[0] == "I"
> +		 */

But this is very good, if you fix it to read the current 3 are "$Id" ;-).

> +		/*
> +		 * It's possible that an expanded Id has crept its way into the
> +		 * repository, we cope with that by stripping the expansion out
> +		 */
So are all the other comments.

Thanks for the fix. It would be very nice for the patch to be accompanied with a new test to expose the bug and demonstrate that the patch fixes it.

Previous: Joshua N PritikinNext: Andy Parkins
Message 9 of 13 in “Fix mishandling of $Id$ expanded in the repository copy in convert.c”
  1. Fix mishandling of $Id$ expanded in the repository copy in convert.cAndy Parkins, May 25, 2007
  2. Joshua N PritikinMay 25, 2007
  3. Andy ParkinsMay 25, 2007
  4. Don't allow newlines to occur in $Id:$ collapseAndy Parkins, May 25, 2007
  5. Joshua N PritikinMay 25, 2007
  6. Nicolas PitreMay 25, 2007
  7. Andy ParkinsMay 25, 2007
  8. Joshua N PritikinMay 25, 2007
  9. Junio C HamanoMay 26, 2007
  10. Andy ParkinsMay 26, 2007
  11. Junio C HamanoMay 26, 2007
  12. Andy ParkinsMay 27, 2007
  13. Add test case for $Id$ expanded in the repositoryAndy Parkins, May 27, 2007

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.