nextcloud / nextcloud/nextcloudpi

ncp-backup: exclude pattern not working

Open
#1,893 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has-updates
Dominant language
Shell
Stars
2.9k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

The script still fails when nextcloud.log has been modified during backup.

Line https://github.com/nextcloud/nextcloudpi/blob/f0fc7e074e8147a6f6b6b036159195ad6c0a360c/bin/ncp-backup#L80 contains nextcloud/data/ folder instead of $data only. This also applies to the preceeding and following line.
These lines should be replaced by
--exclude "$data/access.log"
--exclude "$data/error.log"
--exclude "$data/nextcloud.log"
or (without double quotes, equal character and no spaces in between)
—exclude=$data/{access,error,nextcloud}.log

Repro:

mkdir -p /tmp/tar_backup/data
touch /tmp/tar_backup/data/{access,error,nextcloud}.log
touch /tmp/tar_backup/data/{text1,text2}.txt
data="data"
tar cvzf /tmp/tar_backup.tgz --exclude "$data/{access,error,nextcloud}.log" -C /tmp/tar_backup data

data/
data/error.log
data/access.log
data/nextcloud.log
data/text1.txt
data/text2.txt

tar cvzf /tmp/tar_backup.tgz --exclude $data/{access,error,nextcloud}.log -C /tmp/tar_backup data

tar: data/error.log: Cannot stat: No such file or directory
tar: data/nextcloud.log: Cannot stat: No such file or directory
data/
data/error.log
data/nextcloud.log
data/text1.txt
data/text2.txt
tar: Exiting with failure status due to previous errors

tar cvzf /tmp/tar_backup.tgz --exclude=$data/{access,error,nextcloud}.log -C /tmp/tar_backup data

data/
data/text1.txt
data/text2.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in bin/ncp-backup at the referenced exclude lines, then run the issue's tar reproduction with a temporary data directory. Done means the backup excludes access.log, error.log, and nextcloud.log while retaining the other files and exits successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.