zfs_autobackup icon indicating copy to clipboard operation
zfs_autobackup copied to clipboard

mbuffer at the wrong place in a send-pipe

Open Grinzold opened this issue 10 months ago • 2 comments

When using the options --buffer <> and --send-pipe "ncat ..." the full zfs-send-pipe is wrong.

It is as follow

zfs send... | ncat <host> <port> | mbuffer... (wrong)

but it should be

zfs send... | mbuffer ... | ncat ....

In the current (wrong) version, mbuffer never gets any data to buffer.

Grinzold avatar Jan 30 '25 12:01 Grinzold

yeah, the buffer was designed to be the last in the pipe, never expecting this usecase. :)

its documented here: https://github.com/psy0rz/zfs_autobackup/wiki/Piping#putting-it-all-together

i have to think about it, it might be more logical to make the custom stuff the last in the pipe.

psy0rz avatar Feb 05 '25 09:02 psy0rz

Yes, when using the (standard) ssh-pipe, all is fine: zfs send | mbuffer | ssh 'mbuffer | zfs recv'...

Best is maybe to completely drop this when --send-pipe is used, as users can then just specify it themselves, like:

... --send-pipe mbuffer --send-pipe '<compress>...' --send-pipe 'ncat <host> <port>'

Same for --recv-pipe, of course.

This also avoids the hardcoded mbuffer setting, like -s or adding -L, when running as root.

Maybe still better would be a new option: --insert-in-send-pipe. Then you can drop mbuffer (and any other external command in the pipe) completely. If people want to use mbuffer with ssh, they do

--insert-in-send-pipe mbuffer

And for mbuffer with ncat` they do

--insert-in-send-pipe mbuffer --send-pipe 'ncat...'

In this case --send-pipe must only be specified once and must contain a 'sending command', which ends the pipe.

Grinzold avatar Feb 05 '25 10:02 Grinzold

You could also solve this by using multiple —send-pipe commands?

And have the first one be mbuffer (and omit —buffer)

psy0rz avatar Oct 29 '25 07:10 psy0rz