6d6513 rpm/group-source-files.pl: Deal with {pre,post}fixed / in location

Authored and Committed by Shung-Hsi Yu a year ago
    rpm/group-source-files.pl: Deal with {pre,post}fixed / in location
    
    When the source file location provided with -L is either prefixed or
    postfixed with forward slash, the script get stuck in a infinite loop
    inside calc_dirs() where $path is an empty string.
    
      user@localhost:/tmp> perl "$HOME/group-source-files.pl" -D devel.files -N nondevel.files -L /usr/src/linux-5.14.21-150500.41/
      ...
      path = /usr/src/linux-5.14.21-150500.41/Documentation/Kconfig
      path = /usr/src/linux-5.14.21-150500.41/Documentation
      path = /usr/src/linux-5.14.21-150500.41
      path = /usr/src
      path = /usr
      path =
      path =
      path =
      ... # Stuck in an infinite loop
    
    This workarounds the issue by breaking out the loop once path is an
    empty string. For a proper fix we'd want something that
    filesystem-aware, but this workaround should be enough for the rare
    occation that this script is ran manually.
    
    Link: http://mailman.suse.de/mlarch/SuSE/kernel/2023/kernel.2023.03/msg00024.html
    
        
file modified
+1 -1