git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Martin Waitz <tali@admingilde.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] Submodule merge support
Date: Mon, 21 May 2007 02:20:05 -0400	[thread overview]
Message-ID: <20070521062005.GK3141@spearce.org> (raw)
In-Reply-To: <20070520154227.GG5412@admingilde.org>

> @@ -574,6 +575,21 @@ static void update_file_flags(const unsigned char *sha,
>  		void *buf;
>  		unsigned long size;
>  
> +		if (S_ISDIRLNK(mode)) {
> +			/* defer dirlinks to another process, don't try to */
> +			/* read the object "sha" here */
> +			const char *dirlink_checkout[] = {
> +				"dirlink-checkout", path, sha1_to_hex(sha), NULL
> +			};
> +			struct child_process cmd = {
> +				.argv = dirlink_checkout,
> +				.git_cmd = 1,
> +			};

My Solaris 9 system cannot compile this syntax, even though it is
a clean way to initalize the child_process.  That's why I've always
used something more like:

	struct child_process cmd;
	memset(&cmd, 0, sizeof(cmd));
	cmd.argv = dirlink_checkout;
	cmd.git_cmd = 1;

and actually that raises another point, does the compiler 0 fill
the stack-allocated struct that is initalized like you write, or
does it avoid filling the other fields that aren't mentioned in
the initialization?

> +	status = read(cmd.out, hex, sizeof(hex));
> +	if (status != 40) return status;

OK, this is probably just never trusting the OS, but shouldn't that
read be wrapped up in a loop, like our read_in_full?  We want 40
bytes here, and expect it, and the read call is allowed to return
as few as 1 byte....

-- 
Shawn.

  reply	other threads:[~2007-05-21  6:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 15:42 [PATCH v2] Submodule merge support Martin Waitz
2007-05-21  6:20 ` Shawn O. Pearce [this message]
2007-05-21  7:32   ` Martin Waitz
2007-05-21  7:37     ` Shawn O. Pearce
2007-05-21  7:55       ` Junio C Hamano
2007-05-21 15:42       ` Alex Riesen
2007-05-21  7:54     ` Junio C Hamano
2007-05-21 12:48       ` [PATCH] SubmittingPatches: mention older C compiler compatibility Johannes Schindelin
2007-05-27 14:39         ` [PATCH] Add -Wdeclaration-after-statement to CFLAGS to help enforce the instructions in SubmittingPatches Johan Herland
2007-05-27 14:58           ` Morten Welinder

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=20070521062005.GK3141@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=tali@admingilde.org \
    /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).