Your message dated Thu, 12 Apr 2018 15:25:06 +0200
with message-id <b970a8c9-ec27-530e-27f0-060038b71...@canonical.com>
and subject line Re: Please build python3.x-dbg without using pymalloc to help 
detecting memory handling issues
has caused the Debian Bug report #895385,
regarding Please build python3.x-dbg without using pymalloc to help detecting 
memory handling issues
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
895385: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895385
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python3.6
Version: 3.6.5-3
Severity: wishlist
Tags: patch

Dear Maintainers,

Shipping the -dbg Python packages without using pymalloc and with
-DPy_USING_MEMORY_DEBUGGER helped me in finding memory allocation
issues easier in Python modules and I'm sure that would help others as
well. I'm aware of the negative impact on the speed, but IMO for the
-dbg packages slower execution would be acceptable.

I'm attaching the patch I used with python3.6, but the first not
disruptive opportunity for introducing this change would probably be
the switch to python3.8 which is expected to ship new shared libraries
anyway.

Thanks,
Balint

-- 
Balint Reczey
Ubuntu & Debian Developer
diff -Nru python3.6-3.6.5/debian/rules python3.6-3.6.5/debian/rules
--- python3.6-3.6.5/debian/rules	2018-04-01 05:46:30.000000000 +0000
+++ python3.6-3.6.5/debian/rules	2018-04-04 15:12:23.000000000 +0000
@@ -164,6 +164,9 @@
 DPKG_LDFLAGS := $(shell DEB_BUILD_MAINT_OPTIONS=hardening=-pie dpkg-buildflags --get LDFLAGS)
 OPT_CFLAGS   := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3
 DEBUG_CFLAGS := $(patsubst -O%,-Og,$(DPKG_CFLAGS))
+DEBUG_CPPFLAGS:= $(shell dpkg-buildflags --get CPPFLAGS) -DPy_USING_MEMORY_DEBUGGER
+
+DEBUG_ABIFLAGS = d
 
 # on alpha, use -O2 only, use -mieee
 ifeq ($(DEB_HOST_ARCH),alpha)
@@ -406,11 +409,12 @@
 	mkdir -p $(buildd_debug)
 	cd $(buildd_debug) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(DEBUG_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS="$(DEBUG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		$(common_configure_args) \
-		--with-pydebug
+		--with-pydebug \
+		--without-pymalloc
 
 	$(call __post_configure,$(buildd_debug))
 	touch $@
@@ -420,11 +424,12 @@
 	mkdir -p $(buildd_shdebug)
 	cd $(buildd_shdebug) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(DEBUG_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS="$(DEBUG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		$(common_configure_args) \
 		--enable-shared \
+		--without-pymalloc \
 		--with-pydebug
 
 	$(call __post_configure,$(buildd_shdebug))
@@ -1203,20 +1208,20 @@
 	    -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
 	    -e '/BLDLIBRARY/s/-L\. //' \
 		$(buildd_shdebug)/Makefile \
-		> $(d)-dbg/$(scriptdir)/config-$(VER)dm-$(DEB_HOST_MULTIARCH)/Makefile
+		> $(d)-dbg/$(scriptdir)/config-$(VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH)/Makefile
 	sed -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
 	    -e '/BLDLIBRARY/s/-L\. //' \
-		$(buildd_shdebug)/$(shell cat $(buildd_shdebug)/pybuilddir.txt)/_sysconfigdata_dm_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
-		> $(d)-dbg/$(scriptdir)/_sysconfigdata_dm_$(PLAT)_$(DEB_HOST_MULTIARCH).py
+		$(buildd_shdebug)/$(shell cat $(buildd_shdebug)/pybuilddir.txt)/_sysconfigdata_$(DEBUG_ABIFLAGS)_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
+		> $(d)-dbg/$(scriptdir)/_sysconfigdata_$(DEBUG_ABIFLAGS)_$(PLAT)_$(DEB_HOST_MULTIARCH).py
 	sed -i 's/ -O3 / -O2 /g;s/$(LTO_CFLAGS)//g;s/-fprofile-use *-fprofile-correction//g' \
-		$(d)-dbg/$(scriptdir)/_sysconfigdata_dm_$(PLAT)_$(DEB_HOST_MULTIARCH).py
+		$(d)-dbg/$(scriptdir)/_sysconfigdata_$(DEBUG_ABIFLAGS)_$(PLAT)_$(DEB_HOST_MULTIARCH).py
 
 	mv $(d)-dbg/usr/lib/libpython*.a $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/
 
 	for i in $(d)-dbg/$(scriptdir)/lib-dynload/*.so; do \
 	  case "$$i" in *$(DEB_HOST_MULTIARCH)*) continue; esac; \
-	  b=$$(basename $$i .cpython-$(EXT_VER)dm.so); \
-	  d=$${b}.cpython-$(EXT_VER)dm-$(DEB_HOST_MULTIARCH).so; \
+	  b=$$(basename $$i .cpython-$(EXT_VER)$(DEBUG_ABIFLAGS).so); \
+	  d=$${b}.cpython-$(EXT_VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH).so; \
 	  mv $$i $(d)-dbg/$(scriptdir)/lib-dynload/$$d; \
 	done
 
@@ -1224,24 +1229,24 @@
 		usr/bin \
 		usr/share/man/man1 \
 		$(scriptdir)/lib-dynload \
-		usr/include/$(PVER)dm \
-		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)dm \
+		usr/include/$(PVER)$(DEBUG_ABIFLAGS) \
+		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)$(DEBUG_ABIFLAGS) \
 		usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
 
 	cp -p $(d)-dbg/$(scriptdir)/lib-dynload/*.so \
 		$(d_ldbg)/$(scriptdir)/lib-dynload/
-	cp -p $(d)-dbg/$(scriptdir)/_sysconfigdata_dm_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
+	cp -p $(d)-dbg/$(scriptdir)/_sysconfigdata_$(DEBUG_ABIFLAGS)_$(PLAT)_$(DEB_HOST_MULTIARCH).py \
 		$(d_ldbg)/$(scriptdir)/
-	cp -p $(buildd_shdebug)/libpython$(VER)dm.so.1.0 \
+	cp -p $(buildd_shdebug)/libpython$(VER)$(DEBUG_ABIFLAGS).so.1.0 \
 		$(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/
 	dh_link -p$(p_ldbg) \
-	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so.1.0 \
-		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so.1 \
-	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so.1 \
-		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so
-	cp $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)dm.pc \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so.1.0 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so.1 \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so.1 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so
+	cp $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)$(DEBUG_ABIFLAGS).pc \
 	  $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/.
-	ln -s python-$(VER)dm.pc \
+	ln -s python-$(VER)$(DEBUG_ABIFLAGS).pc \
 	  $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg.pc
 
 	dh_installdirs -p$(p_dbg) \
@@ -1251,8 +1256,8 @@
 	cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/
 	cp -p debian/$(PVER)-dbg.README.Debian \
 		$(d_dbg)/usr/share/doc/$(p_base)/README.debug
-	cp -p $(buildd_debug)/python $(d_dbg)/usr/bin/$(PVER)dm
-	ln -sf python$(VER)dm $(d_dbg)/usr/bin/$(PVER)-dbg
+	cp -p $(buildd_debug)/python $(d_dbg)/usr/bin/$(PVER)$(DEBUG_ABIFLAGS)
+	ln -sf python$(VER)$(DEBUG_ABIFLAGS) $(d_dbg)/usr/bin/$(PVER)-dbg
 
 ifneq ($(with_tk),yes)
 	rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_tkinter*.so
@@ -1263,56 +1268,56 @@
 	rm -f $(d_ldbg)/usr/lib/debug/$(scriptdir)/lib-dynload/_gdbm*.so
 endif
 
-	cp -a $(d)-dbg/$(scriptdir)/config-$(VER)dm-$(DEB_HOST_MULTIARCH) \
+	cp -a $(d)-dbg/$(scriptdir)/config-$(VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH) \
 		$(d_ldbg)/$(scriptdir)/
 	dh_link -p$(p_ldbg) \
-	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so \
-		/$(scriptdir)/config-$(VER)dm-$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so \
-	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.so \
-		/$(scriptdir)/config-$(VER)dm-$(DEB_HOST_MULTIARCH)/libpython$(VER).so \
-	    /$(scriptdir)/config-$(VER)dm-$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.a \
-	    	/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)dm.a
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so \
+		/$(scriptdir)/config-$(VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).so \
+		/$(scriptdir)/config-$(VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH)/libpython$(VER).so \
+	    /$(scriptdir)/config-$(VER)$(DEBUG_ABIFLAGS)-$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).a \
+	    	/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)$(DEBUG_ABIFLAGS).a
 
 	for i in $(d_ldev)/usr/include/$(PVER)m/*; do \
 	  i=$$(basename $$i); \
 	  case $$i in pyconfig.h) continue; esac; \
-	  ln -sf ../$(PVER)m/$$i $(d_ldbg)/usr/include/$(PVER)dm/$$i; \
+	  ln -sf ../$(PVER)m/$$i $(d_ldbg)/usr/include/$(PVER)$(DEBUG_ABIFLAGS)/$$i; \
 	done
-	cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)dm/
-	sed 's/@subdir@/$(PVER)dm/;s/@header@/pyconfig.h/' \
-		debian/multiarch.h.in > $(d_ldbg)/usr/include/$(PVER)dm/pyconfig.h
+	cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)$(DEBUG_ABIFLAGS)/
+	sed 's/@subdir@/$(PVER)$(DEBUG_ABIFLAGS)/;s/@header@/pyconfig.h/' \
+		debian/multiarch.h.in > $(d_ldbg)/usr/include/$(PVER)$(DEBUG_ABIFLAGS)/pyconfig.h
 
 	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
 
 	: # in $(p_ldbg), prefix python-config with triplets
-	cp $(d)-dbg/usr/bin/$(PVER)dm-config \
-		$(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)dm-config
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config \
+	cp $(d)-dbg/usr/bin/$(PVER)$(DEBUG_ABIFLAGS)-config \
+		$(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config \
 		$(d_ldbg)/usr/bin/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config
 	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)m-config.1.gz \
-		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)dm-config.1.gz
+		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz
 	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)m-config.1.gz \
 		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config.1.gz
 ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config \
-		$(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)dm-config
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config \
+		$(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)$(DEBUG_ABIFLAGS)-config
 	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-config.1.gz \
-		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)dm-config.1.gz
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config \
+		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config \
 		$(d_ldbg)/usr/bin/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config.1.gz \
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz \
 		$(d_ldbg)/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$(PVER)-dbg-config.1.gz
 endif
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config $(d_dbg)/usr/bin/$(PVER)dm-config
-	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)dm-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)dm-config.1.gz
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config $(d_dbg)/usr/bin/$(PVER)$(DEBUG_ABIFLAGS)-config
+	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz
 
 	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config $(d_dbg)/usr/bin/$(PVER)-dbg-config
 	ln -sf $(DEB_HOST_MULTIARCH)-$(PVER)-dbg-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
 
 	: # symlinks for the "old" include / config directory names
 	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
-	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)dm.1.gz
-	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)dm-config.1.gz
+	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)$(DEBUG_ABIFLAGS).1.gz
+	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)$(DEBUG_ABIFLAGS)-config.1.gz
 
 ifeq ($(with_udeb),yes)
 	: # Copy the most important files from $(p_min) into $(p_udeb).
@@ -1441,13 +1446,13 @@
 	mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/bin
 	cp Tools/gdb/libpython.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)m-gdb.py
 	ln -sf $(PVER)m-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-gdb.py
-	ln -sf $(PVER)m-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)dm-gdb.py
+	ln -sf $(PVER)m-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)$(DEBUG_ABIFLAGS)-gdb.py
 	ln -sf $(PVER)m-gdb.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)-dbg-gdb.py
 	mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)
 	ln -sf ../../bin/$(PVER)m-gdb.py \
 		$(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER)m.so.1.0-gdb.py
 	ln -sf ../../bin/$(PVER)m-gdb.py \
-		$(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER)dm.so.1.0-gdb.py
+		$(d_dbg)/usr/share/gdb/auto-load/usr/lib/$(DEB_HOST_MULTIARCH)/lib$(PVER)$(DEBUG_ABIFLAGS).so.1.0-gdb.py
 	dh_link -a
 	dh_compress -a -X.py
 	dh_fixperms -a

--- End Message ---
--- Begin Message ---
Control: notfound -1 3.6.5-3

On Tue, 10 Apr 2018 22:43:38 +0200 Balint Reczey
<balint.rec...@canonical.com> wrote:
...
> Dear Maintainers,
>
> Shipping the -dbg Python packages without using pymalloc and with
> -DPy_USING_MEMORY_DEBUGGER helped me in finding memory allocation
> issues easier in Python modules and I'm sure that would help others as
> well. I'm aware of the negative impact on the speed, but IMO for the
> -dbg packages slower execution would be acceptable.

As Julien pointed out to me recently |PYTHONMALLOC| [1] environment
variable can be used to use malloc instead of pymalloc and using it
makes Python Valgrind-friendly. This is a better solution than compiling
without pymalloc, thus I'm closing this bug.

Thanks,
Balint

[1] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONMALLOC

--- End Message ---

Reply via email to