controller file_put_start callback doesnt set file permissions correctly on linux

book

Article ID: 192234

calendar_today

Updated On:

Products

NIMSOFT PROBES DX Infrastructure Management

Issue/Introduction

We have a script that is used to push files to robots which uses the file_put_start file_put_next and file_put_end callbacks.  In the input pds for the file_put_start we set the appropriate mode for the file permissions that are required.  We have recently noticed that when sending files to Linux (specifically RHEL) that the permissions on the files that are sent do not match the permissions specified in the mode.  Using the same script to push files to solaris creates file with the correct file permissions.

We see this issue on RHEL running robot versions 7.97, 9.30.

Example script which will demonstrate the issue:
my $robot_addr = "/domain/hub/robot";
my $inPds = pdsCreate();
pdsPut_PCH($inPds,"buffer_size","1");
pdsPut_PCH($inPds,"mode","0644");
pdsPut_PCH($inPds,"type","binary");
pdsPut_PCH($inPds,"file","test.txt");
pdsPut_PCH($inPds,"directory","/tmp");
my ($rc, $outPds) = nimNamedRequest("$robot_addr/controller","file_put_start",$inPds,30);
print "nimNamedRequest file_put_start RC=$rc\n";

my ($rc2, $outPds2) = nimNamedRequest("$robot_addr/controller","file_put_end",$outPds,30);
print "nimNamedRequest file_put_end RC=$rc2\n" ;


RHEL outcome: -rw-------. 1 root root 0 May 15 13:08 /tmp/test.txt
Solaris outcome: -rw-r--r--   1 root     root           0 May 15 04:07 /tmp/test.txt

Environment

Release : 20.1

Component : UIM - ROBOT_RPM

Resolution

remove the leading 0 from the mode parameter

my $robot_addr = "/domain/hub/robot";
my $inPds = pdsCreate();
pdsPut_PCH($inPds,"buffer_size","1");
pdsPut_PCH($inPds,"mode","644"); <========
pdsPut_PCH($inPds,"type","binary");
pdsPut_PCH($inPds,"file","test.txt");
pdsPut_PCH($inPds,"directory","/tmp");
my ($rc, $outPds) = nimNamedRequest("$robot_addr/controller","file_put_start",$inPds,30);
print "nimNamedRequest file_put_start RC=$rc\n";