Closed
Bug 145455
Opened 24 years ago
Closed 11 years ago
Mozilla doesn't support 3+ level local folders created manually.
Categories
(MailNews Core :: Backend, defect, P2)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: calvin.liu, Unassigned)
References
Details
Attachments
(3 files, 2 obsolete files)
|
3.46 KB,
patch
|
Details | Diff | Splinter Review | |
|
9.64 KB,
text/plain
|
Details | |
|
2.45 KB,
text/plain
|
Details |
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4u)
BuildID:
Reproducible: Always
Steps to Reproduce:
0. quit mozilla (must do this at first step)
1. go to your local folder directory (find it from [preferences]->[local folder]
settings)
2.a. mkdir -p a/a/a/a
2.b. (optional) cd a/a/a/a and touch some files in these subfolder
3. restart mozilla and expand "Local Folder"
Actual Results: only 2 level subfolder appear
Expected Results: all subfolder can be seen
Comment 1•24 years ago
|
||
Have you tried mkdir -p a.sbd/a.sbd/a.sbd/a.sbd ?
| Reporter | ||
Comment 2•24 years ago
|
||
"mkdir -p a.sbd/a.sbd/a.sbd/a.sbd" makes the same result. It's no use.
Suppose you're using solaris and dtmail. Following these steps to reproduce this
bug:
1. open dtmail, create a new folder by using [Mailbox]->[New Mailbox] menu
2. int the [Enter file name] textbox, input "a/b/c", then press [New Mailbox] button
3. copy a mail from your inbox(any mail is ok) to the new folder c
4. close dtmail
5. open mozilla mail client, set [Local Folder] option in [Edit]->[Mail &
Newsgroups Account Settings] to the same folder as dtmail. by default, it's
$HOME/Mail.
6. quit all mozilla windows and restart it again.
7. looking at the a/b/c folder...
... you can't see the folder c and the mail inside, you can only see folder a/b.
but... you can move mails into a or b, which will cause the mail lose!
this bug related to 145639 (http://bugzilla.mozilla.org/show_bug.cgi?id=145639).
i don't know which one blocks the other.
Updated•24 years ago
|
QA Contact: gayatri → sheelar
| Reporter | ||
Comment 4•24 years ago
|
||
I try to do the followins to an OS created folder, suppose it's folder "a":
1. rename a to "a.sbd"
2. create new file "a" and "a.msf"
3. create related db
Part of the code comes from nsMsgLocalMailFolder::CreateSubfolder(const
PRUnichar *folderName, nsIMsgWindow *msgWindow ). I can't call this method
directly. Seems I should make a new method or add a parameter to it. Either way
will modify the interface, right? So I hope to fix the bug at first and then go
on seeking better patch.
FYI. NS_IMETHOD CreateSubfolder (const PRUnichar *folderName,nsIMsgWindow
*msgWindow)
http://unstable.elemental.com/mozilla/build/latest/mozilla/mailnews/dox/classnsMsgLocalMailFolder.html
Comment 5•24 years ago
|
||
No this is not the right fix. We build up the local folders list when we
start-up. look at nsMsgLocalMailFolder::GetSubfolders. It makes recursive calls
and builds up the entire local folders tree. I think it should already be
working. If you want to create local folders manually. Create folder a and a.sbd
then create b in a.sbd and so on for folder tree
Local Folders
a
--b...
Comment 6•24 years ago
|
||
Also we don't create db for such manually create folders on start-up, only when
the user selects the folder.
| Reporter | ||
Comment 7•24 years ago
|
||
naving,
There is a problem, if I don't create the summary file and there are several
groups of such local-folder-chains, I'll meet trouble on deleting them after
successfully converting.
Comment 8•24 years ago
|
||
When you select the folder to delete it, the summary file will be generated and
we don't support selecting multiple folders and deleting them all at once. so it
should be fine.
| Reporter | ||
Comment 9•24 years ago
|
||
Attachment #94609 -
Attachment is obsolete: true
Comment 10•24 years ago
|
||
Comment on attachment 95047 [details] [diff] [review]
clean code, remove hardcode const string.
Seems good. Navin, your opinions?
Comment 11•24 years ago
|
||
Comment on attachment 95047 [details] [diff] [review]
clean code, remove hardcode const string.
But I think
+ outputStream.flush();
and
+ if (rv == NS_OK && child){
+ nsCOMPtr<nsISupports> childSupports(do_QueryInterface(child));
+ nsCOMPtr<nsISupports>
folderSupports(do_QueryInterface(NS_STATIC_CAST(nsIMsgLocalMailFolder*, this),
&rv));
+ if (childSupports && NS_SUCCEEDED(rv)){
+ NotifyItemAdded(folderSupports, childSupports, "folderView");
+ }
+ }
are not needed.
| Reporter | ||
Comment 12•24 years ago
|
||
Thanks Henry. I got rid of the redundant code.
Attachment #95047 -
Attachment is obsolete: true
Comment 13•24 years ago
|
||
No, this fix is not needed as I said in earlier comments. This bug should be
worksforme.
| Reporter | ||
Comment 14•23 years ago
|
||
also reproduced on other OS, e.g. Windows.
OS: Solaris → All
Priority: -- → P2
Hardware: Sun → All
Comment 15•23 years ago
|
||
yes, I can reproduce it on windows. In addition, no mail databases are acutally
created, even when I select the folders in mail/news (as naving said we should).
As such, copying mail to these folders fails, and gives an error about
insufficient disk space (I've got plenty.) In any case, I think it makes more
sense to make sure everything is valid before you start showing the folders to
the user, and that means turning plain subdirectories into real mail folders.
It's an interesting bug, I wish I was qualified to review the patch.
Comment 16•23 years ago
|
||
This bug exists in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b)
Gecko/20020812 (this is Win2000).
If I create several (sub^n)-folders (eg. md a\a\a\a), only the first and second
are shown. But: neither is usable! Trying to copy mails to these folders just
doesn't work. A msf is created only for the first one, but that makes no difference.
| Reporter | ||
Comment 17•23 years ago
|
||
Want to explain my patch a little bit more.
nsresult nsMsgLocalMailFolder::CreateSubFolders(nsFileSpec &path)
{
nsresult rv = NS_OK;
nsAutoString currentFolderNameStr;
nsCOMPtr<nsIMsgFolder> child;
// for loop is used to scan all the files/subfolders in current folder, just
1 level
// without "." and ".."
for (nsDirectoryIterator dir(path, PR_FALSE); dir.Exists(); dir++){
// get them one by one
nsFileSpec currentFolderPath = dir.Spec();
// get the leafname
char *leafName = currentFolderPath.GetLeafName();
nsMsgGetNativePathString(leafName, currentFolderNameStr);
PR_FREEIF(leafName);
// if it's a OS folder but not a mozilla folder, should convert it
//
if (currentFolderPath.IsDirectory()){
// if the folder name is *NOT* ended by ".sbd", rename it to "*.sbd"
// e.g. if the folder is "a", then rename it to "a.sbd"
nsAutoString sep;
nsresult rv = nsGetMailFolderSeparator(sep);
if (!nsStringEndsWith(currentFolderNameStr,NS_ConvertUCS2toUTF8(sep.get
()).get())){
nsFileSpec tmp(currentFolderPath);
AddDirectorySeparator(tmp);
currentFolderPath.Rename(tmp.GetLeafName());
}
if (NS_FAILED(rv)) return rv;
// now create file "a" and summary file "a.msf"
nsCAutoString str(currentFolderPath.GetNativePathCString());
str.Truncate(str.Length()-sep.Length());
nsFileSpec newFile(str.get());
// suppose no other thread (application) will create a file at this time,
// we can remove the following if statement.
if (!newFile.Exists()){
//create new file here
nsOutputFileStream outputStream(newFile, PR_WRONLY | PR_CREATE_FILE,
00600);
if (outputStream.is_open())
outputStream.close();
// need to create new db
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, NS_GET_IID
(nsIMsgDatabase), getter_AddRefs(mailDBFactory));
if (NS_SUCCEEDED(rv) && mailDBFactory){
nsCOMPtr<nsIMsgDatabase> newDB;
nsCOMPtr <nsIFileSpec> dbFileSpec;
NS_NewFileSpecWithSpec(newFile, getter_AddRefs(dbFileSpec));
rv = mailDBFactory->Open(dbFileSpec, PR_TRUE, PR_TRUE, getter_AddRefs
(newDB));
if (NS_SUCCEEDED(rv) && newDB){
//need to set the folder name
nsAutoString folderNameStr;
folderNameStr.AssignWithConversion(str.get());
nsCOMPtr<nsIDBFolderInfo> folderInfo;
rv = newDB->GetDBFolderInfo(getter_AddRefs(folderInfo));
if(NS_SUCCEEDED(rv))
folderInfo->SetMailboxName(&folderNameStr);
//Now let's create the actual new folder
newDB->SetSummaryValid(PR_TRUE);
newDB->Close(PR_TRUE);
//should modify the currentFolderNameStr here
char *leafName = newFile.GetLeafName();
nsMsgGetNativePathString(leafName, currentFolderNameStr);
PR_FREEIF(leafName);
}
else{
newFile.Delete(PR_FALSE);
rv = NS_MSG_CANT_CREATE_FOLDER;
}
}
}
}
// some folder of file is ended by ".msf" etc. should skip.
if (nsShouldIgnoreFile(currentFolderNameStr))
continue;
rv = AddSubfolder(¤tFolderNameStr, getter_AddRefs(child));
if (child)
child->SetPrettyName(currentFolderNameStr.get());
}
return rv;
}
Comment 18•23 years ago
|
||
Hi Navin:
If I understand your viewpoint, it appears like that we are creating bugs on our
own by manually creating some mail folders. As a matter of fact, we aren't
trying to. We actually encountered such problem. It is a real problem for us,
and it is actually a showstopper for our deployment of N7 internally. That's
why we really need your help on this.
The steps which Calvin has listed here is to mimic how our desktop mail client
creates sub-folders. We don't have .msf files and we don't have .sbd files.
While it reads fine using Netscape 4.7x, users do not see 3rd level sub-folders
being displayed at all in mozilla/Netscape7. To the users, this is a
regression. And we are hosed. While it can be reproduced on Windows as well, I
would think that it should be a real bug (maybe corner case for Windows), but it
is a bug. We need your help in order to get a resolution to this bug. If you
don't think that the implementation is good enough, we are willing to hear
suggestions. Please re-evaluate this problem. Your help is very much
appreciated. Thanks, Margaret
Comment 19•23 years ago
|
||
ok, I will try to recreate the problem on my linux box on monday, will report back.
Comment 20•23 years ago
|
||
I created 4+ levels of folders maunually. It worksforme.
The way to do it is
create file a
mkdir a.sbd
cd a.sbd
create file b
mkdir b.sbd
cd b.sbd
create file c
mkdir c.sbd
cd c.sbd
....
Comment 21•23 years ago
|
||
Navin,
Yes, when manually creating the folder/subfolders as you did, they work fine.
The situation here is that our internal mailer creates directories a/b/c/...
and not a.sbd, b.sbd, c.sbd, etc. Calvin's patch is trying to recognize these
directories a/b/c and mimic what you do manually by renaming
directories a/b/c to a.sbd/b.sbd/c.sbd and also creating files a, b, and c
so they can be visible/processed by Mozilla/Netscape7. Does my explanation
make sense to you? I appreciate your comments/questions.
Thanks, Ping
Comment 22•23 years ago
|
||
Since NS 4.7x can hanndle these kinds of mail subfolders. For the users facing
this problem, it is a regression. Calvin's patch is only to make Mozilla
compatible with NS 4.7x.
Comment 23•23 years ago
|
||
ok, I got your point. We still don't need to open the db for that. All that db
code is not required. He can just create files and directories as you point out.
Look for all directories, if they don't have sbd extension just rename the dir
and create the file if missing. Could it be a violation of user's privacy ?
don't know. So for dir "a" rename "a" to "a.sbd" and then create flat file "a",
if not there.
Comment 24•23 years ago
|
||
I think renaming those folders is a violation, and is unacceptable. We should be
able to deal with the directories somehow, though it will be painful. I doubt
4.x renamed the folders!
Comment 25•23 years ago
|
||
I see both of your concerns. Any advice/suggestions for a better patch?
| Reporter | ||
Comment 26•23 years ago
|
||
I've got Naving & Bienvenu's view. Any suggested solution/patch?
| Reporter | ||
Comment 27•23 years ago
|
||
Use shell script in "mozilla" or "netscape" script to convert those folders.
Usage 1 (migration):
1. set OLD_PREF_FILE=$HOME/.netscape/preferences.js in dtMail2NS.sh
2. set TARGET_LOCAL_FOLDER=$HOME/Mail in dtMail2NS.sh
3. run ./dtMail2NS.sh -auto
4. select 1
5. check the result.
Usage 2 (manually/after migration):
./dtMail2NS.sh -conv <old path> <new path>
Usage 3
./dtMail2NS.sh -user
It'll search all prefs in $HOME/.mozilla and let you choose.
Hope this script is another solution.
| Reporter | ||
Comment 28•23 years ago
|
||
dtMail2NS.sh will call this script.
Comment 29•23 years ago
|
||
In respond to comments #23 and #24 about privacy concerns,
here is a new approach. No renaming or creation of files/directories
in the original mail directory (such as $HOME/Mail).
Instead, somewhere in .mozilla (e.g., $HOME/.mozilla/Mail/Local Folders),
we create the files and directories that Mozilla needed and symbolically
link the subfolders back to the original file location.
For example:
(Assumption, on the left hand column, only the lowest level subfolder
can contain emails, but on the right hand column, after the files, directories
are created and symbolic links are done, Mozilla can save emails on any
levels of folders/subfolders)
$HOME/Mail $HOME/.mozilla/Mail/Local Folders
---------- ---------------------------------
a/b1 a
a.sbd
a.sbd -> a/b1
a/b2 a.sbd -> a/b2
a/b/c1 a.sbd/b
a.sbd/b.sbd
a.sbd/b.sbd/c1 -> a/b/c1
a/b/c2 a.sbd/b.sbd/c2 -> a/b/c2
a/b/c/d1 a.sbd/b.sbd/c
a.sbd/b.sbd/c.sbd
a.sbd/b.sbd/c.sbd/d1 -> a/b/c/d1
a/b/c/d2 a.sbd/b.sbd/c.sbd/d2 -> a/b/c/d2
Is this scheme acceptable as a viable solution?
Calvin's comments #27 and #28 are the scripts to implement this approach
and they seem to work.
Updated•21 years ago
|
Product: MailNews → Core
Comment 31•19 years ago
|
||
sorry for the spam. making bugzilla reflect reality as I'm not working on these bugs. filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Comment 33•18 years ago
|
||
do you see this problem?
I created a1/a2/a3/a4 and TB sees it fine. Although I did not create any mail content for the folder
| Assignee | ||
Updated•18 years ago
|
Product: Core → MailNews Core
Comment 34•17 years ago
|
||
linux confirmation also wanted. Tony, is this work for you?
Comment 35•17 years ago
|
||
(In reply to comment #34)
> linux confirmation also wanted. Tony, is this work for you?
On SeaMonkey-trunk mail: some weeks ago I created "folders" 3 levels down from Local Folders (e.g. "Local Folders/Newsletters/RTBf Radio/RTBf Info"). All these subfolders were created from within SeaMonkey. I don't have anything "deeper" and I didn't try to meddle with the internals of the Mail/ subfolder of my profile folder with mkdir, touch, cp, and the like. Immediately after creating these folders, I noticed that unread mail in them (placed there by filters) didn't cause the top-level folder ("Newsletters" in this example) to become highlighted in bold when all folders were collapsed, and that "Next Unread" then skipped these new "deep" subfolders. Since then, I'm keeping the folder tree in expanded state, so that the _sub_folders are now (visible and) bolded when there is unread mail in them, and "Next Unread" stops at them in the same case.
This is the only "problem" related with mail folder nesting depth which affects me, but I'm not sure if I answered your question. If I didn't, please (Wayne) email me more details privately.
Comment 36•15 years ago
|
||
Is this a valid bug? Why should TB support folders created directly in the file system, by some external program, in the wrong way?
(In reply to comment #35)
> Immediately after
> creating these folders, I noticed that unread mail in them (placed there by
> filters) didn't cause the top-level folder ("Newsletters" in this example) to
> become highlighted in bold when all folders were collapsed, and that "Next
> Unread" then skipped these new "deep" subfolders. Since then, I'm keeping the
> folder tree in expanded state, so that the _sub_folders are now (visible and)
> bolded when there is unread mail in them, and "Next Unread" stops at them in
> the same case.
>
> This is the only "problem" related with mail folder nesting depth which affects
> me,
If this is an existing problem, it should probably be a separate bug.
Comment 37•15 years ago
|
||
The only reason to support it is that we used to support it a long time ago, but that's a pretty negligible reason to support it now.
Comment 38•11 years ago
|
||
All the recent testing points to ths being supported, if I read the comments correct.y
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•