gitfs icon indicating copy to clipboard operation
gitfs copied to clipboard

Default repo_path isn't user writable

Open jbeich opened this issue 9 years ago • 3 comments

FreeBSD uses /var/db instead of /var/lib to hold app-specific state data across reboots. It's still not accessible by a regular user. tempfile respects POSIX TMPDIR, so why gitfs wants to hardcode the path at all?

$ mkdir gitfs
$ gitfs https://github.com/PressLabs/gitfs/ gitfs
Traceback (most recent call last):
  File "/usr/local/bin/gitfs", line 11, in <module>
    load_entry_point('gitfs==0.4.4', 'console_scripts', 'gitfs')()
  File "/usr/local/lib/python2.7/site-packages/gitfs/__init__.py", line 20, in mount
    start_fuse()
  File "/usr/local/lib/python2.7/site-packages/gitfs/mounter.py", line 107, in start_fuse
    args = parse_args(parser)
  File "/usr/local/lib/python2.7/site-packages/gitfs/mounter.py", line 39, in parse_args
    return Args(parser)
  File "/usr/local/lib/python2.7/site-packages/gitfs/utils/args.py", line 62, in __init__
    self.config = self.build_config(parser.parse_args())
  File "/usr/local/lib/python2.7/site-packages/gitfs/utils/args.py", line 71, in build_config
    return self.check_args(self.set_defaults(args))
  File "/usr/local/lib/python2.7/site-packages/gitfs/utils/args.py", line 141, in set_defaults
    value = value(args)
  File "/usr/local/lib/python2.7/site-packages/gitfs/utils/args.py", line 172, in get_repo_path
    return tempfile.mkdtemp(dir="/var/lib/gitfs")
  File "/usr/local/lib/python2.7/tempfile.py", line 339, in mkdtemp
    _os.mkdir(file, 0700)
OSError: [Errno 2] No such file or directory: '/var/lib/gitfs/tmpmbCIQv'

jbeich avatar Oct 27 '16 17:10 jbeich

+1, btw, it is better to use $HOME/.cache/gitfs or $HOME/.local/share than $TMPDIR

ei-grad avatar Nov 15 '16 19:11 ei-grad

Exactly. This is user specific data, so it belongs under $HOME/. If $TMPDIR is that, this should be used.

metux avatar Sep 07 '18 09:09 metux

For test, I installed the gitfs package in userspace (with pip3 install --user gitfs) on my Linux. Still, the ~/.local/bin/gitfs command wants to write the nonexisting /var/lib/gitfs directory. User specific data should go to $HOME/.cache/gitfs if TMPDIR is undefined.

gitqlt avatar Jan 22 '21 19:01 gitqlt