[meta] Problems caused by userName/realuserName and hostName/realhostName
Categories
(Thunderbird :: General, defect, P2)
Tracking
(thunderbird_esr91 wontfix)
Tracking | Status | |
---|---|---|
thunderbird_esr91 | --- | wontfix |
People
(Reporter: jorgk-bmo, Assigned: rnons)
References
Details
(Keywords: meta)
Let's start a collection.
Comment 1•5 years ago
|
||
Someone would have to do the digging on the exact background and usage of realhostname, but there must be some better way than keep having both hostname and realhostname and get them wrong half the time. We need to investigate how we can get rid of realhostname.
Comment 2•4 years ago
|
||
Khushil, this could be something to investigate for you.
I find it likely we can remove it, but probably it needs some migrator code for the cases we already have.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Ben, does https://support.mozilla.org/en-US/questions/1315845 fit into one of the blockers?
Comment 4•3 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #3)
Ben, does https://support.mozilla.org/en-US/questions/1315845 fit into one of the blockers?
Yes, that does sound like the kind of problem that this might cause!
I did have a quick poke around the other day, but came away a little baffled over the purpose of the username/realUsername split... it must have been added for some good reason, but I can't quite figure it out. Will try and do a deeper dive soon.
Comment 5•3 years ago
|
||
It's used for the case where you have imap.foo.com set up, and then the server changes (maybe the company was bought up) and you should start using imap.bar.com. At that point, what's on disk will have a directory named according to the older name, etc. But I don't know the exact details of why it was chosen just not to do needed renames at that point. It's certainly caused lots of subtle issues, and I think we should see if we can't just do the needed adjustments where hostname changes, and not have the two different hostnames in history forever.
Comment 6•3 years ago
|
||
important |
From matrix:
Standard8
mkmelin: oh, I think I vaguely remember.
I think it is because for the various accounts we use the uris which include hostname + username.
However, if the user comes along and changes either or both of those, we still need to reference the old URIs in various places iirc.
I think password manager might have been one of those.
I vaguely remember discussing this with Bienvenu a long time ago.
mkmelin
It's certainly before hg time...
Standard8
yeah I wouldn't be surprised if this was in the suite.
and netscape
mkmelin
Needing to enter password again if you change hosts doesn't sound so bad. There could be worse cases that need changing of course.
Standard8
It'd be nice to tidy up the old one though 😉
Thinking about it, it might be more viable now we don't have RDF
but you'd probably want to audit if these are being used anywhere, in URIs etc.
mkmelin
Yeah... Ever so often we encounter problems due to the hostname/realhostname split. I think certs overrides is most recent one. Proxies is another one. One for OAuth I recently fixed.
Standard8
Definitely worth a look around again I think, with the various changes that have been done.
Oh and as you said in the bug, directory names as well...
Certainly feels like you should be able to not expose those at the interface levels, though I can't remember how that lot is structured.
jcranmer
Standard8's description matches up with my intuition
we use username + hostname to uniquely/persistently identify accounts in URIs in several places, and changing host name shouldn't change that ID
e.g., the file location storage is based on hostname + realhostname
were it up to me, I'd map realhostname -> hostname and hostname -> originalhostname (ditto for username), and then try to carefully audit all places where we actually use originalX to see if we actually need to persist it
retrofitting that onto our existing account setup… I'm not sure the realhostname is the worst thing in our system so far
Standard8
it might not be, but it certainly can be confusing... and I like the idea of changing to use original host name, much clearer.
jcranmer
it might be feasible now that XUL extensions are dead
Comment 7•3 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #6)
From matrix:
...
jcranmer
Standard8's description matches up with my intuition
we use username + hostname to uniquely/persistently identify accounts in URIs in several places, and changing host name shouldn't change that ID
e.g., the file location storage is based on hostname + realhostname
were it up to me, I'd map realhostname -> hostname and hostname -> originalhostname (ditto for username), and then try to carefully audit all places where we actually use originalX to see if we actually need to persist it
retrofitting that onto our existing account setup… I'm not sure the realhostname is the worst thing in our system so far
Standard8
it might not be, but it certainly can be confusing... and I like the idea of changing to use original host name, much clearer.
jcranmer
it might be feasible now that XUL extensions are dead
In which bug report do you want this work to be done?
A good project for new staff?
Comment 8•3 years ago
|
||
Probably best to do the work to get rid of it in this bug.
(In reply to Magnus Melin [:mkmelin] from comment #5)
It's used for the case where you have imap.foo.com set up, and then the server changes (maybe the company was bought up) and you should start using imap.bar.com. At that point, what's on disk will have a directory named according to the older name, etc. But I don't know the exact details of why it was chosen just not to do needed renames at that point. It's certainly caused lots of subtle issues, and I think we should see if we can't just do the needed adjustments where hostname changes, and not have the two different hostnames in history forever.
Wouldn't it be helpful to name the local folders NOT according to the hostnames, but use the same key as in the settings (e.g. server9)? Then the change of a server address would not require and folder renaming.
Also, what I noticed a couple of times is that in some cases, error messages (e.g. when no connection can be made) report that "hostname" has a problem even though TB tries to connect to "realhostname". This confused me until today when I figured out that a hostname change will maintain the original hostname value...
Assignee | ||
Comment 10•2 years ago
•
|
||
Because of .directory
and .directory-rel
prefs, I don't think folders on disk is a problem.
Seems to me two prefs are still needed, because after changing hostname, all the folder/message urls still use the old hostname, unless we
- require a restart
- propogate hostname change everywhere without a restart
Things can be improved to fix bug 1762301, bug 1727677, bug 1765754
- when constructing server/folder/message urls, use realhostname and fallback to hostname
- when finding server by folder/message urls, use realhostname and fallback to hostname
- on startup, replace hostname with realhostname, then remove realhostname
This may be a litter easier after bug 1707547
Comment 11•2 years ago
|
||
Requiring restart for such a special case sounds reasonable to me.
Assignee | ||
Comment 12•2 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #11)
Requiring restart for such a special case sounds reasonable to me.
That would be easy. On hostname change, we can set a pref (e.g. pendinghostname
) and show a line Hostname change will take effect after a restart [Restart now]
, and nothing else.
Then on restart, we merge realhostname/pendinghostname into hostname, and remove realhostname/pendinghostname.
Do you want me to take this?
Assignee | ||
Comment 14•2 years ago
|
||
Fixed in bug 1483485.
Comment 15•2 years ago
|
||
So I am seeing a lot of fallout due to the unannounced renaming of server and username as it changes all Folder URIs on affected accounts - and my Add-on(s) store folder URIs in order to persist information for my users (In the case of QuickFolders, these are folder tabs and special settings such as reply identities and visual configurations that are stored on a per folder basis).
I have 2 questions:
Is there any way to reconstruct the old folder URI to write a mitigating tool that fixes these problems? Or maybe a log entry somewhere on what URIs were merged in this way? Not all users have backups of user.prefs for reconstruction.
Is this a once-off fix that happens during the migration to Thunderbird 102 or can it happen again once the accounts are migrated?
Comment 16•2 years ago
|
||
Related issue - I hope I summarized this correctly.
https://github.com/RealRaven2000/QuickFolders/issues/281
I would be very very grateful for some feedback there. I need to find a way of mitigating fallout from 1000s of users migrating their profiles and ending up with broken QuickFolders tabs.
Comment 17•2 years ago
•
|
||
This might be effecting filter rules in general on upgrading from 91 to 102. Bug 1777731
Assignee | ||
Comment 18•2 years ago
|
||
(In reply to Axel Grude from comment #15)
I have 2 questions:
Is there any way to reconstruct the old folder URI to write a mitigating tool that fixes these problems? Or maybe a log entry somewhere on what URIs were merged in this way? Not all users have backups of user.prefs for reconstruction.
At the point of upgrading, the old hostname/username still exists. After that, they are gone.
Is this a once-off fix that happens during the migration to Thunderbird 102 or can it happen again once the accounts are migrated?
The folder uri changes every time username/hostname get changed. Sorry, I don't have any good solution at the moment.
Comment 19•2 years ago
|
||
Just an update on this - here is how I remedy the problem from an Add-ons writer's perspective. QuickFolders now also stores the account id (e.g. "account1" together with the URI to store its folder shortcuts; once the upgrade to Thunderbird 102 happens (or a server is renamed), Thunderbird can detect invalid URIs and tries to rebuild the URI with the new root and fixes them quietly. Note that when you use Services.io.newURI
to generate a new valid uri from the old one, you cannot use "imap" unless the folder exists for certain - POP3 and Local host have no such problem (hence the replacement with http)
function reconstructUri(e) {
let ac = MailServices.accounts.getAccount(e.account), acType = "N/A";
if (ac && ac.incomingServer) {
acType = ac.incomingServer.type || "unknown";
if (acType!="im") { // do not reconnect to chat accounts - these are not supported.
let oldUri = e.uri.replace("imap://", "http://"); // non-existent imap URIs throw!!
let tempUri = Services.io.newURI(oldUri); // generate a fresh URI to retrieve path portion
// or oldUri.filePath - not sure whether query params make sense or are allowed for folder URIS
return ac.incomingServer.serverURI + tempUri.pathQueryRef;
}
}
throw new Error(`Failed to reconstruct URL for ${e.uri} of account ${e.account} - account type ${acType}`);
}
I am hoping that this will address the issue when Thunderbird 102 switches to manual / automatic update for all current users of 91.
Comment 20•2 years ago
|
||
(In reply to Ping Chen (:rnons) from comment #18)
(In reply to Axel Grude from comment #15)
I have 2 questions:
Is there any way to reconstruct the old folder URI to write a mitigating tool that fixes these problems? Or maybe a log entry somewhere on what URIs were merged in this way? Not all users have backups of user.prefs for reconstruction.At the point of upgrading, the old hostname/username still exists. After that, they are gone.
Is this a once-off fix that happens during the migration to Thunderbird 102 or can it happen again once the accounts are migrated?
The folder uri changes every time username/hostname get changed. Sorry, I don't have any good solution at the moment.
Getting quite a few requests from quickFIlters users who notice that their filters have invalid target folders. Which bug do I point them to that manages the actual change of converting from realhostname to hostname (without backing up the aliases) ?
Comment 21•2 years ago
|
||
Filters were migrated in bug 1769732.
Description
•