nextcloud / nextcloud/nextcloudpi
ncp-backup: exclude pattern not working
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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