Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

password from password-file not working if it has spaces at the end #1099

Closed
Schweber opened this issue Mar 11, 2024 · 3 comments
Closed

password from password-file not working if it has spaces at the end #1099

Schweber opened this issue Mar 11, 2024 · 3 comments
Labels
C-question Category: Further information is requested

Comments

@Schweber
Copy link

Schweber commented Mar 11, 2024

I tried

[repository]
password-file = "/path/to/file.txt"

The file just contains "password " (2 spaces after password) but rustic tells me that the password is not correct. If i use

[repository]
password = "password  "

it works fine (also 2 spaces after password). It appears to me that the spaces at the end are not properly recognized.

Can you reproduce this?

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Mar 11, 2024
@aawsome
Copy link
Member

aawsome commented Mar 11, 2024

@Schweber Thanks for opening the issue! Unfortunately I cannot reproduce the issue. If put "test " (without ", of course) in the password file it works exactly like putting it in the config profile or using --password "test ".

The logic of reading the password from the file is very simple:

  • read the whole file
  • if it ends with "\r\n" (windows newline), remove that newline and use the remaining as password.
  • if it ends with "\n" (unix newline), remove that newline and use the remaining as password.
  • else use the complete content as password

What does your password file exactly contain? "password " (including the ")? In this case, you have to remove the ".
Or could it be that your file.txt contains a newline followed by the spaces?

@aawsome aawsome added C-question Category: Further information is requested and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Mar 11, 2024
@Schweber
Copy link
Author

The file just contained one line with the password (without ", that was misleading in my post). gpg was content to use it as a passphrase-file but rustic wasn't for some reason.

After reading your post i added an empty newline and it worked from then on. I then removed the empty newline again and it still works with rustic, so i'm a bit confused.

Anyway, thank you for looking into it!

@aawsome
Copy link
Member

aawsome commented Mar 12, 2024

Mhh - could be that there was some unprintable character at the end which you removed by inserting and removing the newline...
Anyway, as it seems there is nothing to reproduce, so I'm closing this issue.
Feel free to open again if you discover something new!

@aawsome aawsome closed this as completed Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants