diff --git a/xorriso/iso_manip.c b/xorriso/iso_manip.c index 4b0eb02f..deb3d859 100644 --- a/xorriso/iso_manip.c +++ b/xorriso/iso_manip.c @@ -1,7 +1,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2019 Thomas Schmitt, + Copyright 2007-2022 Thomas Schmitt, Provided under GPL version 2 or later. @@ -1225,6 +1225,27 @@ ex:; } +int Xorriso_lseek_capacity(struct XorrisO *xorriso, char *path, + off_t *capacity, int flag) +{ + int fd; + + fd= open(path, O_RDONLY); + if(fd < 0) { + sprintf(xorriso->info_text, + "Determination of random-access readable capacity failed: "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + return -1; + } + *capacity= lseek(fd, 0, SEEK_END); + close(fd); + if(*capacity < 0) + return(-1); + return(1); +} + + /* @param flag bit0= -follow: disk_path is not a command parameter */ int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, @@ -1232,13 +1253,14 @@ int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, { int ret; char *eff_source= NULL, *eff_dest= NULL; + off_t src_size; struct stat stbuf; Xorriso_alloc_meM(eff_source, char, SfileadrL); Xorriso_alloc_meM(eff_dest, char, SfileadrL); ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_source, - 2|4); + 2 | 4); if(ret<=0) goto ex; ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&1)); @@ -1265,22 +1287,44 @@ int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, {ret= 0; goto ex;} } } + if(S_ISREG(stbuf.st_mode)) { - if(stbuf.st_sizeinfo_text, - "-cut_out: Byte offset %.f larger than file size %.f", - (double) startbyte, (double) stbuf.st_size); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0); - {ret= 0; goto ex;} + src_size= stbuf.st_size; + } else if(!(S_ISDIR(stbuf.st_mode) || S_ISLNK(stbuf.st_mode) || + S_ISFIFO(stbuf.st_mode) || S_ISSOCK(stbuf.st_mode))) { + ret= Xorriso_lseek_capacity(xorriso, eff_source, &src_size, 0); + if(ret <= 0) + goto unsupported_type; + if(src_size <= 0) { + Xorriso_msgs_submit(xorriso, 0, + "-cut_out: Special file with addressable size range of 0 encountered", + 0, "FAILURE", 0); + goto unsupported_type; } } else { unsupported_type:; Xorriso_msgs_submit(xorriso, 0, eff_source, 0, "ERRFILE", 0); - sprintf(xorriso->info_text, "-cut_out: Unsupported file type (%s) with ", - Ftypetxt(stbuf.st_mode, 0)); + if(S_ISDIR(stbuf.st_mode) || S_ISLNK(stbuf.st_mode) || + S_ISFIFO(stbuf.st_mode) || S_ISSOCK(stbuf.st_mode)) { + sprintf(xorriso->info_text, + "-cut_out: File type (%s) is not suitable for this command: ", + Ftypetxt(stbuf.st_mode, 0)); + } else { + sprintf(xorriso->info_text, + "-cut_out: File (%s) does not support random read access: ", + Ftypetxt(stbuf.st_mode, 0)); + } Text_shellsafe(eff_source, xorriso->info_text, 1); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(src_size < startbyte) { + Xorriso_msgs_submit(xorriso, 0, eff_source, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "-cut_out: Byte offset %.f larger than addressable file size %.f : ", + (double) startbyte, (double) src_size); + Text_shellsafe(eff_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); {ret= 0; goto ex;} } diff --git a/xorriso/iso_tree.c b/xorriso/iso_tree.c index 51cbda1f..45fb61d6 100644 --- a/xorriso/iso_tree.c +++ b/xorriso/iso_tree.c @@ -47,7 +47,7 @@ bit3= return root directory as "/" and not as "" bit4= (with bit2) determine type of disk file eff_path and return 0 if not existing - bit5= (with bit3) this is not a parameter + bit5= (with bit4) this is not a parameter bit6= insist in having an ISO image, even with bits1+2 @return -1 = faulty path format, 0 = not found , 1 = found simple node , 2 = found directory diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 33f7d457..05bbd48b 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -9,7 +9,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Version 1.5.5, Sep 13, 2021" +.TH XORRISO 1 "Version 1.5.5, Apr 26, 2022" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1393,14 +1393,16 @@ iso_rr_paths are derived by exchanging disk_prefix by iso_rr_prefix before pattern expansion happens. The current \-cdi directory has no influence. .TP \fB\-cut_out\fR disk_path byte_offset byte_count iso_rr_path -Map a byte interval of a regular disk file into a regular file in the ISO -image. -This may be necessary if the disk file is larger than a single medium, or if -it exceeds the traditional limit of 2 GiB \- 1 for old operating systems, -or the limit of 4 GiB \- 1 for newer ones. Only the newest Linux kernels -seem to read properly files >= 4 GiB \- 1. +Map a byte interval of a regular disk file or of a device file into a regular +file in the ISO image. The file depicted by disk_path has to support random +read access. .br -A clumsy remedy for this limit is to backup file pieces and to concatenate +Cutting out a byte interval may be necessary if the disk file is larger than +a single medium, or if it exceeds the traditional limit of 2 GiB \- 1 for old +operating systems, or the limit of 4 GiB \- 1 for newer ones. Contemporary +Linux kernels are able to read properly files >= 4 GiB \- 1. +.br +A clumsy remedy for such limits is to backup file pieces and to concatenate them at restore time. A well tested chopping size is 2047m. It is permissible to request a higher byte_count than available. The resulting file will be truncated to the correct size of a final piece. @@ -1425,7 +1427,14 @@ reside in the same ISO directory with no other files, and if the names look like above, then their ISO directory will be recognized and handled like a regular file. This affects commands \-compare*, \-update*, and overwrite situations. +.br See command \-split_size for details. +.br +Another use case is copying the content of a device file as interval or as +a whole into the emerging ISO filesystem. The fact that the byte_count is +allowed to be unreasonably high enables copying of a whole device: +.br + \-cut_out /dev/sdd3 0 1000g /content_of_sdd3 .TP \fB\-cpr\fR disk_path [***] iso_rr_path Insert the given files or directory trees from filesystem @@ -2908,7 +2917,7 @@ Both words then stem from a reserved subset of UCS\-2. .br "rec_mtime" records with non\-RockRidge directory entries the disk file's mtime and not the creation time of the image. This applies to the ECMA\-119 -tree (plain ISO 9660), to Joliet, and to ISO 9660:1999. "rec_time" is +tree (plain ISO 9660), to Joliet, and to ISO 9660:1999. "rec_mtime" is default. If disabled, it gets automatically re\-enabled by \-as mkisofs emulation when a pathspec is encountered. .br @@ -6551,7 +6560,7 @@ Thomas Schmitt .br for libburnia\-project.org .SH COPYRIGHT -Copyright (c) 2007 \- 2021 Thomas Schmitt +Copyright (c) 2007 \- 2022 Thomas Schmitt .br Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of \fBxorriso\fR. diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index 1551a4fe..7b99ec73 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -4,7 +4,7 @@ xorriso.texi. xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. - Copyright (C) 2007 - 2021 Thomas Schmitt + Copyright (C) 2007 - 2022 Thomas Schmitt Permission is granted to distribute this text freely. INFO-DIR-SECTION Archiving @@ -1246,13 +1246,15 @@ filesystem. disk_prefix by iso_rr_prefix before pattern expansion happens. The current -cdi directory has no influence. -cut_out disk_path byte_offset byte_count iso_rr_path - Map a byte interval of a regular disk file into a regular file in - the ISO image. This may be necessary if the disk file is larger - than a single medium, or if it exceeds the traditional limit of 2 - GiB - 1 for old operating systems, or the limit of 4 GiB - 1 for - newer ones. Only the newest Linux kernels seem to read properly - files >= 4 GiB - 1. - A clumsy remedy for this limit is to backup file pieces and to + Map a byte interval of a regular disk file or of a device file into + a regular file in the ISO image. The file depicted by disk_path + has to support random read access. + Cutting out a byte interval may be necessary if the disk file is + larger than a single medium, or if it exceeds the traditional limit + of 2 GiB - 1 for old operating systems, or the limit of 4 GiB - 1 + for newer ones. Contemporary Linux kernels are able to read + properly files >= 4 GiB - 1. + A clumsy remedy for such limits is to backup file pieces and to concatenate them at restore time. A well tested chopping size is 2047m. It is permissible to request a higher byte_count than available. The resulting file will be truncated to the correct @@ -1268,8 +1270,13 @@ filesystem. of a file reside in the same ISO directory with no other files, and if the names look like above, then their ISO directory will be recognized and handled like a regular file. This affects commands - -compare*, -update*, and overwrite situations. See command - -split_size for details. + -compare*, -update*, and overwrite situations. + See command -split_size for details. + Another use case is copying the content of a device file as + interval or as a whole into the emerging ISO filesystem. The fact + that the byte_count is allowed to be unreasonably high enables + copying of a whole device: + -cut_out /dev/sdd3 0 1000g /content_of_sdd3 -cpr disk_path [***] iso_rr_path Insert the given files or directory trees from filesystem into the ISO image. @@ -2485,7 +2492,7 @@ according to the setting of command -acl. "rec_mtime" records with non-RockRidge directory entries the disk file's mtime and not the creation time of the image. This applies to the ECMA-119 tree (plain ISO 9660), to Joliet, and to ISO - 9660:1999. "rec_time" is default. If disabled, it gets + 9660:1999. "rec_mtime" is default. If disabled, it gets automatically re-enabled by -as mkisofs emulation when a pathspec is encountered. "new_rr" uses Rock Ridge version 1.12 (suitable for GNU/Linux but @@ -5548,7 +5555,7 @@ for libburnia-project.org 15.2 Copyright ============== -Copyright (c) 2007 - 2021 Thomas Schmitt +Copyright (c) 2007 - 2022 Thomas Schmitt Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of 'xorriso'. If you make use of the license to derive modified versions of 'xorriso' then @@ -5609,7 +5616,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -chmod_r sets permissions in ISO image: Manip. (line 66) * -chown sets ownership in ISO image: Manip. (line 43) * -chown_r sets ownership in ISO image: Manip. (line 47) -* -clone copies ISO directory tree: Insert. (line 185) +* -clone copies ISO directory tree: Insert. (line 192) * -close controls media closing: SetWrite. (line 484) * -close_damaged closes damaged track and session: Writing. (line 205) * -close_filter_list bans filter registration: Filter. (line 50) @@ -5622,12 +5629,12 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -concat copies ISO file content: Restore. (line 146) * -copyright_file sets copyright file name: SetWrite. (line 245) * -cpax copies files to disk: Restore. (line 128) -* -cpr inserts like with cp -r: Insert. (line 164) +* -cpr inserts like with cp -r: Insert. (line 171) * -cpx copies files to disk: Restore. (line 117) -* -cp_clone copies ISO directory tree: Insert. (line 196) +* -cp_clone copies ISO directory tree: Insert. (line 203) * -cp_rx copies file trees to disk: Restore. (line 131) * -cp_rx copies file trees to disk <1>: Restore. (line 139) -* -cut_out inserts piece of data file: Insert. (line 139) +* -cut_out inserts piece of data file or device: Insert. (line 139) * -data_cache_size adjusts read cache size: Loading. (line 362) * -dev acquires one drive for input and output: AqDrive. (line 12) * -devices gets list of drives: Inquiry. (line 7) @@ -5694,7 +5701,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -list_formats lists available formats: Writing. (line 128) * -list_profiles lists supported media: Writing. (line 163) * -list_speeds lists available write speeds: Writing. (line 139) -* -lns creates ISO symbolic link: Insert. (line 181) +* -lns creates ISO symbolic link: Insert. (line 188) * -load addresses a particular session as input: Loading. (line 54) * -local_charset sets terminal character set: Charset. (line 57) * -logfile logs output channels to file: Frontend. (line 19) @@ -5711,7 +5718,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -map_single inserts path: Insert. (line 93) * -mark sets synchronizing message: Frontend. (line 23) * -md5 controls handling of MD5 sums: Loading. (line 184) -* -mkdir creates ISO directory: Insert. (line 177) +* -mkdir creates ISO directory: Insert. (line 184) * -modesty_on_drive keep drive buffer hungry: SetWrite. (line 419) * -mount issues mount command for ISO session: Restore. (line 202) * -mount_cmd composes mount command line: Inquiry. (line 49) @@ -5876,9 +5883,9 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Dialog, EOF resistant, -named_pipe_loop: Frontend. (line 119) * Dialog, line editing, -use_readline: DialogCtl. (line 26) * Dialog, terminal geometry, -page: DialogCtl. (line 18) -* Directories, copy, -cp_clone: Insert. (line 196) -* Directory, copy, -clone: Insert. (line 185) -* Directory, create, -mkdir: Insert. (line 177) +* Directories, copy, -cp_clone: Insert. (line 203) +* Directory, copy, -clone: Insert. (line 192) +* Directory, create, -mkdir: Insert. (line 184) * Directory, delete, -rmdir: Manip. (line 29) * disk_path, _definition: Insert. (line 6) * Drive, accessability, -drive_class: AqDrive. (line 43) @@ -5977,9 +5984,9 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Insert, paths from disk file, -map_l: Insert. (line 96) * Insert, paths from disk file, -path_list: Insert. (line 81) * Insert, paths from disk file, -quoted_path_list: Insert. (line 85) -* Insert, paths, -cpr: Insert. (line 164) +* Insert, paths, -cpr: Insert. (line 171) * Insert, pathspecs, -add: Insert. (line 44) -* Insert, piece of data file, -cut_out: Insert. (line 139) +* Insert, piece of data file or device, -cut_out: Insert. (line 139) * Interval reader for system area and partitions: Bootable. (line 32) * ISO 9660, _definition: Model. (line 6) * iso_rr_path, _definition: Insert. (line 7) @@ -6098,7 +6105,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Sorting order, for -x, -list_arg_sorting: ArgSort. (line 26) * SUN Disk Label, production: Bootable. (line 383) * SUN SPARC boot images, activation: Bootable. (line 464) -* Symbolic link, create, -lns: Insert. (line 181) +* Symbolic link, create, -lns: Insert. (line 188) * System area, _definition: Bootable. (line 200) * Table-of-content, search sessions, -rom_toc_scan: Loading. (line 308) * Table-of-content, show, -toc: Inquiry. (line 27) @@ -6160,47 +6167,47 @@ Node: ArgSort27718 Node: AqDrive29212 Node: Loading36369 Node: Insert58208 -Node: SetInsert69711 -Node: Manip79675 -Node: CmdFind89775 -Node: Filter108704 -Node: Writing113326 -Node: SetWrite125581 -Node: Bootable155432 -Node: Jigdo183313 -Node: Charset188316 -Node: Exception191645 -Node: DialogCtl197774 -Node: Inquiry200376 -Node: Navigate209258 -Node: Verify217965 -Node: Restore229114 -Node: Emulation241230 -Node: Scripting251686 -Node: Frontend259469 -Node: Examples269095 -Node: ExDevices270273 -Node: ExCreate270934 -Node: ExDialog272234 -Node: ExGrowing273505 -Node: ExModifying274314 -Node: ExBootable274824 -Node: ExCharset275379 -Node: ExPseudo276275 -Node: ExCdrecord277202 -Node: ExMkisofs277522 -Node: ExGrowisofs279419 -Node: ExException280572 -Node: ExTime281030 -Node: ExIncBackup281488 -Node: ExRestore285514 -Node: ExRecovery286460 -Node: Files287032 -Node: Environ288366 -Node: Seealso289114 -Node: Bugreport289831 -Node: Legal290422 -Node: CommandIdx291434 -Node: ConceptIdx309259 +Node: SetInsert70117 +Node: Manip80081 +Node: CmdFind90181 +Node: Filter109110 +Node: Writing113732 +Node: SetWrite125987 +Node: Bootable155839 +Node: Jigdo183720 +Node: Charset188723 +Node: Exception192052 +Node: DialogCtl198181 +Node: Inquiry200783 +Node: Navigate209665 +Node: Verify218372 +Node: Restore229521 +Node: Emulation241637 +Node: Scripting252093 +Node: Frontend259876 +Node: Examples269502 +Node: ExDevices270680 +Node: ExCreate271341 +Node: ExDialog272641 +Node: ExGrowing273912 +Node: ExModifying274721 +Node: ExBootable275231 +Node: ExCharset275786 +Node: ExPseudo276682 +Node: ExCdrecord277609 +Node: ExMkisofs277929 +Node: ExGrowisofs279826 +Node: ExException280979 +Node: ExTime281437 +Node: ExIncBackup281895 +Node: ExRestore285921 +Node: ExRecovery286867 +Node: Files287439 +Node: Environ288773 +Node: Seealso289521 +Node: Bugreport290238 +Node: Legal290829 +Node: CommandIdx291841 +Node: ConceptIdx309666  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 8b5efb39..cab38c61 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Version 1.5.5, Sep 13, 2021" +@c man .TH XORRISO 1 "Version 1.5.5, Apr 26, 2022" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -69,7 +69,7 @@ xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. -Copyright @copyright{} 2007 - 2021 Thomas Schmitt +Copyright @copyright{} 2007 - 2022 Thomas Schmitt @quotation Permission is granted to distribute this text freely. @@ -1701,16 +1701,18 @@ iso_rr_paths are derived by exchanging disk_prefix by iso_rr_prefix before pattern expansion happens. The current -cdi directory has no influence. @c man .TP @item -cut_out disk_path byte_offset byte_count iso_rr_path -@kindex -cut_out inserts piece of data file -@cindex Insert, piece of data file, -cut_out -Map a byte interval of a regular disk file into a regular file in the ISO -image. -This may be necessary if the disk file is larger than a single medium, or if -it exceeds the traditional limit of 2 GiB - 1 for old operating systems, -or the limit of 4 GiB - 1 for newer ones. Only the newest Linux kernels -seem to read properly files >= 4 GiB - 1. +@kindex -cut_out inserts piece of data file or device +@cindex Insert, piece of data file or device, -cut_out +Map a byte interval of a regular disk file or of a device file into a regular +file in the ISO image. The file depicted by disk_path has to support random +read access. @* -A clumsy remedy for this limit is to backup file pieces and to concatenate +Cutting out a byte interval may be necessary if the disk file is larger than +a single medium, or if it exceeds the traditional limit of 2 GiB - 1 for old +operating systems, or the limit of 4 GiB - 1 for newer ones. Contemporary +Linux kernels are able to read properly files >= 4 GiB - 1. +@* +A clumsy remedy for such limits is to backup file pieces and to concatenate them at restore time. A well tested chopping size is 2047m. It is permissible to request a higher byte_count than available. The resulting file will be truncated to the correct size of a final piece. @@ -1735,7 +1737,14 @@ reside in the same ISO directory with no other files, and if the names look like above, then their ISO directory will be recognized and handled like a regular file. This affects commands -compare*, -update*, and overwrite situations. +@* See command -split_size for details. +@* +Another use case is copying the content of a device file as interval or as +a whole into the emerging ISO filesystem. The fact that the byte_count is +allowed to be unreasonably high enables copying of a whole device: +@* + -cut_out /dev/sdd3 0 1000g /content_of_sdd3 @c man .TP @item -cpr disk_path [***] iso_rr_path @kindex -cpr inserts like with cp -r @@ -3393,7 +3402,7 @@ Both words then stem from a reserved subset of UCS-2. @* "rec_mtime" records with non-RockRidge directory entries the disk file's mtime and not the creation time of the image. This applies to the ECMA-119 -tree (plain ISO 9660), to Joliet, and to ISO 9660:1999. "rec_time" is +tree (plain ISO 9660), to Joliet, and to ISO 9660:1999. "rec_mtime" is default. If disabled, it gets automatically re-enabled by -as mkisofs emulation when a pathspec is encountered. @* @@ -7620,7 +7629,7 @@ Thomas Schmitt for libburnia-project.org @c man .SH COPYRIGHT @section Copyright -Copyright (c) 2007 - 2021 Thomas Schmitt +Copyright (c) 2007 - 2022 Thomas Schmitt @* Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of @command{xorriso}. diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 78988702..3b2aaaa8 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2022.04.22.113324" +#define Xorriso_timestamP "2022.04.26.101633"