Skip to content

Same name for file and folder #159

Closed

Description

@keitalbame

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.

Activity

  1. annejan commented on Feb 4, 2016

    @annejan
    Member

    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.

  2. keitalbame commented on Feb 4, 2016

    @keitalbame
    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.

  3. mexus commented on Feb 4, 2016

    @mexus
    Contributor

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

    % echo a > aaa
    % mkdir aaa
    mkdir: cannot create directory ‘aaa’: File exists
  4. annejan commented on Feb 4, 2016

    @annejan
    Member

    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.

  5. annejan commented on Feb 4, 2016

    @annejan
    Member

    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.

  6. reopened this on Feb 4, 2016
  7. annejan commented on Feb 4, 2016

    @annejan
    Member

    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

  8. self-assigned this
    on Feb 4, 2016
  9. annejan commented on Feb 4, 2016

    @annejan
    Member

    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..

  10. zx2c4 commented on Feb 5, 2016

    @zx2c4

    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.

  11. annejan commented on Feb 5, 2016

    @annejan
    Member

    👍 awesome!!

  12. keitalbame commented on Feb 5, 2016

    @keitalbame
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions