[Pkg-libburnia-devel] Bug#1010098: xorriso: please allow -cut-out directly from block devices
Thomas Schmitt
scdbackup at gmx.net
Thu Jun 2 15:35:06 BST 2022
Hi,
Ivan Shmakov wrote:
> An alternative would be to check if it’s possible to seek to
> specified positions rather than to the end of file
This should work now, by an attempt of lseek(wanted_size, SEEK_SET) if
lseek(0, SEEK_END) yields failure or 0 size.
(libisoburn commit 0c0d542, libisofs commit c6cb7df)
Nevertheless, the attempt to read from /dev/zero still yields failure,
because lseek() returns 0 when it is supposed to return the new offset
position.
This is already so in your example with strace and dd:
> lseek(0, 2560, SEEK_CUR) = 0
Actually i think that the behavior of lseek() with /dev/zero is not
conformant with man 2 lseek:
RETURN VALUE
Upon successful completion, lseek() returns the resulting offset loca‐
tion as measured in bytes from the beginning of the file. On error,
the value (off_t) -1 is returned.
The xorriso code does not ask for offset 0. So the lseek() call does not
succeed if the resulting offset is 0. So the return value should be -1.
If non-random-access file content is desired and can be produced with
repeatable size, then consider to define a filter by -external_filter
and attach it to a file by -set_filter. The file may be inserted with an
arbitrary file as source. The filter program is free to ignore it and to
do its own thing.
-------------------------------------------------------------------
> if the target file is created in a yet-nonexistent
> directory, the directory created inherits the permissions
> of the source file as well (only adding +x where there’s r.)
This is an intentional feature introduced in 2008. SVN rev 1643, now git
commit a44e7db9:
Bug fix: Implicite directory attribute copying with -cut_out was wrong
There are reasons why this makes sense if the disk file's permissions
are restrictive and its parent's permissions are liberal.
Embarrassingly, only a week later i introduced automatic file splitting,
controlled by command -split_size, where this peculiar source of directory
permissions would make even more sense.
But function Xorriso_graft_split() inserts a new directory with the
permissions of the parent directory in the ISO.
I have now corrected this to the behavior of -cut_out and documented it
with both commands in the man page:
-cut_out disk_path byte_offset byte_count iso_rr_path
...
E.g.
...
-cut_out /my/disk/file 4094m 2047m \
/file/part_3_of_3_at_4094m_with_2047m_of_5753194821
If the directory /file does no yet exist, then its permissions
are not taken from directory /my/disk but rather from
/my/disk/file with additional x-permission for those who have
r-permission.
...
-split_size number["k"|"m"]
...
The newly created ISO directory inherits its permissions from
the data file with additional x-permission for those who have
r-permission.
(libisoburn commit 5aac3dd)
-------------------------------------------------------------------
Then there was the problem of -paste_in not working with devices which
are suitable for -cut_out (and thus not being the reverse operation of
-cut_out).
I changed -paste_bin so that it is willing to work with the same files
as target which -cut_out would accept as source (modulo permissions, of
course).
(libisoburn commit 865115f)
Have a nice day :)
Thomas
More information about the Pkg-libburnia-devel
mailing list