Skip to content

Attic stores hard link to inaccessible file #393

@cestrauss

Description

@cestrauss

When there is a inaccessible file (ex. "chmod 0 file"), attic does not stores the file. However, if there is a hard link to this file, it is stored as a hard link to an unexisting file. Example:

$ mkdir work
$ echo hello > work/forbidden.txt
$ chmod 0 work/forbidden.txt 
$ ln work/forbidden.txt work/link.txt
$ attic init repo
Initializing repository at "repo"
Encryption NOT enabled.
Use the "--encryption=passphrase|keyfile" to enable encryption.
Initializing cache...
$ attic create repo::1 work
attic: work/forbidden.txt: [Errno 13] Permission denied: 'work/forbidden.txt'
attic: Exiting with failure status due to previous errors
$ attic list repo::1
drwxr-xr-x cstrauss cstrauss        0 Jan 21 16:06 work
h--------- cstrauss cstrauss        0 Jan 21 16:06 work/link.txt link to work/forbidden.txt
$ mkdir mnt
$ attic mount repo::1 mnt
Traceback (most recent call last):
  File "/usr/bin/attic", line 3, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/attic/archiver.py", line 730, in main
    exit_code = archiver.run(sys.argv[1:])
  File "/usr/lib/python3.6/site-packages/attic/archiver.py", line 720, in run
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/attic/archiver.py", line 262, in do_mount
    operations = AtticOperations(key, repository, manifest, archive)
  File "/usr/lib/python3.6/site-packages/attic/fuse.py", line 48, in __init__
    self.process_archive(archive)
  File "/usr/lib/python3.6/site-packages/attic/fuse.py", line 82, in process_archive
    inode = self._find_inode(item[b'source'], prefix)
  File "/usr/lib/python3.6/site-packages/attic/fuse.py", line 127, in _find_inode
    inode = self.contents[inode][segment]
KeyError: b'forbidden.txt'

$ mkdir extract
$ cd extract/
$ attic extract ../repo::1
attic: work/link.txt: [Errno 2] No such file or directory: '/tmp/attic2/extract/work/forbidden.txt' -> '/tmp/attic2/extract/work/link.txt'
attic: Exiting with failure status due to previous errors

I'm using Attic 0.16.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions