permissions issue on print to a file

Brian K. White brian at aljex.com
Fri Dec 1 13:15:31 PST 2006


----- Original Message ----- 
From: "Richard D. Williams" <richard at appgrp.net>
To: "filePro Mailing List" <filepro-list at lists.celestial.com>
Sent: Friday, December 01, 2006 2:20 PM
Subject: permissions issue on print to a file


> RH enterprise FP 5.6.03D4
>
> situtation:
>
> logged in as richardw, regular user
> accessing a record in fileA.
> using system command to access record in fileB.
> execute a print form to a file
> that file ends up with permissions of:
> -rw-------  1 filepro users 8796 Dec  1 12:14 richardw
>
> When I try to convert this to pdf, using pcl2pdf, it result in a
> permissions error and the pdf is not created.
>
> I have tried to do a system command "chmod 666 /appl/fpmerge/richardw,
> before doing the pcl2pdf conversion, but the file perms are unchanged.
>
> If I go directly to fileB and execute the same print form process as
> user richardw, it will create the same file with different permissions
> and the pcl2pdf will create the pdf file correctly.
>
> -rw-r--r--  1 filepro  users 3494 Dec  1 13:07 richardw
> -rwxrwxrwx  1 richardw users 5117 Dec  1 12:31 richardw.pdf
>
> Is this a umask issue?
> Obviously, the problem is caused when I use the system command to access
> fileB.  Because the user @ID is now filepro.  But, if I am executing the
> print command to a file as filepro, shouldn't that run as a regular
> user?  Or, do I have to make some umask change to accomplish this task?
>
> Any input very welcome,
>
> Richard D. Williams

You need to create the file with open permissions beforehand, instead of 
allowing filepro to create it.
In your case the most efficient way is probably to know the end file name 
while still in the parent process, say it's in a variable ee, and the parent 
process can create the file and then run the child filepro process and tell 
the child what filename to use, all in the same system() command to avoid 
adding more and unecessary system commands.

so, parent process may look like:

if:
then: ee = "/path/to/file_"{aa
if:
then: system "umask 0;>"{ee<";rreport ... -pc 
hplaser -p"<ee<";pcl2pdf"<ee<ee{".pdf"


If you don't use -p but -r or an env variable instead, you can actually take 
care of it all inside the child process but it's a little trickier.

What I did there is:
set umask 0     (this only applies for the duration of this system() 
command)
create an empty file     (which got created rw-rw-rw- because of the umask)
ran rreport with print code type set to hplaser and print dest set to 
filename
ran pcl2pdf using the same handy variable, and which since it's still in the 
same system command and is therefore subject to the same umask, will create 
file.pdf also with rw-rw-rw-

There is no way to get filepro to create files the way you want since 
filepro doesn't honor umask nor does it have any command or variable or 
setting for it, at least not for this, there are settings for some of the 
methods of creating files but it's all things no one uses like jumpstart.
I don't know offhand about export but definitely not for 
open/write/writeline, or print or form or -p
But filepro will not change the perms of a file that already exists so you 
just need to create the file first with whatever perms & ownership you need 
instead of allowing filepro to create it.

Creating it inside a system command using anything other than one of the 
filepro binaries doesn't count as "filepro creating it" just because the 
system command happened to be run from inside a filepro process. In the 
example above, filepro didn't create the file, /bin/sh did. Remove the 
;>"{ee   from the system command and then rreport ends up creating ee which 
is what I mean by allowing filepro to create it.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list