Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 25789

Show
Ignore:
Timestamp:
06/01/07 22:07:27 (18 months ago)
Author:
jberry@…
Message:

Fix bug #10674.

port installed, active, list, and search all behaved poorly if given
a pseudo port that evaluated to nothing. The root problem was that the
argument parsing code could not tell the difference between no arguments
and arguments that evaluated to a null set.

The change puts a hack in that sets a global option if there are indeed
no arguments to an action, to allow us to distinguish this case.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r25310 r25789  
    913913         
    914914        # Walk through each item in a, matching against b 
    915         # 
    916         # Note: -regexp may not be present in all versions of Tcl we need to work 
    917         #               against, in which case we may have to fall back to a slower alternative 
    918         #               for those cases. I'm not worrying about that for now, however. -jdb 
    919915        foreach aitem $a { 
    920916                array set port $aitem 
     
    15101506        set restrictedList 0 
    15111507        set ilist {} 
    1512         if { [llength $portlist] } { 
     1508         
     1509        if { [llength $portlist] || ![global_option_isset ports_no_args]} { 
    15131510                set restrictedList 1 
    15141511                foreachport $portlist { 
     
    15621559        set status 0 
    15631560 
    1564         # If port names were supplied, limit ourselves to those port, else check all installed ports 
     1561        # If port names were supplied, limit ourselves to those ports, else check all installed ports 
    15651562        set ilist {} 
    15661563        set restrictedList 0 
    1567         if { [llength $portlist] } { 
     1564        if { [llength $portlist] || ![global_option_isset ports_no_args]} { 
    15681565                set restrictedList 1 
    15691566                foreach portspec $portlist { 
     
    17941791proc action_search { action portlist opts } { 
    17951792        set status 0 
    1796         if {![llength portlist]} { 
     1793        if {![llength $portlist] && [global_option_isset ports_no_args]} { 
    17971794                ui_error "You must specify a search pattern" 
    17981795                return 1 
     
    18421839proc action_list { action portlist opts } { 
    18431840        set status 0 
    1844  
     1841         
    18451842        # Default to list all ports if no portnames are supplied 
    1846         if {![llength $portlist]} { 
     1843        if {![llength $portlist] && [global_option_isset ports_no_args]} { 
    18471844                add_to_portlist portlist [list name "-all-"] 
    18481845        } 
     
    23412338                parse_options $action ui_options global_options 
    23422339                 
    2343                 # Parse port specifications into portlist 
     2340                # Parse action arguments, setting a special flag if there were none 
     2341                # We otherwise can't tell the difference between arguments that evaluate 
     2342                # to the empty set, and the empty set itself. 
    23442343                set portlist {} 
    2345                 if {![portExpr portlist]} { 
    2346                         ui_error "Improper expression syntax while processing parameters" 
    2347                         set action_status 1 
    2348                         break 
    2349                 } 
    2350  
     2344                switch -- [lookahead] { 
     2345                        ;               - 
     2346                        _EOF_   { set global_options(ports_no_args) yes } 
     2347                        default { 
     2348                                # Parse port specifications into portlist 
     2349                                if {![portExpr portlist]} { 
     2350                                        ui_error "Improper expression syntax while processing parameters" 
     2351                                        set action_status 1 
     2352                                        break 
     2353                                } 
     2354                        } 
     2355                } 
     2356                 
    23512357                # Find an action to execute 
    23522358                set action_proc [find_action_proc $action]