Hi Niko,

> Thanks! For some reason I thought this was a wider issue than
> just those files.

No problem. As far as I can tell, the build path issue is limited to
just these files, but as you later allude to, there are still the
usrmerge-related variations (#914128).

> I'm uneasy with using $(CURDIR) as a regexp in sed.  Similar usage in the
> past led to #585678. Given '+' is not special in sed regexps, this is not
> quite as bad, but still not ideal.

An excellent point. A few moments on codesearch.debian.net suggests
that using sed with CURDIR (what is, after all, untrusted input to
some degree) is a fairly common occurrence. I had yet to see an
instance of it causing problems until I saw #585678, however. I have
filed a wishlist bug against Lintian (#972629) as most of these should
straightforward to detect.

An option is to say
>   $(PERL_TO_USE) -pi -e 's/\Q$(CURDIR)\E/.../'
> like we do elsewhere in the rules already.

Good idea, and I've attached an updated patch for completeness.

Looking forward to seeing this land in the archive.


Best wishes,

--
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org 🍥 chris-lamb.co.uk
       `-
--- a/debian/rules      2020-10-15 11:05:15.531617632 +0100
--- b/debian/rules      2020-10-21 12:50:16.231618188 +0100
@@ -154,6 +154,7 @@
        # store probed configuration to support cross builds
        for flavour in $(flavours); do \
          install -D -m 644 build-$$flavour/config.sh 
$(configdata)/config.sh.$$flavour; \
+         $(PERL_TO_USE) -pi -e 's@\Q$(CURDIR)\E@/dummy/build/dir@g' 
$(configdata)/config.sh.$$flavour; \
          gzip -n $(configdata)/config.sh.$$flavour; \
        done
 
@@ -208,6 +209,11 @@
        # fix up generated headers
        $(PERL_TO_USE) debian/fixheaders $(tmp)/$(lib)
 
+       # remove references to the build directory in some files
+       find $(tmp) \
+         -path '*/CORE/config.h' -or -path '*/Config_heavy.pl' | \
+           xargs -tr $(PERL_TO_USE) -pi -e 's@\Q$(CURDIR)\E@/dummy/build/dir@g'
+
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
        # Verify that the headers are usable
        for ph in `< debian/headers sed -e 's/\.h$$/.ph/'`; do \

Reply via email to