Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 29784
Status: resolved
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: stanton [...] electric-cloud.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.976
Fixed in: (no value)



Subject: default tmpdir should use P_tmpdir not /tmp
The default location returned by par_mktmpdir is '/tmp' on all Unix platforms. This ends up unpacking large files into swap on Solaris, which can quickly fill up. It would be better to use /var/tmp on this platform. This preference is already encoded in the P_tmpdir system macro. So the following patch will address this issue in a platform independent manner: Index: myldr/mktmpdir.c =================================================================== --- myldr/mktmpdir.c (revision 526) +++ myldr/mktmpdir.c (working copy) @@ -43,7 +43,7 @@ const char *tmpdir = NULL; const char *key = NULL , *val = NULL; - const char *temp_dirs[4] = { "C:\\TEMP", "/tmp", ".", "" }; + const char *temp_dirs[4] = { "C:\\TEMP", P_tmpdir, ".", "" }; const char *temp_keys[6] = { "PAR_TMPDIR", "TMPDIR", "TEMPDIR", "TEMP", "TMP", "" }; const char *user_keys[3] = { "USER", "USERNAME", "" };
Hi Scott, thanks for the bug report and sorry for the delay. On Thu Oct 04 18:44:22 2007, snstanton wrote: Show quoted text
> The default location returned by par_mktmpdir is '/tmp' on all Unix > platforms. This ends up unpacking large files into swap on Solaris, > which can quickly fill up. It would be better to use /var/tmp on this > platform. This preference is already encoded in the P_tmpdir system > macro. So the following patch will address this issue in a platform > independent manner: > > Index: myldr/mktmpdir.c > =================================================================== > --- myldr/mktmpdir.c (revision 526) > +++ myldr/mktmpdir.c (working copy) > @@ -43,7 +43,7 @@ > const char *tmpdir = NULL; > const char *key = NULL , *val = NULL; > > - const char *temp_dirs[4] = { "C:\\TEMP", "/tmp", ".", "" }; > + const char *temp_dirs[4] = { "C:\\TEMP", P_tmpdir, ".", "" }; > const char *temp_keys[6] = { "PAR_TMPDIR", "TMPDIR", "TEMPDIR", > "TEMP", "TMP", "" }; > const char *user_keys[3] = { "USER", "USERNAME", "" }; >
If I read this correctly, this will fail wherever P_tmpdir is not defined? Does this happen? I am not a C-system-interface guru (to say the least). Supposing this can be the case, do you know how to probe for the availability of P_tmpdir? Please remember that PAR::Packer must work on oddballs such as win32. Regardless, I would change the line to read: const char *temp_dirs[5] = { "C:\\TEMP", P_tmpdir, "/tmp", ".", "" }; (Note the extra entry as fallback instead of a replacement.) What do you think? Best regards, Steffen
Subject: RE: [rt.cpan.org #29784] default tmpdir should use P_tmpdir not /tmp
Date: Wed, 10 Oct 2007 09:15:50 -0700
To: <bug-PAR-Packer [...] rt.cpan.org>
From: "Scott Stanton" <stanton [...] electric-cloud.com>
P_tmpdir is a POSIX macro, so it should work pretty much everywhere (including win32). It definitely works on Win32, MacOSX, HPUX, Solaris, and Linux, since those are the platforms I'm supporting right now. I think a safer change might be to add: #ifndef P_tmpdir #define P_tmpdir "/tmp" #endif That way you won't get a compilation failure if the platform doesn't have a P_tmpdir definition. Show quoted text
-----Original Message----- From: Steffen Müller via RT [mailto:bug-PAR-Packer@rt.cpan.org] Sent: Wednesday, October 10, 2007 6:11 AM To: Scott Stanton Subject: [rt.cpan.org #29784] default tmpdir should use P_tmpdir not /tmp <URL: http://rt.cpan.org/Ticket/Display.html?id=29784 > Hi Scott, thanks for the bug report and sorry for the delay. On Thu Oct 04 18:44:22 2007, snstanton wrote:
> The default location returned by par_mktmpdir is '/tmp' on all Unix > platforms. This ends up unpacking large files into swap on Solaris, > which can quickly fill up. It would be better to use /var/tmp on this > platform. This preference is already encoded in the P_tmpdir system > macro. So the following patch will address this issue in a platform > independent manner: > > Index: myldr/mktmpdir.c > =================================================================== > --- myldr/mktmpdir.c (revision 526) > +++ myldr/mktmpdir.c (working copy) > @@ -43,7 +43,7 @@ > const char *tmpdir = NULL; > const char *key = NULL , *val = NULL; > > - const char *temp_dirs[4] = { "C:\\TEMP", "/tmp", ".", "" }; > + const char *temp_dirs[4] = { "C:\\TEMP", P_tmpdir, ".", "" }; > const char *temp_keys[6] = { "PAR_TMPDIR", "TMPDIR", "TEMPDIR", > "TEMP", "TMP", "" }; > const char *user_keys[3] = { "USER", "USERNAME", "" }; >
If I read this correctly, this will fail wherever P_tmpdir is not defined? Does this happen? I am not a C-system-interface guru (to say the least). Supposing this can be the case, do you know how to probe for the availability of P_tmpdir? Please remember that PAR::Packer must work on oddballs such as win32. Regardless, I would change the line to read: const char *temp_dirs[5] = { "C:\\TEMP", P_tmpdir, "/tmp", ".", "" }; (Note the extra entry as fallback instead of a replacement.) What do you think? Best regards, Steffen
Hi Scott, thanks again for getting involved. I applied your modified patch. It's in the svn trunk (http://svn.openfoundry.org/par) now. I intend to roll a release reasonably soon*. Best regards, Steffen * "soon" means either within a week or in December due to travelling.