Ignore:
Timestamp:
08/22/2017 09:00:49 AM (7 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
e674994
Parents:
ca37fee
Message:

Avoid infinite recursion in "tree-erase" if there is a circular dependency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/libs/func_dependencies

    rca37fee r6c8095a  
    277277local file=$1
    278278local f
    279 local -a rootlink
     279local rootlink
    280280local rootlink2
    281281
    282282#echo file=$file
    283 rootlink=($(head -n1 $file))
     283rootlink="$(head -n1 $file) "
    284284for f in $(grep '[^0-9 ]' $file | sed 's/.* //'); do
    285 #  echo "    f"=$f
    286285  if [ -f ${f}.dep ]; then
    287286    rootlink2="$(head -n1 ${f}.dep) "
     287# We want two things:
     288# i)  do not erase the file if it is in another branch
     289# ii) do not erase the file if there is a circular dependency
     290# for case i), we test that rootlink is contained in rootlink2
     291# for case ii), we test that rootlink2 is not contained in
     292# rootlink.
    288293# See comment above about srootlink
    289     if [[ ${rootlink2#"${rootlink[*]} "} != ${rootlink2} ]] ; then
     294    if [[ ${rootlink2#${rootlink}} != ${rootlink2} &&
     295          ${rootlink#${rootlink2}} == ${rootlink} ]] ; then
    290296      tree_erase ${f}.dep
    291297    fi
Note: See TracChangeset for help on using the changeset viewer.