<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:v = 
"urn:schemas-microsoft-com:vml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE>@font-face {
        font-family: Cambria Math;
}
@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY lang=EN-US vLink=purple link=blue bgColor=#ffffff>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>---top---</FONT></DIV>
<DIV><FONT face=Arial size=2>then: gosub exp</FONT></DIV>
<DIV><FONT face=Arial size=2>then: out("1")=1</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>then: out("2")=2</FONT></DIV>
<DIV><FONT face=Arial size=2>then: out("3")=3</FONT></DIV>
<DIV>then: end</DIV>exp:</FONT></DIV>
<DIV><FONT face=Arial size=2>then: </FONT><FONT face=Arial size=2>export 
ascii&nbsp;out = (fn)&nbsp;&nbsp; r=\n&nbsp; f=\t</FONT></DIV>
<DIV><FONT face=Arial size=2>then: return</FONT></DIV>
<DIV><FONT face=Arial size=2>@once:</FONT></DIV>
<DIV><FONT face=Arial size=2>then:&nbsp;fn(128,*,g)="/u/" <A 
href="mailto:%7B@ID">{@ID</A> {"/HDrun.txt"</FONT></DIV>
<DIV><FONT face=Arial size=2>then: system "&gt;"&lt;fn</FONT></DIV>
<DIV><FONT face=Arial size=2>then: ' optional, write a header record with field 
names...</FONT></DIV>
<DIV><FONT face=Arial size=2>then: '&nbsp;out("1")=fieldname("1")&nbsp;; ... ; 
out("3")=fieldname("3") ; gosub exp</FONT></DIV>
<DIV><FONT face=Arial size=2>then: end</FONT></DIV>
<DIV><FONT face=Arial size=2>---bottom---</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>general way to think of it is,</FONT></DIV>
<DIV><FONT face=Arial size=2>* that which fp creates, only fp has permission to 
further modify, or even read.</FONT></DIV>
<DIV><FONT face=Arial size=2>* only system(), or anything else such as the 
parent process that ran fp,&nbsp;has the ability to create&nbsp;a file&nbsp;with 
open-enough permissions to ensure that some other process will be able to 
read/modify/delete it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Depending on your platform, system usually runs as 
the user, where fp runs suid filepro</FONT></DIV>
<DIV><FONT face=Arial size=2>so, the export command, if the file has never 
existed yet, results in the export command creating the file.</FONT></DIV>
<DIV><FONT face=Arial size=2>That means rreport created the file, that means 
user filepro created the file.</FONT></DIV>
<DIV><FONT face=Arial size=2>Buy contrast a&nbsp;system() command runs as the 
user (frank, sally, etc...) and any files that get created in there get created 
(by default) owned by that user with permissions according to whatever umask was 
when they ran rreport.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>That's half the problem and not necessarily a 
problem if that were all there was to it.</FONT></DIV>
<DIV><FONT face=Arial size=2>The other half of the problem is that when fp 
creates a file it does so with 600 permissions and fp provides no way to control 
that.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The _correct_ solution is for fp to provide a means 
to specify what perms are used to create files,</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;or barring that it should _at least_ honor 
the umask that was in effect from which rreport ran.</FONT></DIV>
<DIV><FONT face=Arial size=2>Those are both standard behaviour any app should 
have.</FONT></DIV>
<DIV><FONT face=Arial size=2>IE: you should be able to say umask 002, and then 
run report/clerk, and then whenever repot/clerk creates a file itself (due to 
export, printer file, open() etc... NOT system ) the file should get created 
with 664 permissions.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Since neither of those is true, you are left with 
the pretty inefficient necessity of running at least one&nbsp;system() command 
before any export command, purely for no other reason than so that the file gets 
created with permissions you can specify, so that later some other process has 
permission to touch it.</FONT></DIV>
<DIV><FONT face=Arial size=2>But I want to stress that this is merely the only 
way to get the job done in fp, NOT that this is the right way. The right way is 
not possible.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>"the only way" doesn't mean the exact code above or 
even the use of system(), it means the need to create the file any other way you 
want before and instead of allowing&nbsp;clerk/report to create it. Many times 
it's possible and more efficient if you process lends itself, to crete the file 
in the parent shell script before running clerk/report. For a typical cgi or 
cron job I usually generate a unique temp file name in the parent shell script, 
create the file, and hand the file name to fp via -r and/or via an environment 
variable.</FONT></DIV>
<DIV><FONT face=Arial size=2>In that case, since there is a parent shell script 
anyways and this clerk/report process is dedicated purpose, it's "free" to 
create the file in the parent and then just have fp use it. That save spawning 
yet another process for system() inside of fp.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>There is a possible kludge I haven't tried yet, 
there is a PFUMASK which perversely only applies to commands I&nbsp;_never_ use, 
jsfile and html.</FONT></DIV>
<DIV><FONT face=Arial size=2>That is such a no-brainer that it should apply to 
open() if nothing else, but anyways...</FONT></DIV>
<DIV><FONT face=Arial size=2>Perhaps a&nbsp;more efficient, if less transparent 
to future readers of&nbsp;the code,&nbsp;answer is available by using pfumask 
and jsfile or html just for the purpose of getting the file created, with 
controllable permissions, without having to use system().</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thats worth investigating as it would be more 
efficient cpu &amp; io wise.</FONT></DIV>
<DIV><FONT face=Arial size=2>Also it would be less likely to encounter some odd 
compatibility problem in the future as the code is moved to different platforms 
and as the underlying OS and shell evolves over time. system() launches a shell 
and you write commands that will work in that shell. Simple commands aren't 
likely to break over time and across platforms, but they are far more likely to 
break than a built-in fp command.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>It is often OK, and not a bad idea at all,&nbsp;to 
allow fp to create a file if you know that only fp will need to access it. For 
example, you could write an export directly, or use printer file "filename", 
etc,&nbsp;no pre-creating, and then later in the same or in any other fp 
process, you can can import it, export more (append/overwrite), open(), read(), 
close(), remove(), because all that happens as the same user filepro that 
created the file.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Brian K. White&nbsp;&nbsp;&nbsp; <A 
href="mailto:brian@aljex.com">brian@aljex.com</A>&nbsp;&nbsp;&nbsp; <A 
href="http://www.myspace.com/KEYofR">http://www.myspace.com/KEYofR</A><BR>+++++[&gt;+++[&gt;+++++&gt;+++++++&lt;&lt;-]&lt;-]&gt;&gt;+.&gt;.+++++.+++++++.-.[&gt;+&lt;---]&gt;++.<BR>filePro&nbsp; 
BBx&nbsp;&nbsp;&nbsp; Linux&nbsp; SCO&nbsp; FreeBSD&nbsp;&nbsp;&nbsp; 
#callahans&nbsp; Satriani&nbsp; Filk!<BR></FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=mschw@athenet.net href="mailto:mschw@athenet.net">Mike Schwartz</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A 
  title=filepro-list@lists.celestial.com 
  href="mailto:'Filepro-List@Lists. Celestial. Com'">'Filepro-List@Lists. 
  Celestial. Com'</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, October 18, 2007 10:42 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Permissions on a SCO Unix 
  exported file</DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
  face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
  size=2></FONT><BR></DIV>
  <DIV class=Section1>
  <P class=MsoNormal>SCO Open Server 5.0.7 and fP 5.0.05<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What 
  is the best way to change permissions on an exported spreadsheet?&nbsp; I am 
  trying to put the output spreadsheet into the subdirectory of the user who is 
  running the process:<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>144&nbsp; -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  If:<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: fn="/u/" <A 
  href="mailto:{@ID">{@ID</A> {"/HDrun.txt" {""&nbsp;&nbsp;&nbsp;&nbsp; '"Run 
  line" file name<o:p></o:p></P>
  <P class=MsoNormal>145&nbsp; -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If: 'Write 
  out a "run line" spreadsheet...<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: export ascii RHD 
  = (fn)&nbsp;&nbsp; r=\n&nbsp; f=\t</P>
  <P class=MsoNormal>146&nbsp; -------&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; -&nbsp;&nbsp; 
  -&nbsp;&nbsp; -&nbsp; &nbsp;-<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  If:<o:p></o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then: system "chmod 
  a+rw" &lt;fn {""<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp; filePro initially creates a 0 byte 
  file, but then, even with this chmod system command, I still get this 
  error:<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>*** A System Error Has Occurred ***<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>On File: /u/schwm/HDrun.txt<o:p></o:p></P>
  <P class=MsoNormal>Output Processing<o:p></o:p></P>
  <P class=MsoNormal>Line Number: 145<o:p></o:p></P>
  <P class=MsoNormal>export ascii RHD = (fn)&nbsp;&nbsp; r=\n&nbsp; 
  f=\t<o:p></o:p></P>
  <P class=MsoNormal>^<o:p></o:p></P>
  <P class=MsoNormal>filePro Error Number: -1<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp; What is the best way to do 
  this?&nbsp; Should I use another system command to create the output file 
  first, then do a chmod on it? Should I do a pushenv umask 
  command?<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp; I’m going to have to write several 
  of these exports, so I would like to do the simplest coding 
  possible.<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>Thanks!<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>Mike Schwartz<o:p></o:p></P>
  <P class=MsoNormal><o:p>&nbsp;</o:p></P>
  <P class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></P></DIV>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Filepro-list mailing 
  list<BR>Filepro-list@lists.celestial.com<BR>http://mailman.celestial.com/mailman/listinfo/filepro-list<BR></BLOCKQUOTE></BODY></HTML>