Mailinglist Archive: opensuse-buildservice (351 mails)

< Previous Next >
Re: [opensuse-buildservice] osc submitreq accept broken
  • From: Klaas Freitag <freitag@xxxxxxx>
  • Date: Tue, 15 Jul 2008 23:36:05 +0200
  • Message-id: <200807152336.05322.freitag@xxxxxxx>
Am Dienstag, 15. Juli 2008 12:18:21 schrieb Michael Schroeder:
On Mon, Jul 14, 2008 at 11:33:23PM +0200, Dirk Mueller wrote:
On Monday 14 July 2008, Dirk Mueller wrote:
hmm, even worse, it seems the src repository is now corrupted. from a
fresh checkout:

there are two more bugs in isascii() which might have caused that:

- it read 0 bytes of the file at offset 4096 instead of 4096 bytes from
offset 0 - a file containing a newline \r or \n was considered to be

anyway, I think it might be better to just use the perl builtin operator
-T for it (and all the other possible bugs still lurking in 5 lines of
Sorry, but this is the kind of code which makes it ugly. It takes
one compareable long to understand the code - not speaking about nice
error possibilities.

@@ -1650,12 +1650,7 @@ sub sourcediff {

sub isascii {
my ($file) = @_;
- local *F;
- open(F, '<', $file) || die("$file: $!\n");
- my $buf = '';
- sysread(F, $buf, 0, 4096);
- close F;
- return 1 unless $buf =~ /[\000-\037]/s;
+ return 1 if -T $file;
According to manpage:
return 1 if( -f $file && -T $file );

I don't like that because it's locale dependant.
From the manpage:

| The "-T" and "-B" switches work as follows. The first block or so of the
| file is examined for odd characters such as strange control codes or
| characters with the high bit set. If too many strange characters (>30%)
| are found, it's a "-B" file; otherwise it's a "-T" file. Also, any
| file containing null in the first block is considered a binary file.


Klaas Freitag Architect OPS/IPD
SUSE LINUX Products GmbH - Nuernberg
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups