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

Check .backupy path writeable before starting #12

Open
GreenShadowMaker opened this issue Nov 30, 2024 · 0 comments
Open

Check .backupy path writeable before starting #12

GreenShadowMaker opened this issue Nov 30, 2024 · 0 comments

Comments

@GreenShadowMaker
Copy link

I ran backupy on a source/destination combo (that took several hours) as my user account that did not have write permissions.

Please consider adding a writable test to the key paths at the beginning, instead of after checks of all the files are run.

Thanks!

Details:

$ backupy --version
1.10.1
$ backupy -c CRC /store/photos/ /store/backup/photos/                                 
Scanning files on source:                                                                                                                   
/store/photos                                                                                                            
Scanning completed!                                                                                                                         
Scanning files on destination:                                                                                                              
/store/backup/photos                                                                                                        
Scanning completed!                                                                                                                         
Comparing directories...                                                                                                                    
Source Only (will be copied to dest): 0 (0 B)                                                                                               
Destination Only (will be archived): 0 (0 B)                                                                                                
Changed Files (archive dest and copy source -> dest): 0 (0 B)                                                                               
Moved Files (will move files on dest to match source): 0 (0 B)   
Directories already match, completed!
Traceback (most recent call last):
  File "/home/username/.local/bin/backupy", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/__init__.py", line 16, in main
    sys.exit(main())
             ~~~~^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/cli.py", line 142, in main
    return backup_manager.run()
           ~~~~~~~~~~~~~~~~~~^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/backupman.py", line 402, in run
    self.log.writeLog("database.json")
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/logman.py", line 108, in writeLog
    self.source.saveDatabase(db_name)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/filescanner.py", line 90, in saveDatabase
    writeJson(os.path.join(self.dir, self.config_dir, db_name), self.dict_current, sort_keys=True)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/lib/python3.13/site-packages/backupy/utils.py", line 78, in writeJson
    os.makedirs(os.path.dirname(file_path))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 227, in makedirs
PermissionError: [Errno 13] Permission denied: '/store/photos/.backupy'
$         

Note: username/actual paths modified

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

No branches or pull requests

1 participant