Csound Csound-dev Csound-tekno Search About

[Cs-dev] /tmp

Date2012-03-10 11:01
FromTito Latini
Subject[Cs-dev] /tmp
AttachmentsNone  

Date2012-03-10 11:24
FromSteven Yi
SubjectRe: [Cs-dev] /tmp
Hi Tito,

I don't see any problems with this, except I wonder would TMPDIR clash
with any other programs' usage of environment variables?  On the other
hand, CSTMPDIR or CS_TEMP_DIR seems wordy as well.  Just a thought,
it's probably fine to just go with TMPDIR.

Also, I know there was work by John to remove the use of temporary
files a few months ago to support devices that didn't have the
standard access to /tmp (i.e. Android).  It looks like from grep that
it's only really being used in:

Top/one_file.c:413:    csoundTmpFileName(csound, ST(sconame), ".sco");
Top/one_file.c:414:    csoundTmpFileName(csound, extname, ".ext");
Top/one_file.c:510:    csoundTmpFileName(csound, ST(midname), ".mid");

which looks like when using CsScore bin="xxx" as well as when writing
out embedded files in  tags.  Also just a note.

Thanks!
steven


On Sat, Mar 10, 2012 at 11:01 AM, Tito Latini  wrote:
> I would like to add the TMPDIR environment variable to `csoundTmpFileName'
> function (unix) because I often use tmpfs and/or ramfs for temp files and
> I don't mount these filesystems on /tmp. I see a tentative with `mytmpnam'
> but it doesn't work because `tmpdir!=NULL' fails (tmpdir is always a string).
> This works
>
>  char *tmpdir = getenv("TMPDIR");
>  sprintf(buf, "%s/csound-XXXXXX", (tmpdir[0] != '\0' ? tmpdir : "/tmp"));
>
> Let me know if I can apply this change.
>
> tito
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-10 11:28
FromTito Latini
SubjectRe: [Cs-dev] /tmp
AttachmentsNone  

Date2012-03-10 11:43
FromSteven Yi
SubjectRe: [Cs-dev] /tmp
Ah, I learn something new each day. Thank you! :)  Well, seems like
the right thing to do then. It seems on windows the temporary folder
is either TEMP or TMP, with TEMP looking to be the more correct.

http://en.wikipedia.org/wiki/Temporary_folder
http://technet.microsoft.com/en-us/library/ee156595.aspx

The Windows code looks really odd in csoundTmpFileName looks very odd.
 It looks like it actually tries to write to SFDIR, then HOME, then
uses the _tempnam function.  I'm not sure why that was done there
though.

Thanks!
steven

On Sat, Mar 10, 2012 at 11:28 AM, Tito Latini  wrote:
>> I don't see any problems with this, except I wonder would TMPDIR clash
>> with any other programs' usage of environment variables?  On the other
>
> TMPDIR is the default in the unix environment.
> For example, from the `tempfile' man page
>
>  "The directory to place the file is searched for in the following order:
>
>    a) The directory specified by the environment variable TMPDIR, if it is writable.
>    b) The directory specified by the --directory argument, if given.
>    c) The directory /tmp."
>
> I put the change (with the authorization) only in `#ifndef WIN32'.
>
> tito
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-10 11:50
FromDavid Akbari
SubjectRe: [Cs-dev] /tmp
If there isn't a valid /tmp directory could you append to the list you
posted to just use the current working directory? Just a thought.


-David

On Sat, Mar 10, 2012 at 5:28 AM, Tito Latini  wrote:
>> I don't see any problems with this, except I wonder would TMPDIR clash
>> with any other programs' usage of environment variables?  On the other
>
> TMPDIR is the default in the unix environment.
> For example, from the `tempfile' man page
>
>  "The directory to place the file is searched for in the following order:
>
>    a) The directory specified by the environment variable TMPDIR, if it is writable.
>    b) The directory specified by the --directory argument, if given.
>    c) The directory /tmp."
>
> I put the change (with the authorization) only in `#ifndef WIN32'.
>
> tito
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-10 11:54
FromTito Latini
SubjectRe: [Cs-dev] /tmp
AttachmentsNone  

Date2012-03-10 11:56
FromTito Latini
SubjectRe: [Cs-dev] /tmp
AttachmentsNone  

Date2012-03-10 12:08
FromSteven Yi
SubjectRe: [Cs-dev] /tmp
Yeah, David's suggestion makes sense. I noticed the tempnam function
does essentially that:

http://linux.die.net/man/3/tempnam

but there is a warning there regarding security.  I think we came
across this before and John changed things to use mkstemp. So it seems
it'd be following the functionality of tempnam but being safer about
it.

On Sat, Mar 10, 2012 at 11:56 AM, Tito Latini  wrote:
>> If there isn't a valid /tmp directory could you append to the list you
>> posted to just use the current working directory? Just a thought.
>
> I have applied the patch but I think that your suggestion is good
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net