From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thomas Klausner Newsgroups: gmane.emacs.bugs Subject: bug#23371: emacs: paxctl usage on NetBSD Date: Wed, 27 Apr 2016 17:54:42 +0200 Message-ID: <20160427155442.GN7662@danbala.tuwien.ac.at> References: <2c48d1df-764e-09a0-5945-05148523b768@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="phCU5ROyZO6kBE05" X-Trace: ger.gmane.org 1461772531 21660 80.91.229.3 (27 Apr 2016 15:55:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Apr 2016 15:55:31 +0000 (UTC) Cc: 23371@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 27 17:55:21 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1avRo7-00072Y-2X for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 17:55:19 +0200 Original-Received: from localhost ([::1]:44046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avRo6-0002EG-CK for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 11:55:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avRnu-00021M-RC for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 11:55:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avRnq-0007XM-4P for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 11:55:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avRnq-0007XI-0b for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 11:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1avRnp-0005lg-Rh for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 11:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Klausner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Apr 2016 15:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23371 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23371-submit@debbugs.gnu.org id=B23371.146177248522147 (code B ref 23371); Wed, 27 Apr 2016 15:55:01 +0000 Original-Received: (at 23371) by debbugs.gnu.org; 27 Apr 2016 15:54:45 +0000 Original-Received: from localhost ([127.0.0.1]:50202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avRnZ-0005l9-Av for submit@debbugs.gnu.org; Wed, 27 Apr 2016 11:54:45 -0400 Original-Received: from danbala.ifoer.tuwien.ac.at ([128.130.168.64]:58958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avRnX-0005l0-8h for 23371@debbugs.gnu.org; Wed, 27 Apr 2016 11:54:43 -0400 Original-Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116) id 47DECA508; Wed, 27 Apr 2016 17:54:42 +0200 (CEST) Content-Disposition: inline In-Reply-To: <2c48d1df-764e-09a0-5945-05148523b768@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116915 Archived-At: --phCU5ROyZO6kBE05 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Paul! Thanks for the fast reply! On Mon, Apr 25, 2016 at 05:09:56PM -0700, Paul Eggert wrote: > >When I replace 'paxctl -zex' with 'paxctl +a' in src/Makefile.in, the > >build succeeds. > > Did you do something other than just that replacement? No. > configure.ac says > that paxctl is used only when the operating system is GNU/Linux, unless one > manually configures by setting PAXCTL in the environment or using a > PAXCTL=/some/path argument to 'configure'. That's true, but src/Makefile.in ignores that: PAXCTL_if_present = $(or $(PAXCTL),: paxctl) > Does the attached patch to the emacs-25 branch work for you? I've modified it to apply to git head but it didn't work: Finding pointers to doc strings... Finding pointers to doc strings...done Loading /scratch/wip/emacs-current/work/emacs/lisp/site-init.el (source)... Dumping under the name emacs 18932704 of 33554432 static heap bytes used 91843 pure bytes used /usr/sbin/paxctl +a emacs mv -f emacs bootstrap-emacs /usr/sbin/paxctl +a bootstrap-emacs /usr/pkg/bin/gmake -C ../lisp compile-first EMACS="../src/bootstrap-emacs" gmake[3]: Entering directory '/scratch/wip/emacs-current/work/emacs/lisp' ELC emacs-lisp/macroexp.elc Memory fault (core dumped) Makefile:282: recipe for target 'emacs-lisp/macroexp.elc' failed My version is attached (I added some more paxctl's for the symlinks when the original version didn't work.) I hope I didn't break it. Thomas --phCU5ROyZO6kBE05 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-configure.ac" $NetBSD$ Problem reported by Thomas Klausner (Bug#23371). * configure.ac (PAXCTL_dumped, PAXCTL_notdumped): New vars. Set them to setfattr and/or paxctl commands appropriate for GNU/Linux and/or NetBSD; the latter prefers paxctl +a. Search for paxctl only if setfattr is not found. * src/Makefile.in (PAXCTL_dumped, PAXCTL_notdumped): New vars, replacing PAXCTL_if_present and SETFATTR_if_present. All uses changed. --- configure.ac.orig 2016-04-22 16:23:52.000000000 +0000 +++ configure.ac @@ -1159,16 +1159,9 @@ AC_PATH_PROG(GZIP_PROG, gzip) test $with_compress_install != yes && test -n "$GZIP_PROG" && \ GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)" +PAXCTL_dumped= +PAXCTL_notdumped= if test $opsys = gnu-linux; then - AC_PATH_PROG(PAXCTL, paxctl,, - [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin]) - if test "X$PAXCTL" != X; then - AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then AC_MSG_RESULT(yes) - else AC_MSG_RESULT(no); PAXCTL=""; fi]) - fi - if test "${SETFATTR+set}" != set; then AC_CACHE_CHECK([for setfattr], [emacs_cv_prog_setfattr], @@ -1179,6 +1172,7 @@ if test $opsys = gnu-linux; then emacs_cv_prog_setfattr=no fi]) if test "$emacs_cv_prog_setfattr" = yes; then + PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er' SETFATTR=setfattr else SETFATTR= @@ -1187,6 +1181,31 @@ if test $opsys = gnu-linux; then AC_SUBST([SETFATTR]) fi fi +case $opsys,$PAXCTL_notdumped in + gnu-linux, | netbsd,) + AC_PATH_PROG([PAXCTL], [paxctl], [], + [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin]) + if test -n "$PAXCTL"; then + if test "$opsys" = netbsd; then + PAXCTL_dumped='$(PAXCTL) +a' + else + AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PAXCTL= + fi]) + if test -n "$PAXCTL"; then + PAXCTL_dumped='$(PAXCTL) -zex' + PAXCTL_notdumped='$(PAXCTL) -r' + fi + fi + fi;; +esac +AC_SUBST([PAXCTL_dumped]) +AC_SUBST([PAXCTL_notdumped]) ## Need makeinfo >= 4.7 (?) to build the manuals. if test "$MAKEINFO" != "no"; then --phCU5ROyZO6kBE05 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-src_Makefile.in" $NetBSD$ Problem reported by Thomas Klausner (Bug#23371). * configure.ac (PAXCTL_dumped, PAXCTL_notdumped): New vars. Set them to setfattr and/or paxctl commands appropriate for GNU/Linux and/or NetBSD; the latter prefers paxctl +a. Search for paxctl only if setfattr is not found. * src/Makefile.in (PAXCTL_dumped, PAXCTL_notdumped): New vars, replacing PAXCTL_if_present and SETFATTR_if_present. All uses changed. --- src/Makefile.in.orig 2016-04-17 20:51:40.000000000 +0000 +++ src/Makefile.in @@ -114,8 +114,9 @@ TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(L ## around this, newer ones setfattr. See Bug#11398 and Bug#16343. PAXCTL = @PAXCTL@ SETFATTR = @SETFATTR@ -PAXCTL_if_present = $(or $(PAXCTL),: paxctl) -SETFATTR_if_present = $(or $(SETFATTR),: setfattr) +## Commands to set PaX flags on dumped and not-dumped instances of Emacs. +PAXCTL_dumped = @PAXCTL_dumped@ +PAXCTL_notdumped = @PAXCTL_notdumped@ ## Some systems define this to request special libraries. LIBS_SYSTEM=@LIBS_SYSTEM@ @@ -542,8 +543,13 @@ ifeq ($(CANNOT_DUMP),yes) ln -f temacs$(EXEEXT) $@ else LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump - $(PAXCTL_if_present) -zex $@ +ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) $@ +endif ln -f $@ bootstrap-emacs$(EXEEXT) +ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) bootstrap-emacs$(EXEEXT) +endif endif ## We run make-docfile twice because the command line may get too long @@ -606,8 +612,9 @@ temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) -o temacs $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) $(MKDIR_P) $(etc) ifneq ($(CANNOT_DUMP),yes) - $(PAXCTL_if_present) -r $@ - $(SETFATTR_if_present) -n user.pax.flags -v er $@ + ifneq ($(PAXCTL_notdumped),) + $(PAXCTL_notdumped) $@ + endif endif ## The following oldxmenu-related rules are only (possibly) used if @@ -748,8 +755,13 @@ ifeq ($(CANNOT_DUMP),yes) ln -f temacs$(EXEEXT) $@ else $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap - $(PAXCTL_if_present) -zex emacs$(EXEEXT) +ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) emacs$(EXEEXT) +endif mv -f emacs$(EXEEXT) $@ +ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) $@ +endif endif @: Compile some files earlier to speed up further compilation. $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" --phCU5ROyZO6kBE05--