#57003 closed defect (fixed)
port info order of fields is unexpected
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | Kurt Hindenburg <kurt.hindenburg@…> |
---|---|---|---|
Priority: | Normal | Milestone: | MacPorts 2.6.0 |
Component: | base | Version: | 2.5.99 |
Keywords: | Cc: | kurthindenburg (Kurt Hindenburg) | |
Port: |
Description
The order in which port info
outputs fields is consistent, for a particular set of flags, but is unexpected. The output order does not match the order of the flags, yet it changes if I change the order of the flags:
$ port info --name --epoch --revision --version py35-tkinter version: 3.5.6 revision: 0 epoch: 20170810 name: py35-tkinter
$ port info --name --revision --version --epoch py35-tkinter version: 3.5.6 epoch: 20170810 revision: 0 name: py35-tkinter
What's going on here? Are the flags perhaps being stored in an unordered collection, and the order in which we process them depends on the order in which Tcl happens to store them?
We should either make the output the same regardless of the order in which the flags are specified (alphabetical order, for example), or (my preference) output the fields in the order in which the flags were specified on the command line. (As an addendum, this might mean we want to add the ability to output the same field more than once: port info --name --name
currently outputs the name only once.)
Either change may break scripts that relied on the current peculiar order of output, so we should probably not make the change in a bugfix release of MacPorts, but in a feature release.
Change History (6)
comment:1 Changed 6 years ago by jmroot (Joshua Root)
comment:2 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)
Ok, Tcl tutorial confirms that array names
doesn't return results in a particular order.
comment:3 Changed 6 years ago by kurthindenburg (Kurt Hindenburg)
Cc: | kurthindenburg added |
---|
Do we just want to use (alphabetic) lsort?
not tested: [lsort [array names options ports_info_*]]
comment:4 Changed 6 years ago by kurthindenburg (Kurt Hindenburg)
This seems to work as Ryan requested - open to suggestions on how to do this better
comment:5 Changed 6 years ago by Kurt Hindenburg <kurt.hindenburg@…>
Owner: | set to Kurt Hindenburg <kurt.hindenburg@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:6 Changed 5 years ago by jmroot (Joshua Root)
Milestone: | → MacPorts 2.6.0 |
---|
The list of fields to print is generated with
[array names options ports_info_*]
. macports-base/src/port/port.tcl#L2097