Opened 6 years ago

Last modified 3 years ago

#58161 new defect

Guide does not explain that selectors use regular expressions

Reported by: chrstphrchvz (Christopher Chavez) Owned by:
Priority: Normal Milestone:
Component: guide Version: 2.5.4
Keywords: Cc: cjones051073 (Chris Jones)
Port:

Description

Following up from https://github.com/macports/macports-ports/pull/3316:

Prior to the deletion of py-dns, using port echo depends:py-dns output not only the dependencies of py-dns but also those of py-dnspython, a completely separate port, leading to some confusion. Effectively what happened was that port echo found the dependencies of any port with a name containing py-dns, which included py-dnspython.

At a minimum, I believe this behavior is inconsistent with the documented usage of port echo depends:portname in the guide where portname is a single port's exact name rather than a pattern of some sort (https://guide.macports.org/#using.port.dependents and https://guide.macports.org/#using.common-tasks.finddepending).

Maybe there are other commands that do not treat portname as something to match exactly, but this is the only one I'm aware of.

Change History (6)

comment:1 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

You are correct, this is how selectors like depends: behave. What you specify is a regular expression, not an exact name. This is a feature, not a bug. If the documentation says it's an exact name, the documentation is wrong. A lot of the documentation is outdated or wrong and the whole guide should really be rewritten from scratch. Unfortunately, that will take a lot of planning and work that nobody has yet found the time to do.

comment:2 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

Component: baseguide
Summary: portname not treated as exact name in `port echo depends:portname`Guide does not explain that selectors use regular expressions

comment:3 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

When I want to find ports depending on another port portname what I usually use is:

port echo depends:':portname($|\s)'

comment:4 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

Is it really more common to use patterns here rather than a specific portname? Why not have a flag to enable pattern matching, and without the flag only do an exact match? I imagine that would be more user-friendly. See Perry's comment: https://github.com/macports/macports-ports/pull/3316#issuecomment-451458556

comment:5 Changed 3 years ago by chrstphrchvz (Christopher Chavez)

Same issue being discussed again on macports-dev list: https://lists.macports.org/pipermail/macports-dev/2021-June/043563.html

comment:6 Changed 3 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added
Note: See TracTickets for help on using tickets.