Axel Burri
3e9b581a54
btrbk: add --unsafe-filenames option
2021-08-18 02:08:28 +02:00
Axel Burri
1a7bbff767
btrbk: tidy run_cmd calls
2021-08-18 02:08:28 +02:00
Axel Burri
27388c7589
btrbk: treat all filenames as unsafe
2021-08-18 02:08:28 +02:00
Axel Burri
2933e65cbe
btrbk: adapt usage of unsafe arguments for run_cmd
2021-08-18 02:08:28 +02:00
Axel Burri
acc7f9fc83
btrbk: quote unsafe characters in shell commands
...
As filenames can contain meta characters like '$', we can't just put
ssh commands in double quotes. E.g. the following would trigger
variable expansion on local shell:
ssh example.com "ls -l 'evil$x'"
Instead, we quote the ssh using single quotes (adding the need to
escape single quotes), while also quoting unsafe filenames using
single quotes. The above becomes:
ssh example.com 'ls -l '\''evil$x'\'''
Or more complex, for a file named "file with'single quotes'":
ssh example.com 'ls -l '\''file with'\''\'\'''\''single quotes'\''\'\'''\'''\'''
On the remote shell, this will expand to:
ls -l 'file with'\''single quotes'\'''
2021-08-18 02:08:28 +02:00
Axel Burri
d7f6d5fecf
btrbk: accept quoted values in config
2021-08-18 02:08:28 +02:00
Axel Burri
5d94de9142
btrbk: use File::Spec for relative file arguments
2021-08-18 02:08:28 +02:00
Axel Burri
eccb24ecd7
btrbk: fix action "usage"
...
Regression from:
b658fba08c
btrbk: print snapdir and targets for action "usage"
2021-08-18 02:08:28 +02:00
Axel Burri
3cf69f3537
btrbk: add missing table ralign
2021-08-18 02:08:28 +02:00
Axel Burri
2f88d5ab4c
btrbk: check for deleted subvol before panicking
2021-08-18 02:08:28 +02:00
Axel Burri
6e7c8c409b
btrbk: cosmetics: fix trace log
2021-08-18 02:08:28 +02:00
Axel Burri
9278211123
btrbk: fix resolved ambiguity in raw table formats
...
rename snapshot_path -> snapshot_subvolume
rename target_path -> target_subvolume
These point to subvolumes, not paths containing subvolumes.
2021-08-09 19:06:20 +02:00
Axel Burri
2347163780
btrbk: table formats: replace source_path with source_subvolume
2021-08-09 19:06:20 +02:00
Axel Burri
b658fba08c
btrbk: print snapdir and targets for action "usage"
2021-08-09 19:06:20 +02:00
Axel Burri
7603e03aad
btrbk: never match dummy volume section
2021-08-09 19:06:20 +02:00
Axel Burri
e1c5fd0029
btrbk: remove superfluous checks on volume
2021-08-09 19:06:20 +02:00
Axel Burri
47ea1f9481
btrbk: fix action "config print" for dummy volume section
2021-08-09 19:06:20 +02:00
Axel Burri
e257077241
btrbk: allow subvolume context without volume (add dummy section)
...
Unfortunately the framework relies on "url" for the volume. This
should not be printed anywhere, using "/dev/null" should be fine.
2021-08-09 19:06:20 +02:00
Axel Burri
e2de9de440
btrbk: expand subvolume globs independent of volume
2021-08-09 19:06:20 +02:00
Axel Burri
3b4f275126
btrbk: accept absolute path for subvolume
2021-08-09 19:06:20 +02:00
Axel Burri
d40d75ef76
btrbk: accept absolute path for snapshot_dir
2021-08-09 19:06:20 +02:00
Axel Burri
5b2644f12a
btrbk: fix check_file: accept both relative and absolute options
2021-08-09 19:06:20 +02:00
Axel Burri
d3d04f2252
btrbk: remove subvolume_path from schedule table
...
This is the only format where SUBVOL_PATH is displayed. As SUBVOL_PATH
is only available for vinfo_child, this can not be used in global
scope.
2021-08-09 19:06:20 +02:00
Axel Burri
c1610c754d
btrbk: cleanup: add config_subsection
2021-08-09 19:06:20 +02:00
Axel Burri
247cb37acf
btrbk: add comment on vinfo_child specific keys
2021-08-09 19:06:20 +02:00
Axel Burri
2d854c7327
btrbk: add comment on clone source from different mount point
2021-08-09 19:06:20 +02:00
Axel Burri
86e902cebc
btrbk: remove dead code
2021-08-09 19:06:20 +02:00
Axel Burri
ce9c21bd24
btrbk: tidy check for btrbk subvolume
...
The original idea was probably to have a trace log for skipped
subvols.
2021-08-09 19:06:20 +02:00
Axel Burri
f86c563715
btrbk: tidy superfluous subvol_dir argument
2021-08-09 19:06:20 +02:00
Axel Burri
2da30f6b96
btrbk: bump version to 0.32.0-dev
2021-08-09 19:06:20 +02:00
Axel Burri
feba54a68d
change version to 0.31.3; update ChangeLog
2021-08-07 00:13:21 +02:00
ullr23@gmail.com
322ae2c78f
btrbk: add support for zstd adaptive compression
...
Requires zstd version >= 1.3.6
2021-08-06 17:51:20 +02:00
Axel Burri
bf0b5997e8
btrbk: allow relative path arg for actions: archive, extents, diff, origin
2021-08-01 14:11:50 +02:00
Axel Burri
16cec0f6d4
btrbk: tidy map relative subvol argument
2021-07-25 13:32:27 +02:00
Axel Burri
2824668c0e
btrbk: fix path sanitizer
...
Sanitize "/././" -> "/"
2021-07-24 14:40:30 +02:00
Axel Burri
5524d16707
btrbk: add warn_unknown_targets config option
2021-07-15 14:11:03 +02:00
Axel Burri
54bb876b85
btrbk: tidy check_file
2021-07-15 14:11:03 +02:00
Axel Burri
47a3aa5849
btrbk: tidy assemble piped command; remove dead code
2021-07-15 14:11:03 +02:00
Axel Burri
af6d719acc
btrbk: fix: ignore mount points with unsupported filename in action "ls"
...
Mount points with illegal characters would die in vinfo. Print error
and ignore.
2021-07-15 14:11:03 +02:00
Axel Burri
12f6c5b69f
btrbk: tidy mountinfo comments
2021-07-15 14:11:03 +02:00
Axel Burri
6c13a64459
btrbk: fix mountinfo parsing (octal encoded chars)
...
Making sure this is done after splitting, as encoded value could be a
comma.
After some testing it shows that the kernel [1] produces ambigous
output in "super options" if a subvolume containing a comma is mounted
using "-o subvolid=" (tried hard to mount with "-o subvol=", seems not
possible via shell):
# btrfs sub create /tmp/btrbk_unittest/mnt_source/svol\,comma
# mount /dev/loop0 -o subvolid=282 '/tmp/btrbk_unittest/mount,comma'
# cat /proc/self/mountinfo
[...]
48 40 0:319 /svol,comma /tmp/btrbk_unittest/mount,comma rw,relatime - btrfs /dev/loop0 rw,ssd,noacl,space_cache,subvolid=282,subvol=/svol,comma
^^^^^^^^^^^^^^^^^^
[1] sys-kernel/gentoo-sources-5.10.45
2021-07-15 14:11:03 +02:00
Axel Burri
eac9ef9828
btrbk: print non-parseable btrfs mountpoint info only once
2021-07-15 14:11:03 +02:00
Axel Burri
db4f96ba65
btrbk: add function INFO_ONCE
2021-07-15 14:10:59 +02:00
Axel Burri
2c19c501a7
btrbk: add "-1,--single-column" command-line option
2021-07-15 13:50:11 +02:00
Axel Burri
e82836be47
btrbk: add single_column output format
2021-07-15 13:50:11 +02:00
Axel Burri
c06d94543c
btrbk: add "backups" output format
...
Preparatory for single-column patchset.
2021-07-15 13:50:11 +02:00
Axel Burri
d80a8abb8a
btrbk: add "latest" output format
...
Same as "resolved", but hides target if none present.
2021-07-15 13:50:11 +02:00
Axel Burri
d7902fb30c
btrbk: rename action_list table formats
2021-07-15 13:50:11 +02:00
Axel Burri
f197a08650
btrbk: tidy table_formats
2021-07-15 13:50:11 +02:00
Axel Burri
bd68b15ebc
btrbk: tidy print_formatted
2021-07-15 13:50:11 +02:00
Axel Burri
37ef87ddaf
btrbk: add url to fs_list raw format
2021-07-15 13:50:11 +02:00
Axel Burri
cd69d29705
btrbk: tidy variable name
...
Duplicate use (not a bug)
2021-07-15 13:50:04 +02:00
Axel Burri
043e270522
btrbk: change version to 0.31.3-dev
2021-05-27 23:26:38 +02:00
Axel Burri
e8622fc6be
change version to 0.31.2; update ChangeLog
2021-03-21 13:34:26 +01:00
Axel Burri
b8a6aaf799
btrbk: warn if no subvolume is configured
2021-03-18 20:03:03 +01:00
Axel Burri
a8341659be
btrbk: change version to 0.31.2-dev
2021-03-18 19:56:43 +01:00
Axel Burri
8402195487
change version to 0.31.1; update ChangeLog
2021-03-07 17:49:26 +01:00
Axel Burri
db8cc1cd14
btrbk: collapse empty column in total of action "stats"
2021-02-27 13:26:31 +01:00
Axel Burri
713fe50372
btrbk: add empty_cell_char argument to print_formatted
2021-02-27 13:26:03 +01:00
Axel Burri
cee6553a49
btrbk: fix duplicate snapshot location check
...
If snapshot_create=no, no snapshot is created and thus should be
excluded from "duplicate snapshot locations" check.
2021-02-14 15:05:03 +01:00
Axel Burri
8d25852ce2
btrbk: fix action "list all"
2021-02-14 14:23:17 +01:00
Axel Burri
9c2e4e1ee2
btrbk: change version to 0.31.1-dev
2021-01-16 20:40:49 +01:00
Axel Burri
7dc827bdc3
change version to 0.31.0; update ChangeLog
2021-01-10 16:54:53 +01:00
Axel Burri
28e5e08305
bump copyright year
2021-01-10 16:54:50 +01:00
Axel Burri
e0b8c0b34f
btrbk: consistently return array
...
While returning an arrayref might be slightly faster, consistently
return an array in all node lookup functions.
2020-12-30 17:57:39 +01:00
Axel Burri
42dd296ce7
btrbk: make related_nodes and correlated_nodes functions operate on nodes only
2020-12-30 17:57:23 +01:00
Lukas Straub
dd5991099a
btrbk: add suport for zstd long distance matching
2020-12-26 15:46:47 +01:00
Lukas Straub
3562e75a70
btrbk: add support for zstandard (zstd) compression
2020-12-26 15:46:20 +01:00
Axel Burri
6cce65e1eb
btrbk: remove big header in action "diff"
2020-12-21 00:30:06 +01:00
Axel Burri
c7dd838a81
btrbk: simplify action "diff"
2020-12-21 00:20:15 +01:00
Axel Burri
2c4827ca9f
btrbk: support custom table format
2020-12-20 20:12:20 +01:00
Axel Burri
792c3de6c0
btrbk: separate format for "ist snapshots"
...
Make sure target_subvolume is always printed for "resolved" format.
2020-12-20 18:32:47 +01:00
Axel Burri
28d4ec6a0b
btrbk: print latest snapshot after latest correlated
2020-12-20 18:20:43 +01:00
Axel Burri
4fa6dfde25
btrbk: add target_type to "list config" table
2020-12-20 13:45:30 +01:00
Axel Burri
4f8274b28e
btrbk: collapse all target columns for "resolved" format
2020-12-20 13:45:30 +01:00
Axel Burri
1bd902d955
btrbk: collapse host columns for most formats
2020-12-20 13:45:30 +01:00
Axel Burri
bba7c06486
btrbk: refactor action list and stats; add "list all"
2020-12-20 13:30:50 +01:00
Gavin Yancey
31475a303f
btrbk: look in the correct directory for btrbk list snapshots
2020-12-20 13:27:21 +01:00
Axel Burri
6669855936
btrbk: add source and target url to resolved raw format
2020-12-13 17:33:15 +01:00
Axel Burri
3ff42c60d1
btrbk: move snapshot_preserve column towards target_preserve
2020-12-13 17:29:48 +01:00
Axel Burri
4b7f4f6d81
btrbk: always collapse port and rsh columns
2020-12-13 17:29:05 +01:00
Axel Burri
16746caa16
btrbk: fix target_type column for "list backups" action
2020-12-13 15:07:29 +01:00
Axel Burri
557f2f5387
btrbk: add rsh column to list actions with format=long
2020-12-13 14:42:38 +01:00
Axel Burri
bda59056e8
btrbk: more accurate wording on type values for action list
...
Terminology for "backup" is specified in btrbk(1), use it:
Backup is a btrbk terminology for a "read-only subvolume created
with send/receive" (showing a received-uuid).
2020-12-13 14:05:34 +01:00
Axel Burri
33e3dee046
btrbk: fix action origin and ls
...
Regression:
a96c613ab8 btrbk: add subvol_args_init: map subvol_args cmdline arguments into vinfo
2020-12-12 21:43:23 +01:00
Axel Burri
53d5536929
btrbk: fix fs_path
...
Fixes action "origin" and logging.
Regression:
cc3f6c95b9
btrbk: return array in _fs_path
2020-12-12 21:43:23 +01:00
Axel Burri
db7e92b134
btrbk: extents-diff: add extents list command
2020-12-12 21:43:23 +01:00
Axel Burri
b01a97c36f
btrbk: extents-diff: more logging
2020-12-12 21:43:23 +01:00
Axel Burri
f9cc5af7b9
btrbk: extents-diff: add ID to long format
2020-12-12 21:43:23 +01:00
Axel Burri
63def23feb
btrbk: extents-diff: always display set-exclusive size
2020-12-12 21:43:23 +01:00
Axel Burri
e3987866d3
btrbk: extents-diff: fix logging, documentation
2020-12-12 21:43:23 +01:00
Axel Burri
22b71bf7da
btrbk: extents-diff: list all related (not only older)
2020-12-12 21:43:23 +01:00
Axel Burri
208fc36231
btrbk: extents-diff: add (hidden) option: ignore_extent_data_inline
2020-12-12 21:43:23 +01:00
Axel Burri
0719fc415d
btrbk: cleanup aio extentmap
2020-12-12 21:43:23 +01:00
Axel Burri
dc1b7f1b5c
extents map: add alternative implementation using IO::AIO (slightly faster)
2020-12-12 21:43:23 +01:00
Axel Burri
70cdcb01c6
btrbk: cosmetics: fix spelling
2020-12-12 21:43:23 +01:00
Axel Burri
74a84f715b
btrbk: extents-diff: remove blocksize from regions
...
`filefrag -b1` effectively calculates byte regions.
2020-12-12 21:43:23 +01:00
Axel Burri
afd6f80739
btrbk: extents-diff: calculate exclusive size; add "exclusive" option
2020-12-12 21:43:23 +01:00
Axel Burri
ea2ec1ceaa
btrbk: print_formatted: allow custom format
2020-12-12 21:43:23 +01:00
Axel Burri
7facb44833
btrbk: add extentmap_cache (new cache_dir option)
2020-12-12 21:43:23 +01:00
Axel Burri
c6375967b8
btrbk: add action "extents-diff"
2020-12-12 21:43:23 +01:00
Axel Burri
1a96216e7b
btrbk: add subvol_args_init: map subvol_args cmdline arguments into vinfo
...
Preparatory for extents-diff command
2020-12-12 21:43:23 +01:00
Axel Burri
a8e82a6b2c
btrbk: add extentmap framework (filefrag)
...
Preparatory for extents-diff command
2020-12-12 21:43:23 +01:00
Axel Burri
3cbcc74bc3
btrbk: run_cmd: add large_output option (suppress stdout dump of command)
2020-12-12 21:43:23 +01:00
Axel Burri
a99292aba8
btrbk: fix alignment if no header is printed
2020-10-30 19:09:50 +01:00
Axel Burri
528a152d6d
btrbk: action "diff": use print framework; convert units
2020-10-30 19:09:26 +01:00
Axel Burri
4866ec5cb0
btrbk: add print_size, and command line option modifier
2020-10-30 18:35:52 +01:00
Axel Burri
81c92940c1
btrbk: fix unitialized value in warning
...
Regression from: 5c32ced7d6
2020-10-19 00:34:11 +02:00
Axel Burri
eb852271b6
btrbk: change version to 0.30.1-dev
2020-10-19 00:33:20 +02:00
Axel Burri
f40e3adce3
change version to 0.30.0; update ChangeLog
2020-09-23 15:48:44 +02:00
Axel Burri
e605bc7b42
btrbk: add backend_local_user config option
2020-09-23 12:59:50 +02:00
Axel Burri
13708abd00
btrbk: consequently fence all trace logs (for performance)
2020-08-29 13:29:17 +02:00
Axel Burri
5d81632b5d
btrbk: cosmetics on logging
2020-08-29 13:28:32 +02:00
Axel Burri
5c32ced7d6
btrbk: show paths from all mounts in fs_path; add _fs_info node resolver
...
Reference complete mountinfo in nodes, instead of { file, subvolid }.
2020-08-29 13:28:32 +02:00
Axel Burri
cc3f6c95b9
btrbk: return array in _fs_path
2020-08-29 13:28:32 +02:00
Axel Burri
fbfd1edc3d
btrbk: move mount info to front in fs_list table format
2020-08-29 13:28:32 +02:00
Axel Burri
739645444e
btrbk: dont show subvolume_rel_path in fs_list table format
2020-08-29 13:28:32 +02:00
Axel Burri
9415214bc0
btrbk: reword/fix verbose and loglevel options
2020-08-29 13:28:32 +02:00
Axel Burri
910274f814
btrbk: support lsbtr symlink (alias for "btrbk ls")
...
If called via "lsbtr" symlink (program name):
- Provide user-friendly table options
- Assume "./" as path if no path arguments are given
2020-08-29 13:07:57 +02:00
Axel Burri
ec037952cf
btrbk: add "compat" config option (busybox: add test -d command)
...
Add compat, compat_local, compat_remote configuration options.
Used for busybox: instead of running `readlink -e` (which is not
available on busybox), run `readlink -f` followed by `test -d`.
2020-08-28 21:19:21 +02:00
Axel Burri
52a823bb93
btrbk: rename context "root" to "global"
...
Use same naming as in documentation: btrbk.conf.5
2020-08-28 20:49:28 +02:00
Axel Burri
c81e390415
btrbk: cosmetics: capitalize debug logs
2020-08-28 20:48:17 +02:00
Axel Burri
a140cbd898
btrbk: case-insensitive match hostname/ipv6 in filter statement
2020-08-27 10:38:23 +02:00
Axel Burri
61419d420a
btrbk: add support for ipv6 addresses
2020-08-27 10:38:23 +02:00
Axel Burri
12d80ee30b
btrbk: fix check on host
2020-08-20 17:02:45 +02:00
Axel Burri
b80d7e84de
btrbk: cosmetics on logging
2020-08-20 17:02:45 +02:00
Axel Burri
952e41443a
btrbk: always log target before source
...
Consistent for send/receive and send-to-raw.
2020-08-20 17:01:25 +02:00
Axel Burri
c11ab1507d
btrbk: sanitize url on PRINT
...
For consistency with PATH and URL, $vol->{PRINT} was not sanitized
(trailing "//" if parent is "/"). This is now dropped, as this is more
confusing than useful.
2020-05-24 02:48:12 +02:00
Axel Burri
936f88a68f
btrbk: action ls: support url argument; fix duplicates / sorting
2020-05-24 02:48:00 +02:00
Axel Burri
30edf5b766
btrbk: action ls: fix match on child subvols of "/"
...
If PATH contains double slash (intentional behavior of vinfo_child),
the match on root_path fails. Fixed by removing "//" from path.
2020-03-07 01:11:52 +01:00
Axel Burri
cb7d49d075
btrbk: change version to 0.29.2-dev
2020-02-29 17:40:55 +01:00
Axel Burri
e920283434
change version to 0.29.1; update ChangeLog
2020-02-09 16:18:00 +01:00
Axel Burri
0d19b0243e
btrbk: action ls: change default output to format=short
2020-01-02 16:58:07 +01:00
Axel Burri
c5b3ebb808
btrbk: action ls: allow multiple path arguments; soft fail on errors
2020-01-02 16:58:07 +01:00
Axel Burri
631a4c30fe
btrbk: fix @stderr propagation from vinfo_init_root
...
As we print @stderr in warnings if vinfo_init_root() function fails,
we need to make sure that @stderr contains sane values.
Clearing @stderr is required when calling caching functions!
2019-12-15 20:03:37 +01:00
Axel Burri
67d24695f1
btrbk: logging prints "..." on consecutive lines
2019-12-15 20:03:37 +01:00
Axel Burri
1f7773dddc
btrbk: try readlink only once per url
...
Change semantics of %realpath_cache: if "" (empty string), do not try
to run readlink shell command again on same URL.
2019-12-15 19:12:14 +01:00
Axel Burri
8c11c2eb7d
btrbk: run_cmd: fix regression: dont print ssh errors
...
Explicitely printing ssh errors (or even warnings) is
inconsistent. stderr is printed outside the run_cmd framework if
needed.
reverts a80e05984a
btrbk: catch ssh errors
See ssh(1):
ssh exits with the exit status of the remote command or with 255
if an error occurred.
Note that this includes network errors as well as dns failures
2019-12-15 19:12:06 +01:00
Axel Burri
9e13dbd933
btrbk: init sroot as late as possible when expanding wildcards
2019-12-15 19:10:01 +01:00
Axel Burri
37b30caeb2
btrbk: bugfix: vinfo_match: skip match against invalid paths
...
Dont check url_regex if $vinfo->{URL} is not a valid path (e.g. when
checking against a "volume" or "subvolume" having wildcards):
"Use of uninitialized value in join or string" at line 3030
2019-12-14 17:06:15 +01:00
Axel Burri
c36890e1eb
btrbk: change version to 0.29.1-dev
2019-12-14 17:05:54 +01:00
Axel Burri
b64ffbacf5
change version to 0.29.0; update ChangeLog
2019-10-27 14:00:40 +01:00
Axel Burri
8551a9f52a
btrbk: consistently use "subvolume" (instead of "subvol") for table headings
2019-09-08 18:23:30 +02:00
Axel Burri
5e87e8248b
btrbk: add --pretty option: print lowercase column headings with separator line
2019-09-08 18:23:30 +02:00
Axel Burri
4629d5ae11
btrbk: change table output format: remove separator line, uppercase column headings
...
Print table output column headings single-line uppercase instead of
lowercase and underlined.
This is common ascii table format, is easy parseable and offers better
readability e.g. in pager.
2019-09-08 18:23:30 +02:00
Axel Burri
485bc3ab0c
btrbk: use global stderr (replace err); refeactor filter_stderr, add fatal_stderr
...
if fatal_stderr is set and returns true, the command exit code is set
to -1, resulting in run_cmd() returning undef.
2019-09-08 18:23:30 +02:00
Axel Burri
360c8918bb
btrbk: catch verbose errors from readlink
...
readlink -v enables "report error messages", printing useful errors
like:
readlink: /some/dir/: Permission denied
readlink: /some/dir/: No such file or directory
2019-09-08 18:23:30 +02:00
Axel Burri
6e4aeae323
btrbk: cosmetics: enhance trace log
2019-09-08 18:23:30 +02:00
Axel Burri
d0f0c18f64
btrbk: logging functions take array as argument
2019-09-08 18:23:29 +02:00
Axel Burri
fa3334cbb7
btrbk: btrfs_subvolume_list_readonly_flag: dont die on parse errors
2019-09-08 18:23:29 +02:00