[padb] Pb with --create-secret-file

thipadin.seng-long at bull.net thipadin.seng-long at bull.net
Tue Dec 1 14:18:08 GMT 2009


Hi,
On one of our cluster I've go a problem to create secret file like this:

[thipa at vb0 openmpi]$ padb_r341 --create-secret-file
Failed to chmod secret file: No such file or directory
[thipa at vb0 openmpi]$ 

our system is:
[thipa at vb0 openmpi]$ uname -a
Linux vb0 2.6.18-B64k.1.26 #1 SMP Wed Aug 26 17:15:29 CEST 2009 ia64 ia64 
ia64 GNU/Linux

Before my patch the source code looks like this:

sub create_padb_secret {
    my $filename = "$ENV{HOME}/.padb-secret";
    my $FD;
    if ( not open $FD, '>', $filename ) {
        print "Failed to create secret file: $!\n";
        return;
    } 
    if ( chmod( 0600, $FD ) != 1 ) {
        print "Failed to chmod secret file: $!\n";
        return;
    }
    my $s = rand;
    print {$FD} "secret=$s\n";
    close $FD;
    print "Sucessfully created secret file ($filename)\n";
    return;
}

After searching on the web I changed the code to:

sub create_padb_secret {
    my $filename = "$ENV{HOME}/.padb-secret";
    my $FD;
    if ( not open $FD, '>', $filename ) {
        print "Failed to create secret file: $!\n";
        return;
    } 
    if ( chmod( 0600, $filename ) != 1 ) {
        print "Failed to chmod secret file: $!\n";
        return;
    }
    my $s = rand;
    print {$FD} "secret=$s\n";
    close $FD;
    print "Sucessfully created secret file ($filename)\n";
    return;
}

And it works:

[thipa at vb0 openmpi]$ padb_r341_secret --create-secret-file
Sucessfully created secret file (/home_nfs/thipa/.padb-secret)
[thipa at vb0 openmpi]$ 

This happens only in this cluster which is IA64. On the internet it 
relates to system that support fchmod or not:
http://perldoc.perl.org/functions/chmod.html


Here is the patch:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pittman.org.uk/pipermail/padb-devel_pittman.org.uk/attachments/20091201/4150e720/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: secret.patch
Type: application/octet-stream
Size: 364 bytes
Desc: not available
URL: <http://pittman.org.uk/pipermail/padb-devel_pittman.org.uk/attachments/20091201/4150e720/attachment.obj>


More information about the padb-devel mailing list