Discussion:
Bug#1082724: debhelper: compat 14's new dh_fixperm ordering breaks builds
Add Reply
Andrea Pappacoda
2024-09-24 22:50:01 UTC
Reply
Permalink
Package: debhelper
Version: 13.20
Severity: normal

Hi! Please consider this a follow up to bug #1082719. Consider its
example code, but with the following modifications:

diff --git a/Makefile b/Makefile
index 959dd73..7898fb8 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ main.o: main.c

install: main
$(MKDIR) $(DESTDIR)$(PREFIX)/$(BINDIR)
- $(INSTALL) main $(DESTDIR)$(PREFIX)/$(BINDIR)
+ $(INSTALL) -m 0555 main $(DESTDIR)$(PREFIX)/$(BINDIR)

uninstall:
$(RM) $(DESTDIR)$(PREFIX)/$(BINDIR)/main
diff --git a/debian/rules b/debian/rules
index 2f671b9..fea8621 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,4 +4,4 @@
dh $@

override_dh_auto_install:
- dh_auto_install -- PREFIX=/usr
+ dh_auto_install --destdir=debian/compat-14-test/ -- PREFIX=/usr

As dh_fixperm is now run later in debhelper's sequence, tools trying to
modify the "main" binary will fail, since upstream's build system
installs it with mode 0555 instead of 0755:

dh_strip -a
strip: unable to copy file 'debian/compat-14-test/usr/bin/main'; reason: Permission denied
dh_strip: error: strip --remove-section=.comment --remove-section=.note debian/compat-14-test/usr/bin/main returned exit code 1
dh_strip: error: Aborting due to earlier error
make: *** [debian/rules:4: binary] Error 25

This is somewhat mentioned in the debhelper-compat-upgrade-checklist(7)
manual page, and says to file bugs to the relevant tools. Since
dh_fixpem is owned by debhelper, here I am :)

How do you think should we handle this? I see how dh_fixperm should be
run before dh_compress, but why is it now run so late compared to
before? Why not split dh_fixperm in to parts, one that allows debhelper
tools to act on the files, and the other one which makes sure that
permissions are normalzied? Maybe adding a dh_make_writable command?

Let me know! I'd love to see compat 14 ready to be released!
Andrea Pappacoda
2024-12-20 21:40:01 UTC
Reply
Permalink
Hi Niels, thanks for the reply!
I have opted for having the underlying buildsystem invoked by
`dh_auto_install` apply `chmod -R u+rwX DESTDIR` as a solution as of
compat 14. As a side-effect, it also promotes the use of the `dh_auto_*`
helpers, which is ideal, since they solve a lot of other problems (such
as cross-building).
Makes sense! Thanks for the fix :)
On the question of why is `dh_fixperms` run to late now, then it is
complicated. The later it is, the more tools can be "sloppy" (#982457).
However, the later it is the more tools run into this kind of problem
that you just filed (plus #981783). There is no "right answer", just a
lot of "why doesn't it work for me" expectations. Though, I think compat
14 should get most of the way.
If this is the "annoying" solution which is thecnically more correct but
spots bugs in other parts of the stack, I like it! It's a good way to
fix actual issues.
Thanks for your interest and patience.
Also thanks for reporting bugs against compat 14 before it became stable!
Happy to help.

Bye!

Loading...