Il giorno ven 25 ott 2024 alle ore 09:42 Paul Eggert
<egg...@cs.ucla.edu> ha scritto:
>
> On 2024-10-24 10:09, Matteo Croce wrote:
>
> > I know that it's possible to pipe the stream with an external process,
> > but there are some use cases where a seekable file descriptor is
> > preferable.
>
> If it's seekable, why not seek before invoking 'tar'? E.g.:
>
> (dd ibs=1024 skip=1 count=0 && tar -tf -) <inputfile
>
> That way you can use 'tar' as-is, without a new option needed.

Right, so you just seek with dd, then pass the open file to tar,
without any pipe.
This works, thanks!

$ (dd status=none bs=4k skip=2 count=0 && strace -e ioctl tar -x
--reflink ) <coreutils_9.1-1_amd64.deb
ioctl(0, TCGETS, 0xfffff998b600)        = -1 ENOTTY (Inappropriate
ioctl for device)
ioctl(3, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=0,
src_offset=4096, src_length=45056, dest_offset=0}) = 0
ioctl(3, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=0,
src_offset=53248, src_length=69632, dest_offset=0}) = 0
ioctl(3, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=0,
src_offset=126976, src_length=65536, dest_offset=0}) = 0
ioctl(3, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=0,
src_offset=196608, src_length=73728, dest_offset=0}) = 0
ioctl(3, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=0,
src_offset=274432, src_length=151552, dest_offset=0}) = 0
...

-- 
Matteo Croce

perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay

Reply via email to