]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa,src: replace deprecated egrep/fgrep with grep -E/grep -F 68095/head
authorLumir Sliva <lumir.sliva@firma.seznam.cz>
Sun, 29 Mar 2026 12:39:07 +0000 (14:39 +0200)
committerLumir Sliva <lumir.sliva@firma.seznam.cz>
Sun, 29 Mar 2026 12:39:07 +0000 (14:39 +0200)
egrep and fgrep are deprecated and emit warnings on modern systems:

  egrep: warning: egrep is obsolescent; using grep -E

Replace all occurrences of egrep with grep -E and fgrep with grep -F
across shell scripts, Python files, and YAML configs. These are
POSIX-defined equivalences with identical behavior.

Fixes: https://tracker.ceph.com/issues/75776
Signed-off-by: Lumir Sliva <lumir.sliva@firma.seznam.cz>
17 files changed:
qa/standalone/mon/osd-crush.sh
qa/standalone/scrub/osd-scrub-repair.sh
qa/suites/rados/singleton/all/recovery-preemption.yaml
qa/tasks/ceph.py
qa/tasks/rook.py
qa/workunits/rbd/cli_generic.sh
qa/workunits/rbd/journal.sh
qa/workunits/rbd/kernel.sh
qa/workunits/rbd/krbd_fallocate.sh
qa/workunits/rbd/luks-encryption.sh
qa/workunits/rbd/rbd-nbd.sh
qa/workunits/rbd/test_admin_socket.sh
qa/workunits/rgw/test_rgw_d4n.py
qa/workunits/rgw/test_rgw_datacache.py
src/ceph_common.sh
src/init-ceph.in
src/rgw/rgw-orphan-list

index cf21f921026e13f134d3e0ab57f3fa651dccf1e7..0bf033558f6aa0ca2026979b355df9ca8d5fe2e8 100755 (executable)
@@ -40,7 +40,7 @@ function TEST_crush_rule_create_simple() {
     run_mon $dir a || return 1
 
     ceph --format xml osd crush rule dump replicated_rule | \
-        egrep '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
+        grep -E '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
         grep '<op>choose_firstn</op><num>0</num><type>osd</type>' || return 1
     local rule=rule0
     local root=host1
@@ -50,7 +50,7 @@ function TEST_crush_rule_create_simple() {
     ceph osd crush rule create-simple $rule $root $failure_domain 2>&1 | \
         grep "$rule already exists" || return 1
     ceph --format xml osd crush rule dump $rule | \
-        egrep '<op>take</op><item>[^<]+</item><item_name>'$root'</item_name>' | \
+        grep -E '<op>take</op><item>[^<]+</item><item_name>'$root'</item_name>' | \
         grep '<op>choose_firstn</op><num>0</num><type>'$failure_domain'</type>' || return 1
     ceph osd crush rule rm $rule || return 1
 }
@@ -96,7 +96,7 @@ function TEST_crush_rule_create_erasure() {
     ceph osd crush rule create-erasure $rule 2>&1 | \
         grep "$rule already exists" || return 1
     ceph --format xml osd crush rule dump $rule | \
-        egrep '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
+        grep -E '<op>take</op><item>[^<]+</item><item_name>default</item_name>' | \
         grep '<op>chooseleaf_indep</op><num>0</num><type>host</type>' || return 1
     ceph osd crush rule rm $rule || return 1
     ! ceph osd crush rule ls | grep $rule || return 1
index 4296a0f72cab91b601ba6150f2db6ea9723598f1..6d07dc0ba9d1b4dcfcb585824885e771334647ef 100755 (executable)
@@ -1028,7 +1028,7 @@ function list_missing_erasure_coded() {
 
     for i in $(seq 0 120) ; do
         [ $i -lt 60 ] || return 1
-        matches=$(ceph pg $pg list_unfound | egrep "MOBJ0|MOBJ1" | wc -l)
+        matches=$(ceph pg $pg list_unfound | grep -E "MOBJ0|MOBJ1" | wc -l)
         [ $matches -eq 2 ] && break
     done
 }
index ce51688e50a2b8ef1c2991d318271af87a6f8256..bf14ccd47ea00b833d2f6523620ebba55d1dffeb 100644 (file)
@@ -57,4 +57,4 @@ tasks:
 - ceph.healthy:
 - exec:
     osd.0:
-      - egrep '(defer backfill|defer recovery)' /var/log/ceph/ceph-osd.*.log
+      - grep -E '(defer backfill|defer recovery)' /var/log/ceph/ceph-osd.*.log
index aaa891879237170c9a2964994607625c14474d34..8254ee6941a7371c5f875b865f9a58fc1666a7ed 100644 (file)
@@ -1901,7 +1901,7 @@ def task(ctx, config):
 
     By default, the cluster log is checked for errors and warnings,
     and the run marked failed if any appear. You can ignore log
-    entries by giving a list of egrep compatible regexes, i.e.:
+    entries by giving a list of grep -E compatible regexes, i.e.:
 
         tasks:
         - ceph:
index 6bcd8efa46ac6a208ab84c3a7bd4809d06b55666..50a79783e1e8723a8845ea2c90488d27242b70ee 100644 (file)
@@ -223,12 +223,12 @@ def ceph_log(ctx, config):
             """
             args = [
                 'sudo',
-                'egrep', pattern,
+                'grep -E', pattern,
                 f'{log_dir}/ceph.log',
             ]
             if excludes:
                 for exclude in excludes:
-                    args.extend([run.Raw('|'), 'egrep', '-v', exclude])
+                    args.extend([run.Raw('|'), 'grep -E', '-v', exclude])
             args.extend([
                 run.Raw('|'), 'head', '-n', '1',
             ])
index 964663b0c21acf96d530a4fbbb3672428f5e37c0..c3ccab6b05505c2d6898558aa07c650fbe950341 100755 (executable)
@@ -1042,17 +1042,17 @@ test_migration() {
     rbd snap create test1@snap2
     rbd clone test1@snap1 clone_v1 --rbd_default_clone_format=1
     rbd clone test1@snap2 clone_v2 --rbd_default_clone_format=2
-    rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
-    rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
+    rbd info clone_v1 | grep -F 'parent: rbd/test1@snap1'
+    rbd info clone_v2 | grep -F 'parent: rbd/test1@snap2'
     rbd info clone_v2 |grep 'op_features: clone-child'
     test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
     test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
     test "$(rbd children test1@snap1)" = "rbd/clone_v1"
     test "$(rbd children test1@snap2)" = "rbd/clone_v2"
     rbd migration prepare test1 rbd2/test2
-    rbd info clone_v1 | fgrep 'parent: rbd2/test2@snap1'
-    rbd info clone_v2 | fgrep 'parent: rbd2/test2@snap2'
-    rbd info clone_v2 | fgrep 'op_features: clone-child'
+    rbd info clone_v1 | grep -F 'parent: rbd2/test2@snap1'
+    rbd info clone_v2 | grep -F 'parent: rbd2/test2@snap2'
+    rbd info clone_v2 | grep -F 'op_features: clone-child'
     test "$(rbd children rbd2/test2@snap1)" = "rbd/clone_v1"
     test "$(rbd children rbd2/test2@snap2)" = "rbd/clone_v2"
     rbd migration execute test1
@@ -1061,9 +1061,9 @@ test_migration() {
     test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
     test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
     rbd migration prepare rbd2/test2 test1
-    rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
-    rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
-    rbd info clone_v2 | fgrep 'op_features: clone-child'
+    rbd info clone_v1 | grep -F 'parent: rbd/test1@snap1'
+    rbd info clone_v2 | grep -F 'parent: rbd/test1@snap2'
+    rbd info clone_v2 | grep -F 'op_features: clone-child'
     test "$(rbd children test1@snap1)" = "rbd/clone_v1"
     test "$(rbd children test1@snap2)" = "rbd/clone_v2"
     rbd migration execute test1
@@ -1185,7 +1185,7 @@ test_trash_purge_schedule() {
     rbd namespace create rbd2/ns1
 
     test "$(ceph rbd trash purge schedule list)" = "{}"
-    ceph rbd trash purge schedule status | fgrep '"scheduled": []'
+    ceph rbd trash purge schedule status | grep -F '"scheduled": []'
 
     expect_fail rbd trash purge schedule ls
     test "$(rbd trash purge schedule ls -R --format json)" = "[]"
@@ -1373,7 +1373,7 @@ test_trash_purge_schedule_staggering() {
 
     # Initial empty check
     test "$(ceph rbd trash purge schedule list)" = "{}"
-    ceph rbd trash purge schedule status | fgrep '"scheduled": []'
+    ceph rbd trash purge schedule status | grep -F '"scheduled": []'
 
     # Create 80 namespaces
     for i in {1..80}; do
@@ -1517,7 +1517,7 @@ test_mirror_snapshot_schedule() {
     rbd mirror pool peer add rbd2 cluster1
 
     test "$(ceph rbd mirror snapshot schedule list)" = "{}"
-    ceph rbd mirror snapshot schedule status | fgrep '"scheduled_images": []'
+    ceph rbd mirror snapshot schedule status | grep -F '"scheduled_images": []'
 
     expect_fail rbd mirror snapshot schedule ls
     test "$(rbd mirror snapshot schedule ls -R --format json)" = "[]"
@@ -1702,7 +1702,7 @@ test_mirror_snapshot_schedule_staggering() {
 
     # Initial empty check
     test "$(ceph rbd mirror snapshot schedule list)" = "{}"
-    ceph rbd mirror snapshot schedule status | fgrep '"scheduled_images": []'
+    ceph rbd mirror snapshot schedule status | grep -F '"scheduled_images": []'
 
     # Create 80 images
     for i in {1..80}; do
@@ -1969,9 +1969,9 @@ test_mirror_pool_peer_bootstrap_create() {
     test "$TOKEN_FSID" = "$(ceph fsid)"
     test "$TOKEN_KEY" = "$(ceph auth get-key client.$TOKEN_CLIENT_ID)"
     for addr in "${MON_ADDRS[@]}"; do
-        fgrep "$addr" <<< "$TOKEN_MON_HOST"
+        grep -F "$addr" <<< "$TOKEN_MON_HOST"
     done
-    expect_fail fgrep "$BAD_MON_ADDR" <<< "$TOKEN_MON_HOST"
+    expect_fail grep -F "$BAD_MON_ADDR" <<< "$TOKEN_MON_HOST"
 
     # check that the token does not change, including across pools
     test "$(rbd mirror pool peer bootstrap create \
index 7652a274243073715badcb7cc4ce59f7a26b11a6..b91055ca93049605ccab6e2585fe5e4dd1b67dd3 100755 (executable)
@@ -70,9 +70,9 @@ test_rbd_journal()
     save_commit_position ${journal}
     rbd bench --io-type write ${image} --io-size 4096 --io-threads 1 \
        --io-total $((4096 * count)) --io-pattern seq
-    rbd journal status --image ${image} | fgrep "tid=$((count - 1))"
+    rbd journal status --image ${image} | grep -F "tid=$((count - 1))"
     restore_commit_position ${journal}
-    rbd journal status --image ${image} | fgrep "positions=[]"
+    rbd journal status --image ${image} | grep -F "positions=[]"
     local count1=$(rbd journal inspect --verbose ${journal} |
                          grep -c 'event_type.*AioWrite')
     test "${count}" -eq "${count1}"
index faa5760eed83d5c0bd44c47e9752ea8b06da77ce..1f6f25f29e8b728434834079af3142c4a19be206 100755 (executable)
@@ -18,7 +18,7 @@ function get_device_dir {
        local POOL=$1
        local IMAGE=$2
        local SNAP=$3
-       rbd device list | tail -n +2 | egrep "\s+$POOL\s+$IMAGE\s+$SNAP\s+" |
+       rbd device list | tail -n +2 | grep -E "\s+$POOL\s+$IMAGE\s+$SNAP\s+" |
            awk '{print $1;}'
 }
 
index 79efa1a8b75afa34a83296f9910c8335540128a1..c6440de15f2599cd652975fe5ecd10be3f7dfd13 100755 (executable)
@@ -74,7 +74,7 @@ $(printf %x $IMAGE_SIZE)
 EOF
     [[ $(rados -p rbd ls | grep -c rbd_data.$IMAGE_ID) -eq $num_objects_expected ]]
     for ((i = 0; i < $num_objects_expected; i++)); do
-        rados -p rbd stat rbd_data.$IMAGE_ID.$(printf %016x $i) | egrep "(size $((OBJECT_SIZE / 2)))|(size 0)"
+        rados -p rbd stat rbd_data.$IMAGE_ID.$(printf %016x $i) | grep -E "(size $((OBJECT_SIZE / 2)))|(size 0)"
     done
 }
 
index 049e4caad4761610473de925478d2b571632b63e..c7cc5c967e56383d34d6d562e91406c5cedc74f8 100755 (executable)
@@ -412,7 +412,7 @@ function test_migration_open_clone_chain() {
 }
 
 function get_nbd_device_paths {
-  rbd device list -t nbd | tail -n +2 | egrep "\s+rbd\s+testimg" | awk '{print $5;}'
+  rbd device list -t nbd | tail -n +2 | grep -E "\s+rbd\s+testimg" | awk '{print $5;}'
 }
 
 function clean_up_cryptsetup() {
index d70fee9c7685e518f57a627dd07a019d52b501df..2af8c3e505fc5049acb1a74f7cd25469edd906b7 100755 (executable)
@@ -67,7 +67,7 @@ function cleanup()
 
     set +e
 
-    mount | fgrep ${TEMPDIR}/mnt && _sudo umount -f ${TEMPDIR}/mnt
+    mount | grep -F ${TEMPDIR}/mnt && _sudo umount -f ${TEMPDIR}/mnt
 
     rm -Rf ${TEMPDIR}
     if [ -n "${DEV}" ]
index 110fdd48ea74d37e0e732f1446b1883393e58cad..9bdf4b3b66cae769eb9984f5e3c19bcb218e61ba 100755 (executable)
@@ -122,8 +122,8 @@ rbd_cache_flush="rbd cache flush ${pool}/${image}"
 rbd_cache_invalidate="rbd cache invalidate ${pool}/${image}"
 
 rbd_watch_start ${image}
-${ceph_admin} help | fgrep "${rbd_cache_flush}"
-${ceph_admin} help | fgrep "${rbd_cache_invalidate}"
+${ceph_admin} help | grep -F "${rbd_cache_flush}"
+${ceph_admin} help | grep -F "${rbd_cache_invalidate}"
 rbd_watch_end ${image}
 
 # test rbd cache commands with disabled and enabled cache
index 755bc2e02a0c6c72c43e4a52efa966f804a351da..034ac45133ee274bf5ea20d7262a8ec1b39a0d53 100644 (file)
@@ -54,7 +54,7 @@ def exec_cmd(cmd):
         return False
 
 def get_radosgw_endpoint():
-    out = exec_cmd('sudo ss -nltp | egrep "rados|valgr|memcheck-"')  # short for radosgw/valgrind
+    out = exec_cmd('sudo ss -nltp | grep -E "rados|valgr|memcheck-"')  # short for radosgw/valgrind
     x = out.decode('utf8').split(" ")
     port = [i for i in x if ':' in i][0].split(':')[1]
     log.info('radosgw port: %s' % port)
index 6d685e50c04e674b15e3eec0099949bc887fbe6f..e3b64e1ec9222d2845522cc255450a5ef7d57f7e 100755 (executable)
@@ -80,7 +80,7 @@ def exec_cmd(cmd):
         return False
 
 def get_radosgw_endpoint():
-    out = exec_cmd('sudo ss -nltp | egrep "rados|valgr|memcheck-"')  # short for radosgw/valgrind
+    out = exec_cmd('sudo ss -nltp | grep -E "rados|valgr|memcheck-"')  # short for radosgw/valgrind
     x = out.decode('utf8').split(" ")
     port = [i for i in x if ':' in i][0].split(':')[1]
     log.info('radosgw port: %s' % port)
index 9b469ce4d24cba1dd3e5152f8e7033537d132345..12decbe16e3d3822c0ff6f110bb613ce327ddb1b 100644 (file)
@@ -184,10 +184,10 @@ get_name_list() {
     # extract list of monitors, mdss, osds, mgrs defined in startup.conf
     allconf=$(for entity in \
       $local \
-      `$CCONF -c $conf -l mon | egrep -v '^mon$' || true` \
-      `$CCONF -c $conf -l mds | egrep -v '^mds$' || true` \
-      `$CCONF -c $conf -l mgr | egrep -v '^mgr$' || true` \
-      `$CCONF -c $conf -l osd | egrep -v '^osd$' || true`; do
+      `$CCONF -c $conf -l mon | grep -E -v '^mon$' || true` \
+      `$CCONF -c $conf -l mds | grep -E -v '^mds$' || true` \
+      `$CCONF -c $conf -l mgr | grep -E -v '^mgr$' || true` \
+      `$CCONF -c $conf -l osd | grep -E -v '^osd$' || true`; do
       echo $entity
     done | sort -u)
 
@@ -209,7 +209,7 @@ get_name_list() {
                done
                ;;
            *)
-               if ! echo " " $allconf $local " " | egrep -q "( $type$id | $type.$id )"; then
+               if ! echo " " $allconf $local " " | grep -E -q "( $type$id | $type.$id )"; then
                    echo "$0: $type.$id not found ($conf defines" $allconf", /var/lib/ceph defines" $local")"
                    exit 1
                fi
index 9d93e6b85c1d4004efe8c11c1193a4ff955bc02e..246ac5401ec17566a79bd60c4dd68df86c2858f2 100755 (executable)
@@ -414,10 +414,10 @@ for name in $what; do
                do_root_cmd_okfail "mkdir -p $fs_path"
                if [ "$fs_type" = "btrfs" ]; then
                    echo Mounting Btrfs on $host:$fs_path
-                   do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path"
+                   do_root_cmd_okfail "modprobe btrfs ; btrfs device scan || btrfsctl -a ; grep -E -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t btrfs $fs_opt $first_dev $fs_path"
                else
                    echo Mounting $fs_type on $host:$fs_path
-                   do_root_cmd_okfail "modprobe $fs_type ; egrep -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path"
+                   do_root_cmd_okfail "modprobe $fs_type ; grep -E -q '^[^ ]+ $fs_path ' /proc/mounts && umount $fs_path ; mount -t $fs_type $fs_opt $first_dev $fs_path"
                fi
                if [ "$ERR" != "0" ]; then
                    EXIT_STATUS=$ERR
index ec232c54bcef837a6931bc84d592e80c2b7edb30..5019c98b35cb37950ae9e4d391b9fa57f5eedfb1 100755 (executable)
@@ -161,10 +161,10 @@ rados_ls() {
 
     # check for locators (w/o namespace); we identify them by skipping
     # past the empty namespace (i.e., one TAB), skipping past the oid,
-    # then looking for a TAB; note we use egrep to get the '+' character
+    # then looking for a TAB; note we use grep -E to get the '+' character
     # and the $ in front of the ' allows the \t to be interpreted as a TAB
     log "Checking for locators"
-    egrep --text $'^\t[[:graph:]]+\t' "$rados_out" >>"$rados_odd"
+    grep -E --text $'^\t[[:graph:]]+\t' "$rados_out" >>"$rados_odd"
     if [ "${PIPESTATUS[0]}" -eq 0 ] ;then
         log "Locator found"
         locator_found=1