This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: configure libc-ports push/commit hook to email diffs to which list?
Joseph S. Myers wrote:
> On Wed, 27 May 2009, Jim Meyering wrote:
>
>> Roland McGrath wrote:
>> > AFAIK the old cvs setup sent mail to glibc-cvs for all modules,
>> > i.e. both libc and ports.
>>
>> I've used glibc-cvs, then.
>
> That seems right to me.
>
> Is it possible to limit the size of messages sent out for both libc and
> ports? My mail logs show two messages as having been rejected because of
> their size (one 62MB, one 504MB) - when they get that big there seems
Ok. Fun exercise:
write a tiny script to help do that:
- read up to N bytes from stdin into buffer
- if we've read to EOF, write buffer to stdout and exit,
else
{
discard buffer
consume all input and record $n_bytes_read.
write excuse to stdout, saying $n_bytes_read discarded
}
Then interpose the script where the diffs are generated.
Here's the script:
[it got a little longer because first attempt would
have barfed when invoked like ./limit-pipe 99999999999 ]
#!/usr/bin/perl
# usage: $0 MAX_N_BYTES
# filter stdin to stdout: if size <= MAX_N_BYTES, pass-thru; else print a msg
# written by Jim Meyering <jim@meyering.net>.
my $VERSION = '2009-05-29 15:24'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
(my $ME = $0) =~ s|.*/||;
use strict;
use warnings;
@ARGV < 1
and die "$ME: missing MAX_SIZE argument\n";
1 < @ARGV
and die "$ME: too many arguments\n";
my $max_n_bytes = $ARGV[0];
$max_n_bytes =~ /^\d+$/
or die "$ME: invalid argument: $max_n_bytes\n";
my $chunk_size = 4096;
$max_n_bytes < $chunk_size
and $chunk_size = $max_n_bytes;
my @buf;
my $n_read = 0;
my $i = 0;
while ($n_read <= $max_n_bytes)
{
my $n = read STDIN, $buf[$i++], $chunk_size;
defined $n
or die "$ME: read error: $!\n";
$n == 0 # EOF
and (print @buf), exit;
$n_read += $n;
}
undef @buf;
while (1)
{
my $buf;
my $n = sysread STDIN, $buf, 4096;
$n
or last;
$n_read += $n;
}
printf "actual size ($n_read) would have exceeded the maximum of $max_n_bytes\n";
END { # use File::Coda; # http://meyering.net/code/Coda/
defined fileno STDOUT or return;
close STDOUT and return;
warn "$ME: failed to close standard output: $!\n";
$? ||= 1;
}
# Local Variables:
# indent-tabs-mode: nil
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "'; # UTC"
# End: