An issue I had recently was that gnome-keyring-daemon changed my login keyring's password when I unlocked it via the terminal with the --unlock command. It didn't changed my user's password, it change the keyring's password that was supposed to match my user's password so it unlocks automatically when I login, which means I can't unlock it anymore because I have no idea what it changed the password to, so I can't use the passwords that are locked inside the keyring. They're lost permanently. Forever.
Fortunately, this wasn't much of an issue to me, because I keep all my passwords saved in a my-passwords.txt file in plain text, unencrypted, on my desktop and three other places, because I can't trust computers FOR A GOOD REASON.
Actually it's because I use Google Chrome and my passwords are synced to my Google account, but I have to keep my recovery codes for that account in a plain text file, so it's practically the same thing.
Why using the password changes the password? What kind of program in this? That almost wants to take a look at the source code, but I'd rather not.
Newline Issues
For the record, the first time this happened, it was because I used echo $password | gnome-keyring-daemon --unlock instead of printf, and echo prints a newline character (\n) by default, which means, somehow, the daemon read the password, it saw the password matched the keyring's password, and then it changed the password to have a newline so it wouldn't match the password of the keyring anymore. If this sentence doesn't make any sense for you, it's because it makes absolutely no sense whatsoever.
Did it remove the newline before checking? If the passwords matched, why did it need to save the password? Why is it not saving the inputted password that matches the stored password? Why does it allow newline characters in the password in the first place when the dialog box that asks for passwords doesn't let you press enter to insert a newline?
Fortunately, that wasn't much of an issue to me, because I was able to type a newline into the dialog box that asked for a password, by typing my password and pressing enter in a text editor (xed, specifically), copying the text containing the newline, and pasting it into the dialog box. That somehow pastes the newline into the single-line field. And it worked.
But the second time it happened it didn't work and I was locked out, so I had to delete the keyring and start over.
By the way, the reason I was doing this is because I wanted to see if I could run a web browser as a different user.
External Knowledge
It seems there are quite a few bugs related to this odd behavior, although they're mostly related to LUKS (Linux Unified Key Setup).
I did a few experiments with it now unlocked and I figured out how I got locked out. If you type an incorrect encryption password the first time (despite entering it X times after for each of the X encrypted volumes), it will fail to unlock the keyring when auto-logged in. It then prompts you for your password which you enter to unlock it and then it immediately changes the password to the incorrect password. Next boot it now has the incorrect password so it doesn't unlock automatically and prompts you for it, except this time you don't know what to type it.
https://bugzilla.redhat.com/show_bug.cgi?id=1406509, "2016-12-20 21:36:35 UTC" (accessed 2024-10-20)
I've been hunting down why my keyring is behaving in unexpected ways for a long time, and this is the only thing that clued me into my keyring password somehow being changed to my LUKS password. Never did I receive a notification of this happening, or that my passwords diverged (perhaps due to using sway?). All I got was the keyring not responding to a blank or my login password, for no clear reason.
It was clear nowhere that this was the default behavior, and so it never had occurred to me to check that.
DO NOT silently change the keyring password. Offer a prompt to change it for LUKS, but never silently change secrets like that. It can wreak havoc.
Fingerprint-Login after Reboot in Combination with LUKS Makes gnome-keyring Change Login Keyring Password to Disk Encryption Passphrase, https://gitlab.gnome.org/GNOME/gnome-keyring/-/issues/117#note_1962691, "January 7, 2024" (accessed 2024-10-20)