Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Matt Emson
Sent from my iPhone On 7 Oct 2010, at 22:44, Michael Van Canneyt mich...@freepascal.org wrote: Aren't there automation systems for this? Just like debian's 'apt-get update upgrade' with a custom repository with your software? But then for windows I presume? I haven't seen any yet.

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Sven Barth
Am 07.10.2010 20:02, schrieb Jonathan: On Thu, 07 Oct 2010 11:01:44 +0200 Sven Barthpascaldra...@googlemail.com wrote: Btw: What are Tomoyo and Apparmour (I can imagine what the second one is, but I don't know what functionality they provide)? http://tomoyo.sourceforge.jp/

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Michael Van Canneyt
On Fri, 8 Oct 2010, Sven Barth wrote: Am 07.10.2010 20:02, schrieb Jonathan: On Thu, 07 Oct 2010 11:01:44 +0200 Sven Barthpascaldra...@googlemail.com wrote: Btw: What are Tomoyo and Apparmour (I can imagine what the second one is, but I don't know what functionality they provide)?

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Sven Barth
Am 08.10.2010 10:03, schrieb Michael Van Canneyt: On Fri, 8 Oct 2010, Sven Barth wrote: Am 07.10.2010 20:02, schrieb Jonathan: On Thu, 07 Oct 2010 11:01:44 +0200 Sven Barthpascaldra...@googlemail.com wrote: Btw: What are Tomoyo and Apparmour (I can imagine what the second one is, but I

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Michael Van Canneyt
On Fri, 8 Oct 2010, Sven Barth wrote: Am 08.10.2010 10:03, schrieb Michael Van Canneyt: On Fri, 8 Oct 2010, Sven Barth wrote: Am 07.10.2010 20:02, schrieb Jonathan: On Thu, 07 Oct 2010 11:01:44 +0200 Sven Barthpascaldra...@googlemail.com wrote: Btw: What are Tomoyo and Apparmour (I

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Sven Barth
Am 08.10.2010 11:43, schrieb Michael Van Canneyt: On Fri, 8 Oct 2010, Sven Barth wrote: Am 08.10.2010 10:03, schrieb Michael Van Canneyt: So when changing/improving GetTempFileName we could also try to make it compatible to such applications by creating a directory in TEMP for the temporary

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Jonas Maebe
On 08 Oct 2010, at 13:32, Sven Barth wrote: Let me guess: UID-username is a libc function... It has to be implemented via a library, because the translation can be done in as many different ways as there are authentication systems (/ etc/passwd, NIS, kerberos, ActiveDirectory, ...).

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Graeme Geldenhuys
On 8 October 2010 13:32, Sven Barth pascaldra...@googlemail.com wrote: Let me guess: UID-username is a libc function... Problem is you can't always map a UID to a username under Unix. The username is not always in the /etc/passwd file. You can have LDAP (I think that's what it's called),

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-08 Thread Sven Barth
Am 08.10.2010 14:11, schrieb Graeme Geldenhuys: On 8 October 2010 13:32, Sven Barthpascaldra...@googlemail.com wrote: Let me guess: UID-username is a libc function... Problem is you can't always map a UID to a username under Unix. The username is not always in the /etc/passwd file. You can

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Jonathan wrote: On Wed, 6 Oct 2010 09:41:03 +0200 (CEST) Michael Van Canneyt mich...@freepascal.org wrote: I'm open for some more sophisticated algorithm which does some more checking. Michael. Honour one of the temp directory environment variables, I know of TMPDIR,

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Giuliano Colla
Michael Van Canneyt ha scritto: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 11:05, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Graeme Geldenhuys
On 6 October 2010 23:57, Jonathan winelauncher.jonat...@googlemail.com wrote: Create a folder in the temp directory naming it after the user name. E.g /tmp/myusername/ Ensure only the owner can read and write in the folder. Create a folder in /tmp/myusername/ using your program name. Then

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Thu, 7 Oct 2010, Graeme Geldenhuys wrote: On 6 October 2010 23:57, Jonathan winelauncher.jonat...@googlemail.com wrote: Create a folder in the temp directory naming it after the user name. E.g /tmp/myusername/ Ensure only the owner can read and write in the folder. Create a folder in

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Graeme Geldenhuys
On 7 October 2010 10:40, Michael Van Canneyt mich...@freepascal.org wrote: Meanwhile I'm still waiting for the first non-fpc app to write it's config files in that directory (using Kubuntu, BTW). All other apps I use still happily write in ~/.program/ Well, then here it is In my

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Sven Barth
Am 06.10.2010 23:57, schrieb Jonathan: On Wed, 06 Oct 2010 09:40:42 +0200 Sven Barthpascaldra...@googlemail.com wrote: Windows (or at least ReactOS) seems to use GetTickCount to generate a random filename: Do not you use random file names without a subdirectory because you can not use

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Graeme Geldenhuys
On 7 October 2010 10:58, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Well, then here it is In my ~/.config/ I have the following non-FPC projects config files * enchant * f-spot * google-chrome * indicators * helix * gnome-disk-utility * gnome-session * gnome-mplayer * gtk-2.0

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Sven Barth
Am 07.10.2010 10:40, schrieb Michael Van Canneyt: Aahhh.. Norms. Right. like all config files should go in ~/.config/, as proposed 5 years ago, because ~/.program/ is not the norm (dumping a successful 20-year old practise for no apparent good reason). Meanwhile I'm still waiting for the first

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Thu, 7 Oct 2010, Sven Barth wrote: So: Norms ? Thank you, but I'll pass on that and implement what I perceive as simple and correct :-) If the applications would keep their read only files in 'c:\program files' and write only into those directories that they should (e.g. user's appdata

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Sven Barth
Am 07.10.2010 13:43, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: So: Norms ? Thank you, but I'll pass on that and implement what I perceive as simple and correct :-) If the applications would keep their read only files in 'c:\program files' and write only into those

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Thu, 7 Oct 2010, Sven Barth wrote: Am 07.10.2010 13:43, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: So: Norms ? Thank you, but I'll pass on that and implement what I perceive as simple and correct :-) If the applications would keep their read only files in

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Sven Barth
Am 07.10.2010 14:21, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: Am 07.10.2010 13:43, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: So: Norms ? Thank you, but I'll pass on that and implement what I perceive as simple and correct :-) If the

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Thu, 7 Oct 2010, Sven Barth wrote: Am 07.10.2010 14:21, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: Am 07.10.2010 13:43, schrieb Michael Van Canneyt: On Thu, 7 Oct 2010, Sven Barth wrote: So: Norms ? Thank you, but I'll pass on that and implement what I

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Sven Barth
Am 07.10.2010 14:41, schrieb Michael Van Canneyt: Well, in schools the administrator is a teacher (usually maths or so) who gets the additional job of managing the schools' IT structure. And all our clients are schools. Schools are indeed a bit special... sometimes you have to be lucky if

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Jonathan
On Thu, 07 Oct 2010 11:01:44 +0200 Sven Barth pascaldra...@googlemail.com wrote: Btw: What are Tomoyo and Apparmour (I can imagine what the second one is, but I don't know what functionality they provide)? http://tomoyo.sourceforge.jp/ https://wiki.ubuntu.com/AppArmor

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Micha Nelissen
Michael Van Canneyt wrote: Yes, but if the administrator must update 20 PCs manually every 2 weeks, he quickly complains that he has better things to do, so it must be done when the 'ordinary' user uses the application. Aren't there automation systems for this? Just like debian's 'apt-get

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Michael Van Canneyt
On Thu, 7 Oct 2010, Micha Nelissen wrote: Michael Van Canneyt wrote: Yes, but if the administrator must update 20 PCs manually every 2 weeks, he quickly complains that he has better things to do, so it must be done when the 'ordinary' user uses the application. Aren't there automation

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-07 Thread Micha Nelissen
Michael Van Canneyt wrote: I haven't seen any yet. The main problem is that the update isn't 'optional' or 'to be scheduled at X every night'. It must be done when the server application says it is time to do so. apt-proxy ... push to the proxy when it's time to update stuff ;) Micha

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Sven Barth
Am 05.10.2010 17:41, schrieb Jonas Maebe: On 05 Oct 2010, at 17:38, Michael Van Canneyt wrote: On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Sven Barth
Am 05.10.2010 18:26, schrieb ik: On Tue, Oct 5, 2010 at 17:30, Sven Barth pascaldra...@googlemail.com mailto:pascaldra...@googlemail.com wrote: Am 05.10.2010 17:20, schrieb Leonardo M. Ramé: Hi, if I run this program from command line in Linux, I allways get the same

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Sven Barth wrote: Am 05.10.2010 17:41, schrieb Jonas Maebe: On 05 Oct 2010, at 17:38, Michael Van Canneyt wrote: On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp.

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge - does not have a way to create and lock a file in one atomic operation; There are always 2

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge - does not have a way to create and lock a file in

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 11:05, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 11:05, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 11:59, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: Nobody else can steal the file once you have created it, because they won't be the owner nor have the necessary permissions. That is the main security risk and it is solved by this approach. The

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonathan
On Wed, 6 Oct 2010 09:41:03 +0200 (CEST) Michael Van Canneyt mich...@freepascal.org wrote: I'm open for some more sophisticated algorithm which does some more checking. Michael. Honour one of the temp directory environment variables, I know of TMPDIR, TEMP, TMP. I think it would be best to

[fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Leonardo M . Ramé
Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each time it's executed?. How can I get different file names? program tempfilename; uses sysutils; begin writeln(GetTempFileName); end.

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Sven Barth
Am 05.10.2010 17:20, schrieb Leonardo M. Ramé: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each time it's executed?. How can I get different file names? program tempfilename; uses

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Michael Van Canneyt
On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each time it's executed?. How can I get different file names? By actually creating the file.

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Jonas Maebe
On 05 Oct 2010, at 17:38, Michael Van Canneyt wrote: On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each time it's executed?. How can I get

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread ik
On Tue, Oct 5, 2010 at 17:30, Sven Barth pascaldra...@googlemail.comwrote: Am 05.10.2010 17:20, schrieb Leonardo M. Ramé: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each time it's

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-05 Thread Leonardo M . Ramé
...@gmail.com Subject: Re: [fpc-pascal] GetTempFileName in Linux To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Date: Tuesday, October 5, 2010, 2:26 PM On Tue, Oct 5, 2010 at 17:30, Sven Barth pascaldra...@googlemail.com wrote: Am 05.10.2010 17:20, schrieb Leonardo M. Ramé: Hi, if I run