# [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

8 messages from 2007-07-13 to 2007-07-16. Participants: Marius Storm-Olsen, Alex Riesen, Simon Hausmann, Shawn O. Pearce, Junio C Hamano.
Thread: https://gitlist.dev/t/9020

## Marius Storm-Olsen, 2007-07-13 12:56

Subject: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <46977660.7070207@trolltech.com>
URL: https://gitlist.dev/e/46977660.7070207%40trolltech.com

```
 From 255ec32feb7525db8eef582eeed2b6e60be35ed8 Mon Sep 17 00:00:00 2001
From: Marius Storm-Olsen <marius@trolltech.com>
Date: Fri, 13 Jul 2007 14:39:05 +0200
Subject: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf 
function.

Add condition for Windows, since it doesn't support the os.sysconf module.
We hardcode the commandline limit to 2K, as that should work on most 
Windows platforms.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
  contrib/fast-import/git-p4 |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 54a05eb..746e0ca 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -717,7 +717,11 @@ class P4Sync(Command):
          # POSIX says it's 4096 bytes, default for Linux seems to be 
130 K.
          # and all OS from the table below seems to be higher than POSIX.
          # See http://www.in-ulm.de/~mascheck/various/argmax/
-        argmax = min(4000, os.sysconf('SC_ARG_MAX'))
+        if (self.isWindows):
+            argmax = 2000
+        else:
+            argmax = min(4000, os.sysconf('SC_ARG_MAX'))
+
          chunk = ''
          filedata = []
          for i in xrange(len(files)):
-- 
1.5.2-GUB

```

## Alex Riesen, 2007-07-13 13:03

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <81b0412b0707130603q69857564i1ba418b74397a33d@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0707130603q69857564i1ba418b74397a33d%40mail.gmail.com
In-Reply-To: <46977660.7070207@trolltech.com>

```
On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
>      argmax = min(4000, os.sysconf('SC_ARG_MAX'))

I wonder why the code in question does not use "-x"?
I use it git-p4-import and haven't seen the limit yet.
I.e.:

   $ ls |p4 -x - print -q
   $ p4 help usage
   ...
   The -x flag instructs p4 to read arguments, one per line, from the
   named file.  If the file is named '-', then standard input is read.
   ...

```

## Simon Hausmann, 2007-07-13 13:33

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <200707131533.55544.simon@lst.de>
URL: https://gitlist.dev/e/200707131533.55544.simon%40lst.de
In-Reply-To: <81b0412b0707130603q69857564i1ba418b74397a33d@mail.gmail.com>

```
On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
> On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
> >      argmax = min(4000, os.sysconf('SC_ARG_MAX'))
>
> I wonder why the code in question does not use "-x"?
> I use it git-p4-import and haven't seen the limit yet.
> I.e.:
>
>    $ ls |p4 -x - print -q
>    $ p4 help usage
>    ...
>    The -x flag instructs p4 to read arguments, one per line, from the
>    named file.  If the file is named '-', then standard input is read.
>    ...

Good idea!


I still think the patch makes sense as stop-gap for 1.5.3 though, because 
without it git-p4 doesn't work at all on Windows.

Simon

```

## Shawn O. Pearce, 2007-07-15 02:49

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <20070715024928.GY4436@spearce.org>
URL: https://gitlist.dev/e/20070715024928.GY4436%40spearce.org
In-Reply-To: <200707131533.55544.simon@lst.de>

```
Simon Hausmann <simon@lst.de> wrote:
> On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
> > On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
> > >      argmax = min(4000, os.sysconf('SC_ARG_MAX'))
> >
> > I wonder why the code in question does not use "-x"?
> > I use it git-p4-import and haven't seen the limit yet.
> 
> I still think the patch makes sense as stop-gap for 1.5.3 though, because 
> without it git-p4 doesn't work at all on Windows.

Thanks.  Marius' patch was whitespace damaged in the context lines,
but it was easily repaired.  I've got a couple of other small items
in my fastimport repository that I'm going to ask Junio to include
in 1.5.3 shortly.

-- 
Shawn.

```

## Junio C Hamano, 2007-07-15 06:12

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <7vmyxydwld.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vmyxydwld.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070715024928.GY4436@spearce.org>

```
"Shawn O. Pearce" <spearce@spearce.org> writes:

> Thanks.  Marius' patch was whitespace damaged in the context lines,
> but it was easily repaired.  I've got a couple of other small items
> in my fastimport repository that I'm going to ask Junio to include
> in 1.5.3 shortly.

Thanks for taking care of this.  I have pulled gfi master into
'master'.  Perhaps we would want to tag -rc2 this weekend, run
with it for a week or so and see if we need -rc3 before the
final.

```

## Shawn O. Pearce, 2007-07-16 05:35

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <20070716053511.GC32566@spearce.org>
URL: https://gitlist.dev/e/20070716053511.GC32566%40spearce.org
In-Reply-To: <7vmyxydwld.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > Thanks.  Marius' patch was whitespace damaged in the context lines,
> > but it was easily repaired.  I've got a couple of other small items
> > in my fastimport repository that I'm going to ask Junio to include
> > in 1.5.3 shortly.
> 
> Thanks for taking care of this.  I have pulled gfi master into
> 'master'.  Perhaps we would want to tag -rc2 this weekend, run
> with it for a week or so and see if we need -rc3 before the
> final.

I'm not entirely sure how we're going to handle the git-p4 patches;
I see there's already another set available to use '-x -' to avoid
command line length problems.

I'm more than happy to play patch monkey and ship them through the
fastimport repository, but since I'm not a p4 user that offers little
value to the process, other than perhaps to save you a little time.

Simon suggested he might setup a git fork on repo.or.cz himself, at
which point you could pull the patches for git-p4 directly from him.

Simon?

-- 
Shawn.

```

## Junio C Hamano, 2007-07-16 07:00

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <7vr6n84yux.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vr6n84yux.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070716053511.GC32566@spearce.org>

```
"Shawn O. Pearce" <spearce@spearce.org> writes:

> I'm more than happy to play patch monkey and ship them through the
> fastimport repository, but since I'm not a p4 user that offers little
> value to the process, other than perhaps to save you a little time.
>
> Simon suggested he might setup a git fork on repo.or.cz himself, at
> which point you could pull the patches for git-p4 directly from him.
>
> Simon?

Pulling from Simon sounds the sanest.

How big is the population that can help testing and cheering-on
git-p4 on this list?  If we can have git-p4 subgroup that would
be wonderful, as I do not interoperate with p4 myself.

```

## Simon Hausmann, 2007-07-16 18:30

Subject: Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf
Message-ID: <200707162030.55268.simon@lst.de>
URL: https://gitlist.dev/e/200707162030.55268.simon%40lst.de
In-Reply-To: <20070716053511.GC32566@spearce.org>

```
On Monday 16 July 2007 07:35:11 Shawn O. Pearce wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > "Shawn O. Pearce" <spearce@spearce.org> writes:
> > > Thanks.  Marius' patch was whitespace damaged in the context lines,
> > > but it was easily repaired.  I've got a couple of other small items
> > > in my fastimport repository that I'm going to ask Junio to include
> > > in 1.5.3 shortly.
> >
> > Thanks for taking care of this.  I have pulled gfi master into
> > 'master'.  Perhaps we would want to tag -rc2 this weekend, run
> > with it for a week or so and see if we need -rc3 before the
> > final.
>
> I'm not entirely sure how we're going to handle the git-p4 patches;
> I see there's already another set available to use '-x -' to avoid
> command line length problems.
>
> I'm more than happy to play patch monkey and ship them through the
> fastimport repository, but since I'm not a p4 user that offers little
> value to the process, other than perhaps to save you a little time.
>
> Simon suggested he might setup a git fork on repo.or.cz himself, at
> which point you could pull the patches for git-p4 directly from him.
>
> Simon?

Yes, sounds good to me. I have tried creating a git clone on repo.or.cz but 
somehow I can't edit the project. Need to find pasky on IRC to help me :). 
Until then I have created a repository on freedesktop.org:

	git://people.freedesktop.org/~hausmann/git-p4
	http://gitweb.freedesktop.org/?p=users/hausmann/git-p4;a=summary


Simon

```
