On Sat, 23 Feb 2013 22:31:10 -0800
Jeremy Chadwick <j...@koitsu.org> wrote:
>
> I downloaded it and looked at the source.
>
> svnup.c:1002: warning: zero-length printf format string
> svnup.c:1020: warning: zero-length printf format string
> svnup.c:1027: warning: zero-length printf format string
> svnup.c:1065: warning: zero-length printf format string
>
> 1002 sprintf(command, "");
> 1020 sprintf(command, "");
> 1027 sprintf(command, "");
> 1065 sprintf(command,
>"");
>
> I'm not sure what the intention is here. If it's to
>terminate the
> buffer, then all of these should be:
>
> command[0] = '\0';
Correct. Clang didn't complain when I went the sprintf route... :(
> Also, John, please consider using malloc(3) instead of
>heap-allocated
> buffers like file_buffer[6][] (196608 bytes) and
>command[] (32769
> bytes). I'm referring to this:
>
> 47 #define COMMAND_BUFFER 32768
> 386 char new_path_target[BUFFER_UNIT],
>file_buffer[6][COMMAND_BUFFER], *path_source;
> 836 char *start, *value, *addr, *branch,
>*path_target, temp_file[BUFFER_UNIT],
>command[COMMAND_BUFFER + 1];
These were leftovers from a malloc debug session that I forgot to
undo. Processing the ports tree needs way more that six buffers...
<face-palm/>
> I should also point out that watching this thing in
>top(1) shows RES/RSS
> increasing until the segfault (for me dies out around
>4.5MBytes). I
> don't know if that's by design or not, but I don't see
>why this thing
> would need so much memory given what it's doing. You'd
>know better than
> I though.
The code is definitely going to be memory intensive. The initial,
naive implementation I wrote sent get-file and get-dir requests one at
a time and the time penalty was atrocious -- it took four hours to
process base/releng/8.3. To get around this, since the subversion
server can handle multiple requests at a time, I have to cram as many
get-file and get-dir requests together as I can to minimize the number
of interactions with the server.
> You may want to consider running this under valgrind.
> It's remarkable
> what you can find with that during debugging.
Will do.
>
> --
> | Jeremy Chadwick
> j...@koitsu.org |
> | UNIX Systems Administrator
> http://jdc.koitsu.org/ |
> | Mountain View, CA, US
> |
> | Making life hard for others since 1977.
> PGP 4BD6C0CB |
>
I've got a rough fix in place and the ports tree is chugging along now
(I only tested my code against the base/releng and base/stable branches
-- oops). I should be able to post revised code tonight. Thanks for
taking a look at this. As a first-timer here, I definitely appreciate
it!
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"