Menu

#1301 PWsafe changes to directory of database, which remains open, even after db file closed (Linux)

v1.0_(example)
open
nobody
1
2016-07-06
2015-10-29
No

If you start pwsafe, open a password database file on removable media, and then close the database, pwsafe working directory remains unchanged.

However, under some conditions, when a database is opened, then automatically locked after a timeout, and then closed, pwsafe changes it's working directory to the directory of the database. So, even though the file is closed, the removable media cannot be removed (safely).

This doesn't always happen, but I think it depends on some other factors, like if the database is updated. I'm still trying to determine the exact prescription.

Instead of trying to find this bug, however, I suggest an enhancement in which the backup directory, if set, becomes the CWD for pwsafe and, instead of opening any database files from their original location, all database files are coppied to the backup directory first, then opened. Of course, you would have to record the original file's location, check it whenever the file is closed, and implement an error if the direcotry isn't writable. Let me know if you like this idea and I would be willing to write this; I just need to know about any coding conventions you would like followed that might not be obvious. I have effectively implemented this in a wrapper script, but it would be much nicer if it was native and, I think, pretty useful.

Discussion

  • Rony Shapiro

    Rony Shapiro - 2015-10-30

    Sounds interesting. Points for thought:
    1. If the application crashes with the database open, then the "latest" database would be in the backup, which isn't exactly intuitive.
    2. Some users might have the backup directory on removable media, e.g., a subdirectory on the same drive as the "working" database. In this case the problem isn't solved.
    3. PasswordSafe can also be run entirely from removable media, that is, with the executable on removable media. In this case, the media cannot be removed as long as the process is running.

    I think that if you're going into the code, as opposed to a wrapper, the right thing would be to ensure that PasswordSafe's CWD reverts to the executable's directory when the database is locked.

    Thanks,

    Rony

     
  • Porcelain Mouse

    Porcelain Mouse - 2015-11-11

    Thank you for the insights. Perhaps overloading the backup directory is not ideal. Another parallel setting for this "db offloading" option, perhaps?

    I think I have a reproducer. If I open the database using File > Open, the CWD is changed to the directory of the database. Closing the database does not change the CWD back, but I wouldn't really expect that, either. So, it happends in the most straight forward use case. And, I suspect the fix can be sought in the opening code so as to address the issue at the source. Unless the CWD is changed in another part of the code, fixing just that should be all that is needed.

     
  • Porcelain Mouse

    Porcelain Mouse - 2016-07-06

    I can confirm this happends on Windows 10, though, also. So, it is not a linux-specific bug. When you open a database on external media, then close it, PWsafe keeps the directory of the closed database open and the media cannot be safely removed. This is a problem on both platforms, but at least on Linux, some people know that mounting is an independent action. On Windows, few eject media properly before removal.

     

Log in to post a comment.