pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bug in mk/plist/plist-info.awk



On 2019-02-13 05:01, David H. Gutteridge wrote:
On Mon, 11 Feb 2019, at 17:28:02 +0100, Aleksej Lebedev wrote:
Hi.

I found a bug in mk/plist/plist-info.awk, which I am hesitating to fix
myself because I don't fully understand why the following reg-ex is
written like it is.


It's the line 103:

    /^([^\/]*\/)*(info\/[^\/]+(\.info)?|[^\/]+\.info)$/ {

Because of this ? after (\.info) some unrelated lines like this one:

lib/python3.6/site-
packages/conans/test/unittests/model/info/__init__.py


get (incorrectly) matched which results in them being skipped, while
when PLIST is processed by lang/python/plist-python.awk later.

I am not 100% if this ? was added by mistake, but it results in files
like

one mentioned above being matched.

Not sure I understand why the cases

    path/to/some/info/file.info

and

    path/to/some/file.info

are matched separately.

So to me, the whole reg-ex should be written as:

    /^([^\/]*\/)*[^\/]+\.info$/

But I might miss something.

There is a workaround you can apply in your package:

diff --git a/py-conan/Makefile b/py-conan/Makefile
index 6a48049017..9a005d6a7a 100644
--- a/py-conan/Makefile
+++ b/py-conan/Makefile
@@ -12,6 +12,7 @@ LICENSE=      mit

 USE_LANGUAGES= # none

+IGNORE_INFO_DIRS+=     ${PYSITELIB}/conans/test/unittests/model/info

 post-install:
        cd ${DESTDIR}${PREFIX}/bin && for b in conan conan_build_info
conan_server; \

(Though I still argue that approach should be opt-in for packages that
need to explicitly deal with info files missing the expected extension,
not opt-out for packages that don't need it.)

Dave

Thank you. I didn't think about IGNORE_INFO_DIRS. I agree with you about
what should be opt-in & opt-out.

Meanwhile I was trying to come up with the proper fix (if there is a proper fix).
But I am busy with other thinks a bit.

In any case, what I did is I searched for all PLISTS
that contain some files that match the current regex. It's huge -- 204 including wip and 84 not including wip. Considering the fact that the fix was done to make
some (a few) packages work (in the ticket they mention "packages (such
as emacs)"), this fix is way too inappropriate in the sense that any of those 204 packages might be broken any time they require some special treatment with PLIST_VARS.

On the other hand I wander if we really need to have this "next;" statement
at the end of the last cause in mk/plist/plist-info.awk?

For example, lang/python/plist-python.awk doesn't cancel other awk clauses after
handling entries with [py3x], [py2x].

If we remove this "next" statement then all the files false-positively matched as info files
will still be processed with further awk clauses.

I will test it a bit and try to come up with a patch.

--
Aleksej Lebedev


Home | Main Index | Thread Index | Old Index