New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 79307


Ignore:
Timestamp:
06/08/11 17:52:52 (4 years ago)
Author:
fotanus@…
Message:

Changed link check logic

Apply the path provided by perry and tuned it
to be able to pass the tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-post-destroot/base/src/port1.0/portcheckdestroot.tcl

    r79302 r79307  
    5555    foreach link [links_list $destroot] { 
    5656        set points_to [file link $link] 
    57         if { [string compare [file pathtype $points_to] {absolute}] == 0 } { 
    58             if {[regexp $destroot $points_to]} { 
    59                 ui_debug "Absolute link path pointing to inside of destroot" 
    60                 return -code error "Absolute link path pointing to inside of destroot" 
     57        if { [file pathtype $points_to] eq {absolute} } { 
     58            #This might be changed for RegExp support 
     59            if {[regexp $destroot$prefix $points_to]} { 
     60                ui_debug "$link is an absolute link to a path inside destroot" 
     61                return -code error "$link is an absolute link to a path inside destroot" 
    6162            } else { 
    62                 ui_debug "Absolute link path pointing to outside of destroot" 
     63                ui_debug "$link is an absolute link to a path outside destroot" 
    6364            } 
    64         } elseif { [string compare [file pathtype $points_to] {relative}] == 0 } { 
    65             regsub $destroot$prefix/ $link "" link_without_destroot 
    66             set dir_depth [regexp -all / $link_without_destroot] 
    67             set return_depth [regsub -all {\.\./} $points_to "" points_to_without_returns] 
    68             set return_delta [expr $return_depth - [regexp -all / $points_to_without_returns]] 
    69             if { $return_delta < $dir_depth } { 
    7065                ui_debug "Relative link path pointing to inside of destroot" 
     66        } elseif {[file pathtype $points_to] eq {relative}} { 
     67            if {[regexp $destroot$prefix [file normalize [file join [file dirname $link] $points_to]]]} { 
     68                ui_debug "$link is a relative link to a path inside destroot" 
    7169            } else { 
    72                 ui_debug "Relative link path pointing to outside of destroot" 
    73                 return -code error "Relative link path pointing to outside of destroot" 
     70                ui_debug "$link is a relative link to a path outside destroot" 
     71                return -code error "$link is a relative link to a path outside destroot" 
    7472            } 
    7573        } 
Note: See TracChangeset for help on using the changeset viewer.