Closed
Bug 161641
Opened 22 years ago
Closed 22 years ago
Wrong logic in nsMsgDBFolder::CreateFileSpecForDB
Categories
(MailNews Core :: Database, defect)
MailNews Core
Database
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: calvin.liu, Assigned: Bienvenu)
Details
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1 BuildID: nsMsgDBFolder.cpp: Line 631: if (path.Exists()) should be if(!path.Exists()) Reproducible: Always Steps to Reproduce: 1. 2. 3. Actual Results: no file will be created. Expected Results: create the file if it's not exist. FYI. http://lxr.mozilla.org/seamonkey/source/mailnews/base/util/nsMsgDBFolder.cpp#631 612 nsresult nsMsgDBFolder::CreateFileSpecForDB(const char *userLeafName, nsFileSpec &path, nsIFileSpec **dbFileSpec) 613 { 614 NS_ENSURE_ARG_POINTER(dbFileSpec); 615 NS_ENSURE_ARG_POINTER(userLeafName); 616 nsCAutoString proposedDBName(userLeafName); 617 NS_MsgHashIfNecessary(proposedDBName); 618 619 // (note, the caller of this will be using the dbFileSpec to call db->Open() 620 // will turn the path into summary spec, and append the ".msf" extension) 621 // 622 // we want db->Open() to create a new summary file 623 // so we have to jump through some hoops to make sure the .msf it will 624 // create is unique. now that we've got the "safe" proposedDBName, 625 // we append ".msf" to see if the file exists. if so, we make the name 626 // unique and then string off the ".msf" so that we pass the right thing 627 // into Open(). this isn't ideal, since this is not atomic 628 // but it will make do. 629 proposedDBName+= SUMMARY_SUFFIX; 630 path += proposedDBName.get(); 631 if (path.Exists()) 632 { 633 path.MakeUnique(); 634 proposedDBName = path.GetLeafName(); 635 } 636 // now, take the ".msf" off 637 proposedDBName.Truncate(proposedDBName.Length() - SUMMARY_SUFFIX_LEN); 638 path.SetLeafName(proposedDBName.get()); 639 640 NS_NewFileSpecWithSpec(path, dbFileSpec); 641 return NS_OK; 642 }
Reporter | ||
Comment 1•22 years ago
|
||
Maybe I misunderstood the meaning of MakeUnique here. Close this bug.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Updated•20 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•