Thread

  1. [PATCH v1] Make tab delimiter handling consistent in generate-wait_event_types.pl

    Kyotaro Horiguchi <horikyota.ntt@gmail.com> — 2025-07-29T02:45:21Z

    Format validation and element extraction for intermediate line strings
    are inconsistent in their handling of multiple tab delimiters, which
    can result in an unclear error. Extract the elements using regex
    captures from the validation regex instead of a separate split() to
    avoid the inconsistency. Also replace \t with \t+ in the remaining
    split() calls on the same strings for consistency.
    ---
     src/backend/utils/activity/generate-wait_event_types.pl | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/backend/utils/activity/generate-wait_event_types.pl b/src/backend/utils/activity/generate-wait_event_types.pl
    index 424ad9f115d..21abef860de 100644
    --- a/src/backend/utils/activity/generate-wait_event_types.pl
    +++ b/src/backend/utils/activity/generate-wait_event_types.pl
    @@ -85,7 +85,7 @@ while (<$wait_event_names>)
     # Sort the lines based on the second column.
     # uc() is being used to force the comparison to be case-insensitive.
     my @lines_sorted =
    -  sort { uc((split(/\t/, $a))[1]) cmp uc((split(/\t/, $b))[1]) } @lines;
    +  sort { uc((split(/\t+/, $a))[1]) cmp uc((split(/\t+/, $b))[1]) } @lines;
     
     # If we are generating code, concat @lines_sorted and then
     # @abi_compatibility_lines.
    @@ -101,7 +101,7 @@ foreach my $line (@lines_sorted)
     	  unless $line =~ /^(\w+)\t+(\w+)\t+("\w.*\.")$/;
     
     	(my $waitclassname, my $waiteventname, my $waitevendocsentence) =
    -	  split(/\t/, $line);
    +	  ($1, $2, $3);
     
     	# Generate the element name for the enums based on the
     	# description.  The C symbols are prefixed with "WAIT_EVENT_".
    -- 
    2.47.1
    
    
    ----Next_Part(Tue_Jul_29_13_56_38_2025_903)----