Enabled for -findx: tests -has_lfa_flags and -has_some_lfa_flags_of, action lsattrd

This commit is contained in:
Thomas Schmitt 2024-08-27 18:08:59 +02:00
parent 416e367d38
commit 51154520d8
7 changed files with 143 additions and 62 deletions

View File

@ -1155,14 +1155,14 @@ ex:;
int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
char *abs_path, char *show_path, int depth, int flag) 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; uid_t user= 0;
gid_t group= 0; gid_t group= 0;
time_t date= 0; time_t date= 0;
mode_t mode_or= 0, mode_and= ~1; 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 *target, *text_2, *wdi_mem= NULL, *disk_prefix, *iso_path= NULL;
char *basename; char *basename, *lfa_text= NULL;
struct FindjoB *subjob; struct FindjoB *subjob;
struct stat stbuf; struct stat stbuf;
@ -1262,6 +1262,26 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
stbuf.st_size, 0); stbuf.st_size, 0);
} else if(action == 44) { /* list_extattr */ } else if(action == 44) { /* list_extattr */
ret= Xorriso_list_extattr(xorriso, NULL, abs_path, show_path, target, 2); 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 { } else {
Xorriso_esc_filepath(xorriso,show_path, xorriso->result_line, 0); Xorriso_esc_filepath(xorriso,show_path, xorriso->result_line, 0);
strcat(xorriso->result_line, "\n"); strcat(xorriso->result_line, "\n");

View File

@ -100,7 +100,9 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
} }
if(xorriso->do_aaip & 2048) { if(xorriso->do_aaip & 2048) {
ret= iso_local_get_lfa_flags(disk_path, &lfa_flags, &max_bit, &os_errno, 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) { if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, disk_path, ret, Xorriso_report_iso_error(xorriso, disk_path, ret,
@ -3104,7 +3106,7 @@ return:
3 = immediate decision : does match 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 range_lba, end_lba, *file_end_lbas= NULL, *file_start_lbas= NULL;
off_t start_lba; off_t start_lba;
uint64_t lfa_flags, node_flags; uint64_t lfa_flags, node_flags;
@ -3127,8 +3129,8 @@ return:
if(node == NULL) { if(node == NULL) {
switch(ftest->test_type) { switch(ftest->test_type) {
case 0: case 1: case 2: case 4: case 11: case 12: case 13: case 0: case 1: case 2: case 4: case 11: case 12: case 13:
case 22: case 23: case 25: case 26: case 22: case 23: case 25: case 26: case 28: case 29:
/* Tests which need no node parameter */ /* Tests which need no node parameter or can work without it */
break; break;
default: default:
value= 0; value= 0;
@ -3393,7 +3395,16 @@ return:
break; case 28: /* -has_lfa_flags uint64_t lfa_flags */ break; case 28: /* -has_lfa_flags uint64_t lfa_flags */
case 29: /* -has_some_lfa_flags_of uint64_t *arg */ case 29: /* -has_some_lfa_flags_of uint64_t *arg */
lfa_flags= *((uint64_t *) ftest->arg1); 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) {
if(ret < 0) if(ret < 0)
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);

View File

@ -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 in_node if not NULL and not flag bit1: omit path resolution
@param flag bit1= path is disk_path @param flag bit1= path is disk_path
bit5= in case of symbolic link on disk: inquire link target bit5= in case of symbolic link on disk: inquire link target
bit7= Ignore non-settable Linux-like file attribute flags
@return >0 = ok , @return >0 = ok ,
0 = no lfa_flags at node or disk file, 0 = no lfa_flags at node or disk file,
<0 = libisofs error <0 = libisofs error
@ -2953,7 +2954,8 @@ int Xorriso_get_lfa_flags(struct XorrisO *xorriso, void *in_node, char *path,
return(1); return(1);
from_disk:; 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) { if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, path, ret, Xorriso_report_iso_error(xorriso, path, ret,

View File

@ -5113,15 +5113,27 @@ List size of directories and files in the local filesystem
which match one of the patterns. which match one of the patterns.
Similar to shell command du \-sk. Similar to shell command du \-sk.
.TP .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. Like \-find but operating on local filesystem and not on the ISO image.
This is subject to the settings of \-follow. This is subject to the settings of \-follow.
.br .br
\-findx accepts the same \-type parameters as \-find. Additionally it recognizes \-findx accepts the same tests as \-find. But except the following ones, they
type "mountpoint" (or "m") which matches subdirectories which reside on a will be defaulted to \-false:
different device than their parent. It never matches the disk_path .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. given as start address for \-findx.
.br .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 \-findx accepts the \-exec actions as does \-find. But except the following few
actions it will always perform action "echo". actions it will always perform action "echo".
.br .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. See \-find for a description of parameter mode.
.br .br
E.g. \-exec list_extattr e \-\- 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 .TP
\fB\-compare\fR disk_path iso_rr_path \fB\-compare\fR disk_path iso_rr_path
Compare attributes and eventual data file content of a fileobject in the Compare attributes and eventual data file content of a fileobject in the

View File

@ -4294,13 +4294,23 @@ File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Command
-dusx disk_pattern [***] -dusx disk_pattern [***]
List size of directories and files in the local filesystem which List size of directories and files in the local filesystem which
match one of the patterns. Similar to shell command du -sk. 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 Like -find but operating on local filesystem and not on the ISO
image. This is subject to the settings of -follow. image. This is subject to the settings of -follow.
-findx accepts the same -type parameters as -find. Additionally it -findx accepts the same tests as -find. But except the following
recognizes type "mountpoint" (or "m") which matches subdirectories ones, they will be defaulted to -false:
which reside on a different device than their parent. It never -name, -type, -lba_range, -decision, -prune, -wholename,
matches the disk_path given as start address for -findx. -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 -findx accepts the -exec actions as does -find. But except the
following few actions it will always perform action "echo". 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 user namespace. See -find for a description of parameter
mode. mode.
E.g. -exec list_extattr e - 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 disk_path iso_rr_path
Compare attributes and eventual data file content of a fileobject Compare attributes and eventual data file content of a fileobject
in the local filesystem with a file object in the ISO image. The 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) * -close_filter_list bans filter registration: Filter. (line 50)
* -commit writes pending ISO image: Writing. (line 27) * -commit writes pending ISO image: Writing. (line 27)
* -commit_eject writes and ejects: Writing. (line 53) * -commit_eject writes and ejects: Writing. (line 53)
* -compare reports ISO/disk differences: Navigate. (line 139) * -compare reports ISO/disk differences: Navigate. (line 153)
* -compare_l reports ISO/disk differences: Navigate. (line 155) * -compare_l reports ISO/disk differences: Navigate. (line 169)
* -compare_r reports ISO/disk differences: Navigate. (line 151) * -compare_r reports ISO/disk differences: Navigate. (line 165)
* -compliance controls standard compliance: SetWrite. (line 62) * -compliance controls standard compliance: SetWrite. (line 62)
* -concat copies ISO file content: Restore. (line 148) * -concat copies ISO file content: Restore. (line 148)
* -copyright_file sets copyright file name: SetWrite. (line 266) * -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) * -setfattr_r sets xattr in ISO image: Manip. (line 118)
* -set_filter applies filter to file: Filter. (line 58) * -set_filter applies filter to file: Filter. (line 58)
* -set_filter_r applies filter to file tree: Filter. (line 84) * -set_filter_r applies filter to file tree: Filter. (line 84)
* -show_stream shows data source and filters: Navigate. (line 159) * -show_stream shows data source and filters: Navigate. (line 173)
* -show_stream_r shows data source and filters: Navigate. (line 177) * -show_stream_r shows data source and filters: Navigate. (line 191)
* -sh_style_result makes results look more like shell: Scripting. * -sh_style_result makes results look more like shell: Scripting.
(line 63) (line 63)
* -signal_handling controls handling of system signals: Exception. * -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, apply to file, -set_filter: Filter. (line 58)
* Filter, ban registration, -close_filter_list: Filter. (line 50) * Filter, ban registration, -close_filter_list: Filter. (line 50)
* Filter, register, -external_filter: Filter. (line 20) * Filter, register, -external_filter: Filter. (line 20)
* Filter, show chain, -show_stream: Navigate. (line 159) * Filter, show chain, -show_stream: Navigate. (line 173)
* Filter, show chains of tree, -show_stream_r: Navigate. (line 177) * Filter, show chains of tree, -show_stream_r: Navigate. (line 191)
* Filter, unregister, -unregister_filter: Filter. (line 47) * Filter, unregister, -unregister_filter: Filter. (line 47)
* Filter, zisofs parameters, -zisofs: SetWrite. (line 317) * Filter, zisofs parameters, -zisofs: SetWrite. (line 317)
* Filter, _definition: Filter. (line 6) * 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) * Unsuitable media states, _definition: Media. (line 25)
* UTF-16, for Joliet paths, -compliance: SetWrite. (line 114) * UTF-16, for Joliet paths, -compliance: SetWrite. (line 114)
* Verify, check blocks, -check_media: Verify. (line 21) * Verify, check blocks, -check_media: Verify. (line 21)
* Verify, compare ISO and disk file, -compare: Navigate. (line 139) * Verify, compare ISO and disk file, -compare: Navigate. (line 153)
* Verify, compare ISO and disk tree, -compare_r: Navigate. (line 151) * Verify, compare ISO and disk tree, -compare_r: Navigate. (line 165)
* Verify, compare ISO and disk, -compare_l: Navigate. (line 155) * Verify, compare ISO and disk, -compare_l: Navigate. (line 169)
* Verify, file checksum, -check_md5: Verify. (line 184) * Verify, file checksum, -check_md5: Verify. (line 184)
* Verify, file tree checksums, -check_md5_r: Verify. (line 198) * Verify, file tree checksums, -check_md5_r: Verify. (line 198)
* Verify, preset -check_media, -check_media_defaults: Verify. (line 40) * Verify, preset -check_media, -check_media_defaults: Verify. (line 40)
@ -6570,34 +6584,34 @@ Node: Exception208836
Node: DialogCtl215025 Node: DialogCtl215025
Node: Inquiry217627 Node: Inquiry217627
Node: Navigate230192 Node: Navigate230192
Node: Verify239347 Node: Verify240074
Node: Restore250496 Node: Restore251223
Node: Emulation262703 Node: Emulation263430
Node: Scripting273159 Node: Scripting273886
Node: Frontend281053 Node: Frontend281780
Node: Examples290679 Node: Examples291406
Node: ExDevices291857 Node: ExDevices292584
Node: ExCreate292518 Node: ExCreate293245
Node: ExDialog293818 Node: ExDialog294545
Node: ExGrowing295089 Node: ExGrowing295816
Node: ExModifying295898 Node: ExModifying296625
Node: ExBootable296408 Node: ExBootable297135
Node: ExCharset296963 Node: ExCharset297690
Node: ExPseudo297859 Node: ExPseudo298586
Node: ExCdrecord298786 Node: ExCdrecord299513
Node: ExMkisofs299106 Node: ExMkisofs299833
Node: ExGrowisofs301003 Node: ExGrowisofs301730
Node: ExException302156 Node: ExException302883
Node: ExTime302614 Node: ExTime303341
Node: ExIncBackup303072 Node: ExIncBackup303799
Node: ExRestore307098 Node: ExRestore307825
Node: ExRecovery308044 Node: ExRecovery308771
Node: Files308616 Node: Files309343
Node: Environ309950 Node: Environ310677
Node: Seealso310698 Node: Seealso311425
Node: Bugreport311462 Node: Bugreport312189
Node: Legal312053 Node: Legal312780
Node: CommandIdx313065 Node: CommandIdx313792
Node: ConceptIdx331394 Node: ConceptIdx332121
 
End Tag Table End Tag Table

View File

@ -5832,17 +5832,29 @@ List size of directories and files in the local filesystem
which match one of the patterns. which match one of the patterns.
Similar to shell command du -sk. Similar to shell command du -sk.
@c man .TP @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 @kindex -findx traverses disk tree
@cindex Tree, disk, traverse, -findx @cindex Tree, disk, traverse, -findx
Like -find but operating on local filesystem and not on the ISO image. Like -find but operating on local filesystem and not on the ISO image.
This is subject to the settings of -follow. This is subject to the settings of -follow.
@* @*
-findx accepts the same -type parameters as -find. Additionally it recognizes -findx accepts the same tests as -find. But except the following ones, they
type "mountpoint" (or "m") which matches subdirectories which reside on a will be defaulted to -false:
different device than their parent. It never matches the disk_path @*
-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. 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 -findx accepts the -exec actions as does -find. But except the following few
actions it will always perform action "echo". 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. See -find for a description of parameter mode.
@* @*
E.g. -exec list_extattr e -- 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 @end table
@c man .TP @c man .TP
@item -compare disk_path iso_rr_path @item -compare disk_path iso_rr_path

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.08.27.090627" #define Xorriso_timestamP "2024.08.27.160729"