Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 53966
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: hardon [...] online.no
Cc:
AdminCc:

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



Subject: "CGI open of tmpfile: No such file or directory\n"
I found a problem with upload of attachments using apache2, mod_perl2 and bugzilla running on Windows. If I run apache as a service, CGItemp# files are correctly created and read in c:\windows\temp, but if I run apache from the command line/terminal, upload of attachments doesn't work (PS: only when using mod_perl): now it (CGI.pm) (tries to) reads CGItemp# files from C:\DOCUME~1\monster\LOCALS~1\Temp folder (the folder exists, no problem), but it never creates/writes the temp files!? (found out using Sysinternals FileMonitor). Workaround was to set fixed temp dir: $CGITempFile::TMPDIRECTORY = 'c:/temp'; It took a long time for me to figure this out. Please fix so the next guy doesn't won't have to figure out:-) Bug exists in at least 3.41 and 3.48. I can assist if you need me:-)
Subject: Re: [rt.cpan.org #53966] "CGI open of tmpfile: No such file or directory\n"
Date: Mon, 25 Jan 2010 09:53:49 -0500
To: bug-CGI.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> I found a problem with upload of attachments using apache2, mod_perl2 > and bugzilla running on Windows. > If I run apache as a service, CGItemp# files are correctly created and > read in c:\windows\temp, but if I run apache from the command > line/terminal, upload of attachments doesn't work (PS: only when using > mod_perl): now it (CGI.pm) (tries to) reads CGItemp# files from > C:\DOCUME~1\monster\LOCALS~1\Temp folder (the folder exists, no > problem), but it never creates/writes the temp files!? (found out using > Sysinternals FileMonitor). > > Workaround was to set fixed temp dir: > $CGITempFile::TMPDIRECTORY = 'c:/temp'; > It took a long time for me to figure this out. > > Please fix so the next guy doesn't won't have to figure out:-) > Bug exists in at least 3.41 and 3.48. > I can assist if you need me:-)
Thanks for the report. A patch would be welcome that offers a solution that would work for all Windows users. I'm not a Windows user myself and won't plan to attempt one. Mark
From: hardon [...] online.no
Show quoted text
> A patch would be welcome that offers a solution that would work for all > Windows users. I'm not a Windows user myself and won't plan to attempt > one. > > Mark
Unfortunately I'm no Perl coder. But I trialed and errored and think I found the cause: doesn't seem to work if the path contains ~ (tilde). AFAIK, this is a legal file name/path char in linux as well, so you may be able to reproduce by setting TMPDIR to something containing ~. Regards, Gunnar
From: hardon [...] online.no
The regex m!^([a-zA-Z0-9_ \'\":/.\$\\\+-]+)$! doesn't allow ~. Changing them (used 2 places) to m!^([a-zA-Z0-9_ \'\":/.\$\\\+-~]+)$! makes it work (tested). Since ~ is allowed both in Windows and Linux it should be safe? But I don't understand why the regex are there, the file system will give an error if the file name is invalid, no need to check (unless I am missing something).
This issue has been copied to: https://github.com/leejo/CGI.pm/issues/67 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Rejecting on the grounds that ~ is a shell meta character for a user's homedir: $CGITempFile::TMPDIRECTORY = '~root'; # oops CGITempFile may be refactored at a later stage to use File::Temp, at which point this issue will probably be solved. Given this is a 4 year old bug and the original issue relates to even older filesystems i'm erring on the side of "won't fix". Thanks!