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

Same name for file and folder #159

Closed
keitalbame opened this issue Feb 4, 2016 · 10 comments
Closed

Same name for file and folder #159

keitalbame opened this issue Feb 4, 2016 · 10 comments

Comments

@keitalbame
Copy link

Cannot delete a folder or file if they have the same name.
When I try to remove the folder, it prompts to confirm, press "yes" but is not removed. No error message.
When I try to remove the file, after confirmation, it prompts:
rm: cannot remove ‘/home/nuno/.password-store//test’: Is a directory

A folder can be created with same name of an already existing file.

The folder can be removed on cli using rmdir.

@annejan
Copy link
Member

annejan commented Feb 4, 2016

Are you using pass or native git/gpg in QtPass?

I can imagine this being a pass issue rather than a QtPass issue (will have a try) and might escalate to the password-store mailinglist.

AFAICR pass doesn't like to rm them because it takes off the .gpg name from the file.

@keitalbame
Copy link
Author

Just tested after changing to native git/gpg I was able to remove the files and folder.

I noticed that there is a extra / after .password-store.

2016yyy26m02-04-16d19 26 58selection_001

Using pass on the cli gave a similar result, but with only one /

$ pass rm test
Are you sure you would like to delete test? [y/N] y
rm: cannot remove ‘/home/nuno/.password-store/test’: Is a directory

I'm on Arch.

@mexus
Copy link
Contributor

mexus commented Feb 4, 2016

How is it even possible? I'm on ext4:

% echo a > aaa
% mkdir aaa
mkdir: cannot create directory ‘aaa’: File exists

@annejan
Copy link
Member

annejan commented Feb 4, 2016

The way pass and qtpass store the files is with .gpg as a suffix.
On the filesystem you have the folder aaa and the file aaa.gpg that's why in "native" mode where qtpass handles everything you can delete the file and folder separately.

Aparently pass first checks for the file aaa.gpg and then tries to delete the folder aaa instead without the -r appended to the rm causing the error messag described.

I'll do some more testing and take this up with the pass maintainer.

@annejan
Copy link
Member

annejan commented Feb 4, 2016

Let's do this proper . .
pass add test-159
I enter "test"
pass add test-159/test
I enter "test 2"
pass test-159
It returns "test"
pass rm test-159
rm: /Users/annejan/.password-store/test-159: is a directory

I also tested order of creation (first folder or first file) doesn't matter, you can do either.

@annejan annejan closed this as completed Feb 4, 2016
@annejan annejan reopened this Feb 4, 2016
@annejan annejan added bug in pass and removed bug labels Feb 4, 2016
@annejan
Copy link
Member

annejan commented Feb 4, 2016

Adding a / to the request doesn't help to make pass know it's a folder either.

$ pass rm test-159/
Are you sure you would like to delete test-159/? [y/N] y
rm: /Users/annejan/.password-store/test-159: is a directory

The only thing to do in pass is first delete the folder contents, folder gets deleted automagically.
Then delete the file.

$ pass rm test-159/test
Are you sure you would like to delete test-159/test? [y/N] y

$ pass rm test-159/
Error: test-159/ is not in the password store.

$ pass rm test-159
Are you sure you would like to delete test-159? [y/N] y

I think I have now described all the ways in which pass is behaving inconsistently with regard to this bug.
Nice find @keitalbame

On the passwordstore.org mailinglist @dashohoxha replied that you can pass mv to resolve the issue.
He is right, it moves the folder (thought I'd check which gets moved)
QtPass currently doesn't support moving passwords #116

@annejan annejan self-assigned this Feb 4, 2016
@annejan
Copy link
Member

annejan commented Feb 4, 2016

Some more funny pass quirks.
For example pass insert insert
Which can't be read with pass insert shows you the usage information, pass show git does work of-course. Which is the way QtPass uses pass.

Pass will let you create other interesting entries like show add rm git etc..

@zx2c4
Copy link

zx2c4 commented Feb 5, 2016

Fixed upstream here:
http://git.zx2c4.com/password-store/commit/?id=90373f042e8ce679870c1868cb0957fb825d00d5

$ pass insert aaa/bbb
$ pass insert aaa

With the change, this will delete the directory:

$ pass rm -r aaa/

While this will delete the file:

$ pass rm aaa

The difference is the trailing slash.

After I get through the enormous backlog of mailing list inquiries about various things, I'll release a new version that contains this fix. Thanks for bringing it to my attention.

@annejan
Copy link
Member

annejan commented Feb 5, 2016

👍 awesome!!

@annejan annejan closed this as completed Feb 5, 2016
@keitalbame
Copy link
Author

I was just adding and removing files and folders, to see how it works and had this behaviour.

Good to know that I could help and will be fixed on next version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants