Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 62000 - Bug file attachments broken under Windows
: Bug file attachments broken under Windows
Product: Bugzilla
Classification: Server Software
Component: Attachments & Requests (show other bugs)
: unspecified
: x86 Windows 2000
: P2 major (vote)
: Bugzilla 2.18
Assigned To: Jouni Heikniemi
: default-qa
: 88040 96846 170390 183716 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2000-12-05 10:59 PST by Matthew Mastracci
Modified: 2012-12-18 20:46 PST (History)
10 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

Patch (2.36 KB, patch)
2002-05-10 05:24 PDT, Jouni Heikniemi
bbaetz: review+
bbaetz: review+
Details | Diff | Splinter Review

Description Matthew Mastracci 2000-12-05 10:59:53 PST
The act of attaching a file to a bug under Windows is broken in Bugzilla.  
Adding the following two lines to showattachment.cgi will fix this.  Should 
there be an "is_windows" parameter in the conf file that could wrap all of the 

 use diagnostics;
 use strict;

 require "";


Comment 1 Thomas Leufkes 2001-05-23 04:33:03 PDT
For creating Attachments under Windows the following two lines


has to be added into the CREATEATTACHMENT.CGI
BEFORE the "require 'CGI.PL;'"- line.

If the two lines are missing, the system seems to hang in
the subroutine ProcessMultipartFormFields (in and
ends with a "CGI Timeout".

The "is_windows" param is a fine idea !
Comment 2 Matthew Tuck [:CodeMachine] 2001-05-27 10:38:46 PDT
Does this break Unix?  Move to 2.16 for consideration.
Comment 3 Dave Miller [:justdave] ( 2001-05-29 17:33:11 PDT
If it does break unix, we can make it conditional if it's windows...

if ($^O =~ /^(windows|winnt|win2k)$/) {

We'll need to make sure what $^O really returns for various flavors of windows 
though.  I'm just guessing above.
Comment 4 Thomas Leufkes 2001-05-30 02:04:54 PDT
On my BZ installation (W2K Server) a print $^O; displays "MSWin32".
A global param like "is_windows" that is set once,
may help to manage the source code differences.
Comment 5 Jacob Steenhagen 2001-05-30 06:08:44 PDT
I get "MSWin32" on various Win2k and NT 4 running both IIS and Apache
Comment 6 Dave Miller [:justdave] ( 2001-06-27 11:39:34 PDT
*** Bug 88040 has been marked as a duplicate of this bug. ***
Comment 7 Brian Rossmajer 2001-07-26 09:21:13 PDT
The perldoc for binmode claims it's always safe, that the logic is handled by 
the underlying libraries:

"In other words: Regardless of platform, use binmode() on binary files, and do 
not use binmode() on text files."
Comment 8 Zach Lipton [:zach] 2001-08-24 21:47:49 PDT
Comment 9 Zach Lipton [:zach] 2001-08-24 21:48:20 PDT
Comment 10 Matthew Tuck [:CodeMachine] 2001-08-27 13:38:30 PDT
*** Bug 96846 has been marked as a duplicate of this bug. ***
Comment 11 Dave Miller [:justdave] ( 2001-08-28 01:15:15 PDT
correcting version field lost in product move
Comment 12 olivier kurzweg 2001-09-03 09:12:28 PDT
createattachment.cgi seems to be still broken after having added the binmode 
After the attachment is sent to bugzilla, the createattachment page is re-
displayed with a blank form and a MIME section is printed in clear text 
(including the GIF attachment) above the form.
Comment 13 Dave Miller [:justdave] ( 2001-11-17 18:10:57 PST
We are currently trying to wrap up Bugzilla 2.16.  We are now close enough to
release time that anything that wasn't already ranked at P1 isn't going to make
the cut.  Thus this is being retargetted at 2.18.  If you strongly disagree with
this retargetting, please comment, however, be aware that we only have about 2
weeks left to review and test anything at this point, and we intend to devote
this time to the remaining bugs that were designated as release blockers.
Comment 14 jerry asher 2001-12-24 14:09:42 PST
I am seeing this under W2K for both Mozilla 0.9.7 and IE 5.5.

Would someone clarify, is this a Windows OS problem or a specific browser 
problem?  (I don't understand why it would be an OS problem....).

The other day this occurred under Mozilla on W2K, and I switched to IE and 
uploading an attachment worked.  Today it doesn't appear to work under either 
Mozilla or IE.
Comment 15 James Benninger 2002-03-26 08:37:48 PST
Adding those 2 lines to createattachment.cgi was not enough to fix the problem 
on my WinNT bugzilla server. I had to add the same to lines in the same place 
to showattachment.cgi. This fixed it for me.

To repeat for clarity:
  I added the following 2 lines:
  before the call to:
      require ""; 
  in both createattachment.cgi and showattachment.cgi and now everything works.

Comment 16 Jouni Heikniemi 2002-05-10 05:24:09 PDT
Created attachment 83032 [details] [diff] [review]

Adds Win32-only binmode calls for attachment.cgi and removes the installation
note telling the user to do this manually.

While there is some speculation over always using binmode (even with text
files), nobody has reported any complications and many people have successfully
used binmode with all types of files on Win32, so I think it's sane until
otherwise proven. 

As for adding a more generic variable for OS detection, I think that needs a
bit more thought - so this patch only fixes the immediate Win32 problem.
Comment 17 Jouni Heikniemi 2002-05-10 05:25:38 PDT
Taking & adding some keywords
Comment 18 Bradley Baetz (:bbaetz) 2002-06-19 01:52:04 PDT
Comment on attachment 83032 [details] [diff] [review]

r=bbaetz x2 does this always, for $OS=~/^(WINDOWS|DOS|OS2|MSWin)/;

$OS is set to windows if $O =~ /^MSWin/i

Anyway, this is fine for now, and we'll remove it when we start to use
Comment 19 Jouni Heikniemi 2002-06-20 05:26:18 PDT
barnboy: Is the documentation update part of the above patch outdated? Should
only the code changes be checked in?
Comment 20 Jouni Heikniemi 2002-07-04 02:23:15 PDT
I checked the code in separately; the documentation issue is now bug 155743. I
did this because it's not clear whether the sgml files are still the master
copies, so barnboy can sort it out when 2.18 docs are composed.

Checking in attachment.cgi;
/cvsroot/mozilla/webtools/bugzilla/attachment.cgi,v  <--  attachment.cgi
new revision: 1.15; previous revision: 1.14
Comment 21 sorin 2002-09-24 11:14:06 PDT
*** Bug 170390 has been marked as a duplicate of this bug. ***
Comment 22 Dave Miller [:justdave] ( 2002-12-05 22:10:08 PST
*** Bug 183716 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.