File tree 7 files changed +141
-61
lines changed
7 files changed +141
-61
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.13)
2
2
3
- project ( mulle-bashfunctions VERSION 6.6.0 LANGUAGES NONE)
3
+ project ( mulle-bashfunctions VERSION 6.6.1 LANGUAGES NONE)
4
4
5
5
6
6
#
Original file line number Diff line number Diff line change 151
151
# this is "our" version
152
152
# the actual loaded version may differ (and will change this variable)
153
153
#
154
- MULLE_BASHFUNCTIONS_VERSION=" 6.6.0 "
154
+ MULLE_BASHFUNCTIONS_VERSION=" 6.6.1 "
155
155
MULLE_BASHFUNCTIONS_LIBEXEC_DIRNAME=" libexec"
156
156
MULLE_EXECUTABLE=" $1 "
157
157
Original file line number Diff line number Diff line change @@ -3458,19 +3458,35 @@ function r_assert_sane_path()
3458
3458
3459
3459
filepath_contains_filepath ()
3460
3460
{
3461
- local string1 =" ${1%/ } " # Path to check, remove trailing slash
3462
- local string2 =" ${2%/ } " # Directory path, remove trailing slash
3461
+ local filepath =" ${1%/ } " # Path to check, remove trailing slash
3462
+ local other =" ${2%/ } " # Directory path, remove trailing slash
3463
3463
3464
- case " ${string2} " in
3465
- ${string1} )
3466
- return 0
3467
- ;;
3468
- ${string1} /* )
3469
- return 0
3470
- ;;
3471
- * )
3464
+ r_simplified_path " ${filepath} "
3465
+ filepath=" ${RVAL} "
3466
+
3467
+ r_simplified_path " ${other} "
3468
+ RVAL=${RVAL}
3469
+
3470
+ case " ${filepath} " in
3471
+ .)
3472
+ if is_absolutepath " ${other} "
3473
+ then
3472
3474
return 1
3473
- ;;
3475
+ fi
3476
+ return 0
3477
+ ;;
3478
+ esac
3479
+
3480
+ case " ${other} " in
3481
+ ${filepath} )
3482
+ return 0
3483
+ ;;
3484
+ ${filepath} /* )
3485
+ return 0
3486
+ ;;
3487
+ * )
3488
+ return 1
3489
+ ;;
3474
3490
esac
3475
3491
}
3476
3492
Original file line number Diff line number Diff line change @@ -3641,19 +3641,35 @@ function r_assert_sane_path()
3641
3641
3642
3642
filepath_contains_filepath ()
3643
3643
{
3644
- local string1 =" ${1%/ } " # Path to check, remove trailing slash
3645
- local string2 =" ${2%/ } " # Directory path, remove trailing slash
3644
+ local filepath =" ${1%/ } " # Path to check, remove trailing slash
3645
+ local other =" ${2%/ } " # Directory path, remove trailing slash
3646
3646
3647
- case " ${string2} " in
3648
- ${string1} )
3649
- return 0
3650
- ;;
3651
- ${string1} /* )
3652
- return 0
3653
- ;;
3654
- * )
3647
+ r_simplified_path " ${filepath} "
3648
+ filepath=" ${RVAL} "
3649
+
3650
+ r_simplified_path " ${other} "
3651
+ RVAL=${RVAL}
3652
+
3653
+ case " ${filepath} " in
3654
+ .)
3655
+ if is_absolutepath " ${other} "
3656
+ then
3655
3657
return 1
3656
- ;;
3658
+ fi
3659
+ return 0
3660
+ ;;
3661
+ esac
3662
+
3663
+ case " ${other} " in
3664
+ ${filepath} )
3665
+ return 0
3666
+ ;;
3667
+ ${filepath} /* )
3668
+ return 0
3669
+ ;;
3670
+ * )
3671
+ return 1
3672
+ ;;
3657
3673
esac
3658
3674
}
3659
3675
Original file line number Diff line number Diff line change @@ -3458,19 +3458,35 @@ function r_assert_sane_path()
3458
3458
3459
3459
filepath_contains_filepath ()
3460
3460
{
3461
- local string1 =" ${1%/ } " # Path to check, remove trailing slash
3462
- local string2 =" ${2%/ } " # Directory path, remove trailing slash
3461
+ local filepath =" ${1%/ } " # Path to check, remove trailing slash
3462
+ local other =" ${2%/ } " # Directory path, remove trailing slash
3463
3463
3464
- case " ${string2} " in
3465
- ${string1} )
3466
- return 0
3467
- ;;
3468
- ${string1} /* )
3469
- return 0
3470
- ;;
3471
- * )
3464
+ r_simplified_path " ${filepath} "
3465
+ filepath=" ${RVAL} "
3466
+
3467
+ r_simplified_path " ${other} "
3468
+ RVAL=${RVAL}
3469
+
3470
+ case " ${filepath} " in
3471
+ .)
3472
+ if is_absolutepath " ${other} "
3473
+ then
3472
3474
return 1
3473
- ;;
3475
+ fi
3476
+ return 0
3477
+ ;;
3478
+ esac
3479
+
3480
+ case " ${other} " in
3481
+ ${filepath} )
3482
+ return 0
3483
+ ;;
3484
+ ${filepath} /* )
3485
+ return 0
3486
+ ;;
3487
+ * )
3488
+ return 1
3489
+ ;;
3474
3490
esac
3475
3491
}
3476
3492
Original file line number Diff line number Diff line change @@ -3641,19 +3641,35 @@ function r_assert_sane_path()
3641
3641
3642
3642
filepath_contains_filepath ()
3643
3643
{
3644
- local string1 =" ${1%/ } " # Path to check, remove trailing slash
3645
- local string2 =" ${2%/ } " # Directory path, remove trailing slash
3644
+ local filepath =" ${1%/ } " # Path to check, remove trailing slash
3645
+ local other =" ${2%/ } " # Directory path, remove trailing slash
3646
3646
3647
- case " ${string2} " in
3648
- ${string1} )
3649
- return 0
3650
- ;;
3651
- ${string1} /* )
3652
- return 0
3653
- ;;
3654
- * )
3647
+ r_simplified_path " ${filepath} "
3648
+ filepath=" ${RVAL} "
3649
+
3650
+ r_simplified_path " ${other} "
3651
+ RVAL=${RVAL}
3652
+
3653
+ case " ${filepath} " in
3654
+ .)
3655
+ if is_absolutepath " ${other} "
3656
+ then
3655
3657
return 1
3656
- ;;
3658
+ fi
3659
+ return 0
3660
+ ;;
3661
+ esac
3662
+
3663
+ case " ${other} " in
3664
+ ${filepath} )
3665
+ return 0
3666
+ ;;
3667
+ ${filepath} /* )
3668
+ return 0
3669
+ ;;
3670
+ * )
3671
+ return 1
3672
+ ;;
3657
3673
esac
3658
3674
}
3659
3675
Original file line number Diff line number Diff line change @@ -827,26 +827,42 @@ function r_assert_sane_path()
827
827
# filepath_contains_filepath <filepath> <other>
828
828
#
829
829
# Check if <other> is identical to <filepath> or a plausible file or
830
- # subdirectoy . This is just string matching!
830
+ # subdirectory . This is just string matching! No filesystem checks
831
831
#
832
832
filepath_contains_filepath ()
833
833
{
834
- local string1 =" ${1%/ } " # Path to check, remove trailing slash
835
- local string2 =" ${2%/ } " # Directory path, remove trailing slash
834
+ local filepath =" ${1%/ } " # Path to check, remove trailing slash
835
+ local other =" ${2%/ } " # Directory path, remove trailing slash
836
836
837
- case " ${string2} " in
838
- # Case 1: Strings are identical
839
- ${string1} )
840
- return 0
841
- ;;
842
- # Case 2: string1 is a subdirectory or file inside string2
843
- ${string1} /* )
844
- return 0
845
- ;;
846
- # Not a match
847
- * )
837
+ r_simplified_path " ${filepath} "
838
+ filepath=" ${RVAL} "
839
+
840
+ r_simplified_path " ${other} "
841
+ RVAL=${RVAL}
842
+
843
+ case " ${filepath} " in
844
+ .)
845
+ if is_absolutepath " ${other} "
846
+ then
848
847
return 1
849
- ;;
848
+ fi
849
+ return 0
850
+ ;;
851
+ esac
852
+
853
+ case " ${other} " in
854
+ # Case 1: Strings are identical
855
+ ${filepath} )
856
+ return 0
857
+ ;;
858
+ # Case 2: string1 is a subdirectory or file inside other
859
+ ${filepath} /* )
860
+ return 0
861
+ ;;
862
+ # Not a match
863
+ * )
864
+ return 1
865
+ ;;
850
866
esac
851
867
}
852
868
You can’t perform that action at this time.
0 commit comments