Whamcloud - gitweb
LU-16944 utils: lfs find: handle multiple paths correctly 78/51578/2
authorThomas Bertschinger <bertschinger@lanl.gov>
Wed, 5 Jul 2023 14:19:22 +0000 (10:19 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jul 2023 16:45:16 +0000 (16:45 +0000)
commitf7ce2a0ae35ff48cd0d3dbde0dcd3a7c139d567d
treea6b14524af6e62b66b8d5bdb5bbc646c6fca4369
parentb876e22466a83dacfbbbeb90d841dc917a793666
LU-16944 utils: lfs find: handle multiple paths correctly

When lfs find is used with multiple paths and the first non-path
option is a '!' or an option without an argument like '-print',
the code skipped the final path because it assumed that the first
non-path option would be an option with an argument.

This commit resolves the bug by remembering the last-processed argv
index so that the index of the final path argument is correct whether
the next option consumes 2 indexes or just 1.

Signed-off-by: Thomas Bertschinger <bertschinger@lanl.gov>
Change-Id: I03133a43641af7a53a20d947b8ef82529e453251
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51578
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh
lustre/utils/lfs.c