From: Thomas Frohwein Subject: Re: Tighten regex for Id version prefix in dist-tuple.port.mk To: ports@openbsd.org Cc: marc.espie.openbsd@gmail.com Date: Tue, 23 Dec 2025 18:18:17 -0800 On Wed, 10 Dec 2025 13:15:34 -0800 Thomas Frohwein wrote: > Hi, > > The MODDIST-TUPLE_post-extract in dist-tuple-port.mk has the regex for > the mv(1) command that drops the leading "v" from ${_id} without other > checks in its current state. The reason is the common use of release > tags such as "v1.0" that are extracted to "myproject-1.0". > > A while ago, I ran into a project with a mv(1) target dir that started > with a v, but not to indicate the version. I don't recall anymore > which one it is, but it's fairly obvious that the simple ":S/^v//" is > too broad. The attached diff turns this into ":C/^v([0-9])", which > should be a lot more specific. > > I have made use of my little tool dist-tuple.test [1] to compare the > variables created by both the current dist-tuple.port.mk and the one > with this diff applied, and there is no change. This should make this > fairly safe to commit if the logic of the new regex is convincing, but > if someone feels more secure about adding this to a bulk build given > that my way to test this is a new project, I wouldn't mind that > either. > > ok? > > [1] https://github.com/rfht/dist-tuple.test *ping* (diff re-attached) --- /usr/ports/infrastructure/mk/dist-tuple.port.mk Tue Jul 8 13:47:41 2025 +++ /home/thfr/dist-tuple.port.mk.update Tue Dec 9 21:30:11 2025 @@ -46,7 +46,7 @@ MODDIST-TUPLE_post-extract += \ t=${WRKDIST}/${_targetdir}; [[ -d $$t ]] && rmdir $$t \ || mkdir -p `dirname $$t` ; \ - mv ${WRKDIR}/${_project:T}-${_id:S/refs\/tags\///:S/^v//} $$t; + mv ${WRKDIR}/${_project:T}-${_id:S/refs\/tags\///:C/^v([0-9])/\1/} $$t; . endif . endfor