[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Testing "Brazil" on Cygwin... is that expected?
From: |
Achim Gratz |
Subject: |
Re: Testing "Brazil" on Cygwin... is that expected? |
Date: |
Fri, 15 Aug 2014 09:36:42 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Achim Gratz <Stromeko <at> nexgo.de> writes:
> That's actually an issue with the NetApp support in Cygwin. NetApp
> produces unstable inode numbers and therefore Cygwin fakes stable inode
> numbers by doing some hashing. While that removes problems like the
> inode changing underneath a cp in progress, it necessarily makes all
> link counts 1. The hard links themselves are fine, you can write to any
> of the linked files and the contents shows up in the others, but you
> don't get to see how many files are linked.
The following patch makes GNU parallel work correctly on systems that report
bogus link counts on hard-linked files. The output from the test is now as
expected:
First started
Second started
Third started
The third finished
The second finished
Fourth started
The first finished
The fourth finished
All finished.
--- /bin/parallel 2014-07-22 16:15:08.000000000 +0200
+++ /bin/sem 2014-08-15 11:22:26.630801200 +0200
@@ -7109,16 +7109,20 @@
sub release {
my $self = shift;
- unlink $self->{'pidfile'};
- if($self->nlinks() == 1) {
- # This is the last link, so atomic cleanup
- $self->lock();
- if($self->nlinks() == 1) {
- unlink $self->{'idfile'};
- rmdir $self->{'lockdir'};
- }
- $self->unlock();
+ $self->lock();
+ my $nlinks = $self->nlinks();
+ ::debug($nlinks, "<", $self->{'count'});
+ if($nlinks-- > 1) {
+ unlink $self->{'idfile'};
+ open (my $fh, ">", $self->{'idfile'}) or
+ ::die_bug("write_idfile: $self->{'idfile'}");
+ print $fh "#"x$nlinks;
+ close $fh;
+ } else {
+ unlink $self->{'idfile'};
+ rmdir $self->{'lockdir'};
}
+ $self->unlock();
::debug("run", "released $self->{'pid'}\n");
}
@@ -7127,14 +7131,14 @@
my $self = shift;
my $retval = 0;
$self->lock();
- ::debug($self->nlinks(), "<", $self->{'count'});
- if($self->nlinks() < $self->{'count'}) {
+ my $nlinks = $self->nlinks();
+ ::debug($nlinks, "<", $self->{'count'});
+ if($nlinks++ < $self->{'count'}) {
-d $self->{'lockdir'} or mkdir_or_die($self->{'lockdir'});
- if(not -e $self->{'idfile'}) {
- open (my $fh, ">", $self->{'idfile'}) or
- ::die_bug("write_idfile: $self->{'idfile'}");
- close $fh;
- }
+ open (my $fh, ">", $self->{'idfile'}) or
+ ::die_bug("write_idfile: $self->{'idfile'}");
+ print $fh "#"x$nlinks;
+ close $fh;
$retval = link $self->{'idfile'}, $self->{'pidfile'};
}
$self->unlock();
@@ -7145,8 +7149,8 @@
sub nlinks {
my $self = shift;
if(-e $self->{'idfile'}) {
- ::debug("run", "nlinks", (stat(_))[3], "\n");
- return (stat(_))[3];
+ ::debug("run", "nlinks", (stat(_))[3], "size", (stat(_))[7], "\n");
+ return (stat(_))[7];
} else {
return 0;
}
Regards,
Achim.