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

Bug: Opening logfile fails with sshfs mounted filesystem #901

Closed
Tracked by #721
tuupola opened this issue Dec 12, 2021 · 3 comments
Closed
Tracked by #721

Bug: Opening logfile fails with sshfs mounted filesystem #901

tuupola opened this issue Dec 12, 2021 · 3 comments

Comments

@tuupola
Copy link
Contributor

tuupola commented Dec 12, 2021

Describe the bug

Opening the logfile fails when archivebox is installed on Vagrant virtual machine and the archivebox folder is mounted with vagrant-sshfs.

$ archivebox add https://example.com
[i] [2021-12-12 21:51:05] ArchiveBox v0.6.2: archivebox add https://example.com
    > /vagrant/archivebox

Traceback (most recent call last):
  File "/home/vagrant/.local/bin/archivebox", line 8, in <module>
    sys.exit(main())
  File "/home/vagrant/.local/lib/python3.10/site-packages/archivebox/cli/__init__.py", line 140, in main
    run_subcommand(
  File "/home/vagrant/.local/lib/python3.10/site-packages/archivebox/cli/__init__.py", line 74, in run_subcommand
    setup_django(in_memory_db=subcommand in fake_db, check_db=cmd_requires_db and not init_pending)
  File "/home/vagrant/.local/lib/python3.10/site-packages/archivebox/config.py", line 1142, in setup_django
    with open(settings.ERROR_LOG, "a+", encoding='utf-8') as f:
PermissionError: [Errno 1] Operation not permitted: '/vagrant/archivebox/logs/errors.log'

This is most likely related to fuse and sshfs not being able to open the logfile a+ file mode.

https://github.com/ArchiveBox/ArchiveBox/blob/dev/archivebox/config.py#L1160

Unless there is a reason the logfile must be opened in read and write mode, the easy fix to open it on a ie. write mode only.

with open(settings.ERROR_LOG, "a", encoding='utf-8') as f:

ArchiveBox version

$ archivebox --version
ArchiveBox v0.6.2
Cpython Linux Linux-5.15.6-200.fc35.x86_64-x86_64-with-glibc2.34 x86_64
IN_DOCKER=False DEBUG=False IS_TTY=True TZ=UTC SEARCH_BACKEND_ENGINE=ripgrep

[i] Dependency versions:
 √  ARCHIVEBOX_BINARY     v0.6.2          valid     /home/vagrant/.local/bin/archivebox                                         
 √  PYTHON_BINARY         v3.10.0         valid     /usr/bin/python3.10                                                         
 √  DJANGO_BINARY         v3.1.14         valid     /home/vagrant/.local/lib/python3.10/site-packages/django/bin/django-admin.py
 √  CURL_BINARY           v7.79.1         valid     /usr/bin/curl                                                               
 √  WGET_BINARY           v1.21.2         valid     /usr/bin/wget                                                               
 X  NODE_BINARY           ?               invalid   node                                                                        
 X  SINGLEFILE_BINARY     ?               invalid   single-file                                                                 
 X  READABILITY_BINARY    ?               invalid   readability-extractor                                                       
 X  MERCURY_BINARY        ?               invalid   mercury-parser                                                              
 √  GIT_BINARY            v2.33.1         valid     /usr/bin/git                                                                
 √  YOUTUBEDL_BINARY      v2021.06.06     valid     /home/vagrant/.local/bin/youtube-dl                                         
 √  CHROME_BINARY         v94.0.4606.81   valid     /usr/bin/chromium-browser                                                   
 X  RIPGREP_BINARY        ?               invalid   rg                                                                          

[i] Source-code locations:
 √  PACKAGE_DIR           23 files        valid     /home/vagrant/.local/lib/python3.10/site-packages/archivebox                
 √  TEMPLATES_DIR         3 files         valid     /home/vagrant/.local/lib/python3.10/site-packages/archivebox/templates      
 -  CUSTOM_TEMPLATES_DIR  -               disabled                                                                              

[i] Secrets locations:
 -  CHROME_USER_DATA_DIR  -               disabled                                                                              
 -  COOKIES_FILE          -               disabled                                                                              

[i] Data locations:
 √  OUTPUT_DIR            5 files         valid     /vagrant/archivebox                                                         
 √  SOURCES_DIR           3 files         valid     ./sources                                                                   
 √  LOGS_DIR              1 files         valid     ./logs                                                                      
 √  ARCHIVE_DIR           2 files         valid     ./archive                                                                   
 √  CONFIG_FILE           81.0 Bytes      valid     ./ArchiveBox.conf                                                           
 √  SQL_INDEX             216.0 KB        valid     ./index.sqlite3                                                             

[!] Warning: Missing 5 recommended dependencies
    ! NODE_BINARY: node (unable to detect version)
    ! SINGLEFILE_BINARY: single-file (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_SINGLEFILE=False
            
    ! READABILITY_BINARY: readability-extractor (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_READABILITY=False
            
    ! MERCURY_BINARY: mercury-parser (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_MERCURY=False
            
    ! RIPGREP_BINARY: rg (unable to detect version)
@tuupola tuupola changed the title Bug: ... Bug: Opening logfile fails with sshf mounted filesystem Dec 12, 2021
@tuupola tuupola changed the title Bug: Opening logfile fails with sshf mounted filesystem Bug: Opening logfile fails with sshfs mounted filesystem Dec 12, 2021
@pirate
Copy link
Member

pirate commented Dec 15, 2021

Do you want to open a PR with the fix so you get contributor credit for it? 😉

@tuupola
Copy link
Contributor Author

tuupola commented Dec 15, 2021

Yep, I can do it.

@tuupola
Copy link
Contributor Author

tuupola commented Dec 21, 2021

Fixed by #906.

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

2 participants