From 51154520d8dc9ac931f92457eedca845144618f3 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 27 Aug 2024 18:08:59 +0200 Subject: [PATCH] Enabled for -findx: tests -has_lfa_flags and -has_some_lfa_flags_of, action lsattrd --- xorriso/disk_ops.c | 26 +++++++-- xorriso/iso_manip.c | 21 ++++++-- xorriso/iso_tree.c | 4 +- xorriso/xorriso.1 | 25 +++++++-- xorriso/xorriso.info | 102 ++++++++++++++++++++---------------- xorriso/xorriso.texi | 25 +++++++-- xorriso/xorriso_timestamp.h | 2 +- 7 files changed, 143 insertions(+), 62 deletions(-) diff --git a/xorriso/disk_ops.c b/xorriso/disk_ops.c index 74610144..220a1164 100644 --- a/xorriso/disk_ops.c +++ b/xorriso/disk_ops.c @@ -1155,14 +1155,14 @@ ex:; int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, char *abs_path, char *show_path, int depth, int flag) { - int ret= 0, type, action= 0, dpl= 0, compare_result, uret; + int ret= 0, type, action= 0, dpl= 0, compare_result, uret, max_bit; uid_t user= 0; gid_t group= 0; time_t date= 0; mode_t mode_or= 0, mode_and= ~1; - uint64_t chattr_flags; + uint64_t chattr_flags, lfa_flags; char *target, *text_2, *wdi_mem= NULL, *disk_prefix, *iso_path= NULL; - char *basename; + char *basename, *lfa_text= NULL; struct FindjoB *subjob; struct stat stbuf; @@ -1262,6 +1262,26 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, stbuf.st_size, 0); } else if(action == 44) { /* list_extattr */ ret= Xorriso_list_extattr(xorriso, NULL, abs_path, show_path, target, 2); + + } else if(action == 60) { /* lsattrd */ + ret= Xorriso_get_lfa_flags(xorriso, NULL, show_path, &lfa_flags, &max_bit, + 2); + if(ret >= 0) { + lfa_text= NULL; + ret= Xorriso_encode_lfa_flags(xorriso, lfa_flags, &lfa_text, 1); + if(ret > 0) { + sprintf(xorriso->result_line, "%-22s ", lfa_text); + Xorriso_esc_filepath(xorriso, show_path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + if(lfa_text != NULL) + free(lfa_text); + ret= 1; + } else if(ret == 0) { + ret= 1; + } + } else { Xorriso_esc_filepath(xorriso,show_path, xorriso->result_line, 0); strcat(xorriso->result_line, "\n"); diff --git a/xorriso/iso_manip.c b/xorriso/iso_manip.c index 70507cec..30589007 100644 --- a/xorriso/iso_manip.c +++ b/xorriso/iso_manip.c @@ -100,7 +100,9 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf, } if(xorriso->do_aaip & 2048) { ret= iso_local_get_lfa_flags(disk_path, &lfa_flags, &max_bit, &os_errno, - (flag & 32)); + (flag & 32) | ((!!(xorriso->do_aaip & (1 << 15))) << 7)); + if((xorriso->do_aaip & (1 << 15)) && ret >= 0 && lfa_flags == 0) + ret= 4; if(ret < 0) { Xorriso_process_msg_queues(xorriso, 0); Xorriso_report_iso_error(xorriso, disk_path, ret, @@ -3104,7 +3106,7 @@ return: 3 = immediate decision : does match */ { - int value=0, ret, bless_idx, size_mode, lba_count, i, mask, max_bit; + int value=0, ret, bless_idx, size_mode, lba_count, i, mask, max_bit, hflag; off_t range_lba, end_lba, *file_end_lbas= NULL, *file_start_lbas= NULL; off_t start_lba; uint64_t lfa_flags, node_flags; @@ -3127,8 +3129,8 @@ return: if(node == NULL) { switch(ftest->test_type) { case 0: case 1: case 2: case 4: case 11: case 12: case 13: - case 22: case 23: case 25: case 26: - /* Tests which need no node parameter */ + case 22: case 23: case 25: case 26: case 28: case 29: + /* Tests which need no node parameter or can work without it */ break; default: value= 0; @@ -3393,7 +3395,16 @@ return: break; case 28: /* -has_lfa_flags uint64_t lfa_flags */ case 29: /* -has_some_lfa_flags_of uint64_t *arg */ lfa_flags= *((uint64_t *) ftest->arg1); - ret= Xorriso_get_lfa_flags(xorriso, node, path, &node_flags, &max_bit, 0); + if(node == NULL) { + hflag= 2; + if((xorriso->do_aaip & ((1 << 11) | (1 << 15))) == + ((1 << 11) | (1 << 15))) + hflag|= (1 << 7); + ret= Xorriso_get_lfa_flags(xorriso, NULL, path, &node_flags, &max_bit, + hflag); + } else { + ret= Xorriso_get_lfa_flags(xorriso, node, path, &node_flags, &max_bit, 0); + } if(ret <= 0) { if(ret < 0) Xorriso_process_msg_queues(xorriso, 0); diff --git a/xorriso/iso_tree.c b/xorriso/iso_tree.c index 85e00e9b..d058c22c 100644 --- a/xorriso/iso_tree.c +++ b/xorriso/iso_tree.c @@ -2919,6 +2919,7 @@ int Xorriso_warn_if_not_bootcat(struct XorrisO *xorriso, char *prefix, @param in_node if not NULL and not flag bit1: omit path resolution @param flag bit1= path is disk_path bit5= in case of symbolic link on disk: inquire link target + bit7= Ignore non-settable Linux-like file attribute flags @return >0 = ok , 0 = no lfa_flags at node or disk file, <0 = libisofs error @@ -2953,7 +2954,8 @@ int Xorriso_get_lfa_flags(struct XorrisO *xorriso, void *in_node, char *path, return(1); from_disk:; - ret= iso_local_get_lfa_flags(path, lfa_flags, max_bit, &os_errno, flag & 32); + ret= iso_local_get_lfa_flags(path, lfa_flags, max_bit, &os_errno, + flag & ((1 << 5) | (1 << 7))); if(ret < 0) { Xorriso_process_msg_queues(xorriso, 0); Xorriso_report_iso_error(xorriso, path, ret, diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index bee2a251..eeec8e30 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -5113,15 +5113,27 @@ List size of directories and files in the local filesystem which match one of the patterns. Similar to shell command du \-sk. .TP -\fB\-findx\fR disk_path [-name pattern] [-type t] [-exec action [params]] -- +\fB\-findx\fR disk_path [test [op] [test ...]] [-exec action [params]] -- Like \-find but operating on local filesystem and not on the ISO image. This is subject to the settings of \-follow. .br -\-findx accepts the same \-type parameters as \-find. Additionally it recognizes -type "mountpoint" (or "m") which matches subdirectories which reside on a -different device than their parent. It never matches the disk_path +\-findx accepts the same tests as \-find. But except the following ones, they +will be defaulted to \-false: +.br + \-name, \-type, \-lba_range, \-decision, \-prune, \-wholename, + \-use_pattern, \-or_use_pattern, \-maxdepth, \-mindepth, + \-has_lfa_flags, \-has_some_lfa_flags_of +.br +Test \-type accepts the same parameters as with \-find. Additionally it +recognizes type "mountpoint" (or "m") which matches subdirectories which reside +on a different device than their parent. This type never matches the disk_path given as start address for \-findx. .br +Test \-lba_range matches only if its parameter start_lba is 0. +.br +Tests \-has_lfa_flags and \-has_some_lfa_flags_of ignore non\-settable file +attribute flags if \-lfa_flags is set to on:import_only_settable. +.br \-findx accepts the \-exec actions as does \-find. But except the following few actions it will always perform action "echo". .br @@ -5163,6 +5175,11 @@ setextattr to set the file's xattr name\-value pairs of user namespace. See \-find for a description of parameter mode. .br E.g. \-exec list_extattr e \-\- +.br +\fBlsattrd\fR +prints the Linux file attribute flags like command \-lsattrd does. +This shows non\-settable flags, too, even if they are to be ignored by the +setting of command \-lfa_flags. .TP \fB\-compare\fR disk_path iso_rr_path Compare attributes and eventual data file content of a fileobject in the diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index edf336d7..89f7bbc1 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -4294,13 +4294,23 @@ File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Command -dusx disk_pattern [***] List size of directories and files in the local filesystem which match one of the patterns. Similar to shell command du -sk. --findx disk_path [-name pattern] [-type t] [-exec action [params]] -- +-findx disk_path [test [op] [test ...]] [-exec action [params]] -- Like -find but operating on local filesystem and not on the ISO image. This is subject to the settings of -follow. - -findx accepts the same -type parameters as -find. Additionally it - recognizes type "mountpoint" (or "m") which matches subdirectories - which reside on a different device than their parent. It never - matches the disk_path given as start address for -findx. + -findx accepts the same tests as -find. But except the following + ones, they will be defaulted to -false: + -name, -type, -lba_range, -decision, -prune, -wholename, + -use_pattern, -or_use_pattern, -maxdepth, -mindepth, + -has_lfa_flags, -has_some_lfa_flags_of + Test -type accepts the same parameters as with -find. Additionally + it recognizes type "mountpoint" (or "m") which matches + subdirectories which reside on a different device than their + parent. This type never matches the disk_path given as start + address for -findx. + Test -lba_range matches only if its parameter start_lba is 0. + Tests -has_lfa_flags and -has_some_lfa_flags_of ignore non-settable + file attribute flags if -lfa_flags is set to + on:import_only_settable. -findx accepts the -exec actions as does -find. But except the following few actions it will always perform action "echo". @@ -4334,6 +4344,10 @@ File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Command user namespace. See -find for a description of parameter mode. E.g. -exec list_extattr e - + lsattrd + prints the Linux file attribute flags like command -lsattrd + does. This shows non-settable flags, too, even if they are to + be ignored by the setting of command -lfa_flags. -compare disk_path iso_rr_path Compare attributes and eventual data file content of a fileobject in the local filesystem with a file object in the ISO image. The @@ -5995,9 +6009,9 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -close_filter_list bans filter registration: Filter. (line 50) * -commit writes pending ISO image: Writing. (line 27) * -commit_eject writes and ejects: Writing. (line 53) -* -compare reports ISO/disk differences: Navigate. (line 139) -* -compare_l reports ISO/disk differences: Navigate. (line 155) -* -compare_r reports ISO/disk differences: Navigate. (line 151) +* -compare reports ISO/disk differences: Navigate. (line 153) +* -compare_l reports ISO/disk differences: Navigate. (line 169) +* -compare_r reports ISO/disk differences: Navigate. (line 165) * -compliance controls standard compliance: SetWrite. (line 62) * -concat copies ISO file content: Restore. (line 148) * -copyright_file sets copyright file name: SetWrite. (line 266) @@ -6165,8 +6179,8 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -setfattr_r sets xattr in ISO image: Manip. (line 118) * -set_filter applies filter to file: Filter. (line 58) * -set_filter_r applies filter to file tree: Filter. (line 84) -* -show_stream shows data source and filters: Navigate. (line 159) -* -show_stream_r shows data source and filters: Navigate. (line 177) +* -show_stream shows data source and filters: Navigate. (line 173) +* -show_stream_r shows data source and filters: Navigate. (line 191) * -sh_style_result makes results look more like shell: Scripting. (line 63) * -signal_handling controls handling of system signals: Exception. @@ -6301,8 +6315,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Filter, apply to file, -set_filter: Filter. (line 58) * Filter, ban registration, -close_filter_list: Filter. (line 50) * Filter, register, -external_filter: Filter. (line 20) -* Filter, show chain, -show_stream: Navigate. (line 159) -* Filter, show chains of tree, -show_stream_r: Navigate. (line 177) +* Filter, show chain, -show_stream: Navigate. (line 173) +* Filter, show chains of tree, -show_stream_r: Navigate. (line 191) * Filter, unregister, -unregister_filter: Filter. (line 47) * Filter, zisofs parameters, -zisofs: SetWrite. (line 317) * Filter, _definition: Filter. (line 6) @@ -6506,9 +6520,9 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Unsuitable media states, _definition: Media. (line 25) * UTF-16, for Joliet paths, -compliance: SetWrite. (line 114) * Verify, check blocks, -check_media: Verify. (line 21) -* Verify, compare ISO and disk file, -compare: Navigate. (line 139) -* Verify, compare ISO and disk tree, -compare_r: Navigate. (line 151) -* Verify, compare ISO and disk, -compare_l: Navigate. (line 155) +* Verify, compare ISO and disk file, -compare: Navigate. (line 153) +* Verify, compare ISO and disk tree, -compare_r: Navigate. (line 165) +* Verify, compare ISO and disk, -compare_l: Navigate. (line 169) * Verify, file checksum, -check_md5: Verify. (line 184) * Verify, file tree checksums, -check_md5_r: Verify. (line 198) * Verify, preset -check_media, -check_media_defaults: Verify. (line 40) @@ -6570,34 +6584,34 @@ Node: Exception208836 Node: DialogCtl215025 Node: Inquiry217627 Node: Navigate230192 -Node: Verify239347 -Node: Restore250496 -Node: Emulation262703 -Node: Scripting273159 -Node: Frontend281053 -Node: Examples290679 -Node: ExDevices291857 -Node: ExCreate292518 -Node: ExDialog293818 -Node: ExGrowing295089 -Node: ExModifying295898 -Node: ExBootable296408 -Node: ExCharset296963 -Node: ExPseudo297859 -Node: ExCdrecord298786 -Node: ExMkisofs299106 -Node: ExGrowisofs301003 -Node: ExException302156 -Node: ExTime302614 -Node: ExIncBackup303072 -Node: ExRestore307098 -Node: ExRecovery308044 -Node: Files308616 -Node: Environ309950 -Node: Seealso310698 -Node: Bugreport311462 -Node: Legal312053 -Node: CommandIdx313065 -Node: ConceptIdx331394 +Node: Verify240074 +Node: Restore251223 +Node: Emulation263430 +Node: Scripting273886 +Node: Frontend281780 +Node: Examples291406 +Node: ExDevices292584 +Node: ExCreate293245 +Node: ExDialog294545 +Node: ExGrowing295816 +Node: ExModifying296625 +Node: ExBootable297135 +Node: ExCharset297690 +Node: ExPseudo298586 +Node: ExCdrecord299513 +Node: ExMkisofs299833 +Node: ExGrowisofs301730 +Node: ExException302883 +Node: ExTime303341 +Node: ExIncBackup303799 +Node: ExRestore307825 +Node: ExRecovery308771 +Node: Files309343 +Node: Environ310677 +Node: Seealso311425 +Node: Bugreport312189 +Node: Legal312780 +Node: CommandIdx313792 +Node: ConceptIdx332121  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 3d505741..e306b02e 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -5832,17 +5832,29 @@ List size of directories and files in the local filesystem which match one of the patterns. Similar to shell command du -sk. @c man .TP -@item -findx disk_path [-name pattern] [-type t] [-exec action [params]] @minus{}@minus{} +@item -findx disk_path [test [op] [test ...]] [-exec action [params]] @minus{}@minus{} @kindex -findx traverses disk tree @cindex Tree, disk, traverse, -findx Like -find but operating on local filesystem and not on the ISO image. This is subject to the settings of -follow. @* --findx accepts the same -type parameters as -find. Additionally it recognizes -type "mountpoint" (or "m") which matches subdirectories which reside on a -different device than their parent. It never matches the disk_path +-findx accepts the same tests as -find. But except the following ones, they +will be defaulted to -false: +@* + -name, -type, -lba_range, -decision, -prune, -wholename, + -use_pattern, -or_use_pattern, -maxdepth, -mindepth, + -has_lfa_flags, -has_some_lfa_flags_of +@* +Test -type accepts the same parameters as with -find. Additionally it +recognizes type "mountpoint" (or "m") which matches subdirectories which reside +on a different device than their parent. This type never matches the disk_path given as start address for -findx. @* +Test -lba_range matches only if its parameter start_lba is 0. +@* +Tests -has_lfa_flags and -has_some_lfa_flags_of ignore non-settable file +attribute flags if -lfa_flags is set to on:import_only_settable. +@* -findx accepts the -exec actions as does -find. But except the following few actions it will always perform action "echo". @* @@ -5886,6 +5898,11 @@ setextattr to set the file's xattr name-value pairs of user namespace. See -find for a description of parameter mode. @* E.g. -exec list_extattr e -- +@* +@item lsattrd +prints the Linux file attribute flags like command -lsattrd does. +This shows non-settable flags, too, even if they are to be ignored by the +setting of command -lfa_flags. @end table @c man .TP @item -compare disk_path iso_rr_path diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 09de9793..9733ec9a 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2024.08.27.090627" +#define Xorriso_timestamP "2024.08.27.160729"