Closed Bug 94124 Opened 23 years ago Closed 18 years ago

Local Folder: Can create folder "#ab" but can't see it on restart. (folder name of starting "#")

Categories

(MailNews Core :: Backend, defect, P2)

x86
Windows NT
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: cavin, Assigned: cavin)

References

(Blocks 1 open bug)

Details

BUILDID: 20010805

I was able to create a local folder named "#ab" and move msgs into it. But on 
restart (ie, exit and restart mail) "#ab" was not listed under Local Folders. I 
checked the physical files and both "#ab.msf" and "#ab" did exist. Somehow 
folders starting with '#' were filtered out. If this is the case (for some 
good reasons) then we should not allow creation of such folders in the first 
place.

The second problem I found is that when I tried to view the msgs in folder "#ab" 
I got the following error msg:

  Unknown Error: 80004002

The thread pane listed the msgs fine but could not read any msgs.
QA Contact: esther → sheelar
talking with cavin over aim, there is code in nsLocalMailFolder.cpp (from 4.x)
that ignores folders that start with #.

we should figure out why we did that in 4.x, there was probably a good reason.

one way around this is to fix the hashifnecessary() code to force hash if the
first char is a #.

that way, you will be able to create "#ab" and use it.
Still exists on commercial build: 2001-12-14-06 win98. Saw the same results as 
cavin.  
Either we don't allow user to create such folders or resolve so that creating a 
folder starting with '#' does not disappear from the local folder list after 
start up.  
Assignee: mscott → naving
Keywords: nsbeta1
*** Bug 115091 has been marked as a duplicate of this bug. ***
The bug I just marked as a duplicate deals with problems with '#' anywhere in
the folder name. It sounds like we don't handle "#"
Status: NEW → ASSIGNED
I have asked that 115091 be reopened. I don't think there exactly alike. I can
see the folder (test #1) after restarting Mozilla, but still can't do anything
with it. I am recommending that 94124 be fixed first then test that 115091 is
resolved with this fixed before closing it.
An additional data point:  The IMAP server won't let me create a folder that
begins with #.  
*** Bug 107722 has been marked as a duplicate of this bug. ***
I also have trouble while using "[" and "]" brakets in foldernames. These should
also be filtered out or something else in the first step.
Keywords: nsbeta1nsbeta1+
Priority: -- → P2
reassigning to cavin.
Assignee: naving → cavin
Status: ASSIGNED → NEW
Target Milestone: --- → mozilla0.9.9
Blocks: 115091
Status: NEW → ASSIGNED
Target Milestone: mozilla0.9.9 → mozilla1.0
Blocks: 122274
Keywords: nsbeta1+nsbeta1-
Target Milestone: mozilla1.0 → mozilla1.2
Marco, that's bug 94512.
*** Bug 165993 has been marked as a duplicate of this bug. ***
Not sure if this should be considered a seperate bug, but the same happens if you have a tilde ("~") at the beginning *or* end in the (local) folder name. The files are there, but the folder won't show after restart. I'm using 20020826...
QA Contact: sheelar → esther
Problem was recreated on 2002111508-trunc/Win-Me for "." in folder name.

[Test Procedure and Result]

[CASE-0 : Middle dot]

File name were "ABC.DEF", "ABC.DEF.msf".
No problem was found for folder name of "ABC.DEF".

[CASE-1 : dot only]

(1-1) Try to create folder named "." , ".." , "..." , "...." etc.
 ->  Message of "A folder with that name already exists" was issued
  
[CASE-2 : Start with dot]

(2-1) Create a folder named ".ABC"
 -> Files named ".ABC", ".ABC.msf" were created.
 -> Mail copy/move, folder move/delete/rename works well.
(2-2) Restart Mozilla
 -> Folder named ".ABC" disapeared. Files of ".ABC", ".ABC.msf" still exits.
 Does Mozilla treat ".ABC" and/or ".ABC.msf" as hidden file?
 This may be a DUP of bug 94124 (Folder named "#" case).

[CASE-3 : End with dot]

(3-1) Create a folder named "XYZ."(1 dot)
 -> Folder name is "XYZ." (1 dot)
 -> File named "XYZ" (no dot) was created. (<== Should be "XYZ.",  1 dot)
 -> File named "XYZ..msf"(2 dots) was created.
(3-2) Try to copy a mail to this folder via. context menu
 -> Folder "XYZ." (1 dot) did not included on context menu.
 -> Draging a mail to folder "XYZ." (1 dot) will fail.
(3-3) Restart Mozilla
 -> Folder name of "XYZ" (no dot) apeared
 This is recovered from "XYZ"(no dot) file and "XYZ.msf" was newly created
 -> Folder name of "XYZ." (1 dot) disapeared
 "XYZ..msf"(2 dot) was ignored because "XYZ." (1 dot) does not exist.

Since "."(0x2E) is separator of file extention, special care will be required
although "." is a valid file name character.

Fix for bug 117385 has improved treatment of illegal characters and the fix is
already applied on tested build.
0x5C(\,real filename will be "00000072.msf") and 0x7C(|,real filename will be
"00000092.msf") cases were resolved by this fix.
If "." in folder name is treated as an illegal file name character like
"\"(0x5C) or "|"(0x7C), all "." related problems, I think, will be resolved.
Above is comment for bug 117840("." in folder name problem).
Ignore, please.  
Sorry for my mistake.
I found something that might be related:

I tried to create a folder GMX->Mailinglists->OS/2 and eCS (GMX and Mailinglists
already exist)

The Folder naming dialog did not close with the name "OS/2 and eCS" so i figured
the name is invalid, the folder is not visible in the sidebar.

So i changed the name to "OS2 and eCS" which saves ok and is displayed in the
sidebar instantly.

To my surprise, when i created message filters via "Message Filters..." that
move messages to the "OS2 and eCS" folder i can see a folder called "2 and eCS"
in the target folder selection.
*** Bug 249715 has been marked as a duplicate of this bug. ***
Since Bug 219586 and Bug 264467 resolved "/" in folder name problems (I think 
also resolved "?" problem, bug 41944), if same logic for "/" is also applied to
"#" in folder name, I think this bug can be easily fixed, although real file
name becomes converted string(HEXA-string).

Please note that "#" is also a delimiter in URI(delimiter of anchor),
as "/" is delimiter of path in URI, and as "?" is delimiter of search in URI.
Product: MailNews → Core
(In reply to comment #17)
Mscott has probably fixed this bug in addition to "/" and "?" problem.
(1) He says in change log of Thunderbird 1.0 RC1 ;
> What's New In 1.0
> * Fix problems creating folders with semicolons or # signs in the name 
 ( http://forums.mozillazine.org/viewtopic.php?p=1020843 )
(2) With Thunderbird 1.0 RC1 and Mozilla latest-trunk 2004120205 (Win-2K)
   (2-1) Converted string(HEXA-string) was used as file name
         for folder name which contains "#",
         then this bug's problem did not occur.
   (2-2) Converted string(HEXA-string) was also used for ";"
(In reply to comment #18)
> Mscott has probably fixed this bug in addition to "/" and "?" problem.
I can't imagine other than patch for Bug 262018.
Summary: Local Folder: Can create folder "#ab" but can't see it on restart. → Local Folder: Can create folder "#ab" but can't see it on restart. (folder name of starting "#")
Fix for Bug 262018 was probably removed just before shipment of Tb 1.0.0, then Tb 1.0.x probably still had this bug.
But I think TB 1.5 has fix for this bug.
Question to all reporters of problem when "#" in local mail folder name:
 Does problem still remain on Tb 1.5.0.x?

Note:
When IMAP, different issues may be involved in "#" related problem, so different problem from this bug in many situtations. See Bug 95114 and Bug 84045.
No longer blocks: 115091
As Bug 273753 Comment #1 says, there is a logic for starting "#" in addition to
 starting "."/ending "~" in /mailnews/local/src/nsLocalMailFolder.cpp.
> nsShouldIgnoreFile(nsString& name)
> {
>   PRUnichar firstChar=name.CharAt(0);
>   if (firstChar == '.' || firstChar == '#' ||
>       name.CharAt(name.Length() - 1) == '~'  )
>     return PR_TRUE;
This is the reason why local mail folder disappears if file name starts with "#".

Fix for Bug 262018 changed file name rule for folder name contains "#" :
 - If "#" is contained, use hashed name as file name for the mail folder
   when mail folder file creation. (folder name is saved in ".msf" file.)
So this bug can not occur if folder with "#" is created by Tb with the patch applied. But if the folder was created by Tb 1.0.x or before and disappered, Tb 1.5.0.0 or later can do nothing for the hidden mail folder due to starting "#".
In this case, rename of the mail folder file and deletion of ".msf" file for it are required to recover.

=> WORKSFORME, or FIXED by patch for Bug 262018. 
Depends on: 262018
->WFM, actually resolve per comment 21.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
Target Milestone: mozilla1.2alpha → ---
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.