Skip to content

Don't error out if chown fails and avoid manually escaping quotes#38

Merged
BretFisher merged 2 commits intoBretFisher:mainfrom
Guiorgy:continue-on-chown-fail
Mar 31, 2026
Merged

Don't error out if chown fails and avoid manually escaping quotes#38
BretFisher merged 2 commits intoBretFisher:mainfrom
Guiorgy:continue-on-chown-fail

Conversation

@Guiorgy
Copy link
Copy Markdown
Contributor

@Guiorgy Guiorgy commented Oct 3, 2025

chown may fail when the destination file system doesn't support Unix ownership attributes. Since the success of chown isn't critical, if this happens, just print a warning and continue.

Fixes #37

Demo:

  • Before this PR:

    $ sudo vackup export diun_data diun_data.tar.gz
    diun_data
    ./
    ./diun.db
    chown: /mount-volume/diun_data.tar.gz: Operation not permitted
    Error: Failed to start busybox backup container
    $ ls
    diun_data.tar.gz
  • After this PR:

    $ sudo vackup export diun_data diun_data.tar.gz
    diun_data
    ./
    ./diun.db
    chown: /mount-volume/diun_data.tar.gz: Operation not permitted
    Warning: Failed to change ownership of the diun_data.tar.gz file
    Successfully tar'ed volume diun_data into file diun_data.tar.gz
    $ ls
    diun_data.tar.gz

Edit: Added 2nd commit, which passes variables to the Docker container as environmental variables and expands them inside the container. This avoids manually escaping quotes, which may fail if the file name contains a single/double quote character.

chown may fail when the destination file system doesn't support Unix ownership attributes. Since the success of chown isn't critical, if this happens, just print a warning and continue.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates vackup export to treat chown failures as non-fatal so exports succeed on filesystems that don’t support Unix ownership attributes (e.g., exFAT), aligning behavior with issue #37.

Changes:

  • Wrap chown during export so a failure prints a warning and does not fail the overall export.
  • Preserve export success message and exit code even when ownership change can’t be applied.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vackup Outdated
Comment thread vackup Outdated
this avoids any issues with escaping quotes
@Guiorgy
Copy link
Copy Markdown
Contributor Author

Guiorgy commented Mar 30, 2026

Linter failed on Dockerfile, in other words, unrelated to the PR.

@Guiorgy Guiorgy changed the title Don't error out if chown fails Don't error out if chown fails and avoid manually escaping quotes Mar 30, 2026
@BretFisher BretFisher merged commit 6b8a06f into BretFisher:main Mar 31, 2026
1 of 3 checks passed
@BretFisher
Copy link
Copy Markdown
Owner

Thanks, and sorry I sat on this for so long.

@Guiorgy
Copy link
Copy Markdown
Contributor Author

Guiorgy commented Mar 31, 2026

Thanks, and sorry I sat on this for so long.

Nah, no worries at all, I've been using my own modified copy, the whole point of FOSS 😋

@Guiorgy Guiorgy deleted the continue-on-chown-fail branch March 31, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chown: /mount-volume/VOLUME_NAME.tar.gz: Operation not permitted

3 participants