diff --git a/docs/changes.rst b/docs/changes.rst index 113f09097..ebd4e0886 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -136,6 +136,9 @@ Compatibility notes: - Repositories in a repokey mode with a blank passphrase are now treated as unencrypted repositories for security checks (e.g. BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK). +- Running "borg init" via a "borg serve --append-only" server will *not* create + an append-only repository anymore. Use "borg init --append-only" to initialize + an append-only repository. Version 1.1.0b5 (2017-04-30) ---------------------------- diff --git a/docs/usage.rst b/docs/usage.rst index 42bda5535..6ba7682ec 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -677,10 +677,9 @@ in ``.ssh/authorized_keys`` :: command="borg serve --append-only ..." ssh-rsa command="borg serve ..." ssh-rsa -Please note that if you run ``borg init`` via a ``borg serve --append-only`` -server, the repository config will be created with a ``append_only=1`` entry. -This behaviour is subject to change in a later borg version. So, be aware of -it for now, but do not rely on it. +Running ``borg init`` via a ``borg serve --append-only`` server will *not* create +an append-only repository. Running ``borg init --append-only`` creates an append-only +repository regardless of server settings. Example +++++++ diff --git a/src/borg/remote.py b/src/borg/remote.py index b2a9938cb..7a54ea70e 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -180,6 +180,10 @@ class RepositoryServer: # pragma: no cover def __init__(self, restrict_to_paths, append_only): self.repository = None self.restrict_to_paths = restrict_to_paths + # This flag is parsed from the serve command line via Archiver.do_serve, + # i.e. it reflects local system policy and generally ranks higher than + # whatever the client wants, except when initializing a new repository + # (see RepositoryServer.open below). self.append_only = append_only self.client_version = parse_version('1.0.8') # fallback version if client is too old to send version information @@ -345,8 +349,12 @@ class RepositoryServer: # pragma: no cover break else: raise PathNotAllowed(path) + # "borg init" on "borg serve --append-only" (=self.append_only) does not create an append only repo, + # while "borg init --append-only" (=append_only) does, regardless of the --append-only (self.append_only) + # flag for serve. + append_only = (not create and self.append_only) or append_only self.repository = Repository(path, create, lock_wait=lock_wait, lock=lock, - append_only=self.append_only or append_only, + append_only=append_only, exclusive=exclusive) self.repository.__enter__() # clean exit handled by serve() method return self.repository.id