[Bug 268099] egrep empty string issue

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 01 Dec 2022 13:37:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268099

            Bug ID: 268099
           Summary: egrep empty string issue
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: mail@rubenvos.com

Hi,

We ran into an issue where snapshots were not being deleted properly.
Fortunately my co-worker was able to identify and hotpatch the issue. 

More specifically: the way egrep is being used (against an empty string) in the
script seems invalid. Using FreeBSD egrep in this particular situation throws
this:

# egrep "string(aaa|)"
egrep: empty (sub)expression
# 

since some variables are declared empty by default this caused snapshots not
being deleted, which in turn filled up our ZFS pool on one of our machines.

Altering the script like this:

diff /root/zfSnap /usr/local/sbin/zfSnap : 
235,236c235,236
< delete_specific_fs_snapshots="someText"     # List of specific snapshots to
delete
< delete_specific_fs_snapshots_recursively="someText" # List of specific
snapshots to delete recursively
---
> delete_specific_fs_snapshots=""     # List of specific snapshots to delete
> delete_specific_fs_snapshots_recursively="" # List of specific snapshots to delete recursively
398d397
<     export rm_snapshot_pattern=someText

solved our predicament. 

Kind regards,

Ruben

-- 
You are receiving this mail because:
You are the assignee for the bug.