public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/hfsutils/, sys-fs/hfsutils/files/
Date: Thu,  3 Dec 2020 23:48:53 +0000 (UTC)	[thread overview]
Message-ID: <1607039329.2bff5f3d49748d2b7d7deffc70ca3c2d1c95b5fe.slyfox@gentoo> (raw)

commit:     2bff5f3d49748d2b7d7deffc70ca3c2d1c95b5fe
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  3 23:48:35 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Dec  3 23:48:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2bff5f3d

sys-fs/hfsutils: fix tcl allocator usage in tests

Tests used Tcl_Alloc() / malloc() and Tcl_Free() / free()
interchangeably. Nowadays TCL allocator now requires correct
alloc/free functions to be used.

The patch fixes all the test crashes for me on amd64.

Reported-by: Roy Bamford
Closes: https://bugs.gentoo.org/757924
Package-Manager: Portage-3.0.11, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 .../files/hfsutils-3.2.6-test-tcl-8.6.patch        | 62 ++++++++++++++++++++++
 sys-fs/hfsutils/hfsutils-3.2.6_p14.ebuild          |  6 +++
 2 files changed, 68 insertions(+)

diff --git a/sys-fs/hfsutils/files/hfsutils-3.2.6-test-tcl-8.6.patch b/sys-fs/hfsutils/files/hfsutils-3.2.6-test-tcl-8.6.patch
new file mode 100644
index 00000000000..fc2a5542ce4
--- /dev/null
+++ b/sys-fs/hfsutils/files/hfsutils-3.2.6-test-tcl-8.6.patch
@@ -0,0 +1,62 @@
+Use Tcl_Free() for arguments allocated with Tcl_SplitList().
+Use Tcl_Alloc() for arguments passed to tcl to be freed by TCL_DYNAMIC.
+
+https://bugs.gentoo.org/757924
+--- a/tclhfs.c
++++ b/tclhfs.c
+@@ -1313,7 +1313,7 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
+ 	  badblocks = ALLOCX(unsigned long, listc);
+ 	  if (listc && badblocks == 0)
+ 	    {
+-	      free(listv);
++	      Tcl_Free((char *) listv);
+ 
+ 	      interp->result = "out of memory";
+ 	      return TCL_ERROR;
+@@ -1324,13 +1324,13 @@ int cmd_hfs(ClientData clientData, Tcl_Interp *interp,
+ 	      if (Tcl_ExprLong(interp, listv[i],
+ 			       (long *) &badblocks[i]) != TCL_OK)
+ 		{
+-		  free(listv);
++		  Tcl_Free((char *) listv);
+ 		  FREE(badblocks);
+ 		  return TCL_ERROR;
+ 		}
+ 	    }
+ 
+-	  free(listv);
++	  Tcl_Free((char *) listv);
+ 
+ 	  if (do_format(argv[2], partno, 0, argv[4], listc, badblocks) == -1)
+ 	    {
+--- a/tclhfs.c
++++ b/tclhfs.c
+@@ -378,7 +378,7 @@ int file_cmd(ClientData clientData, Tcl_Interp *interp,
+ 	      return TCL_ERROR;
+ 	    }
+ 
+-	  mem = ALLOC(char, bytes + 1);
++	  mem = Tcl_Alloc(bytes + 1);
+ 	  if (mem == 0)
+ 	    {
+ 	      interp->result = "out of memory";
+--- a/tclhfs.c
++++ b/tclhfs.c
+@@ -902,7 +902,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
+ 	    }
+ 
+ 	  result = Tcl_Merge(listc, listv);
+-	  free(listv);
++	  Tcl_Free((char *)listv);
+ 
+ 	  Tcl_SetResult(interp, result, TCL_DYNAMIC);
+ 	}
+@@ -1038,7 +1038,7 @@ int vol_cmd(ClientData clientData, Tcl_Interp *interp,
+ 	    return TCL_ERROR;
+ 
+ 	  fargv = hfs_glob(vol, listc, listv, &fargc);
+-	  free(listv);
++	  Tcl_Free((char*)listv);
+ 
+ 	  if (fargv == 0)
+ 	    {

diff --git a/sys-fs/hfsutils/hfsutils-3.2.6_p14.ebuild b/sys-fs/hfsutils/hfsutils-3.2.6_p14.ebuild
index d6ec2af9179..5df159088c9 100644
--- a/sys-fs/hfsutils/hfsutils-3.2.6_p14.ebuild
+++ b/sys-fs/hfsutils/hfsutils-3.2.6_p14.ebuild
@@ -32,6 +32,7 @@ REQUIRED_USE="tk? ( tcl )"
 PATCHES=(
 	"${FILESDIR}"/largerthan2gb.patch
 	"${FILESDIR}"/${P/_p*}-fix-tcl-8.6.patch
+	"${FILESDIR}"/${PN}-3.2.6-test-tcl-8.6.patch
 )
 S=${WORKDIR}/${P/_p*}
 
@@ -57,6 +58,11 @@ src_compile() {
 	emake CC="$(tc-getCC)" -C hfsck
 }
 
+src_test() {
+	# Tests reuse the same image name. Let's serialize.
+	emake check -j1
+}
+
 src_install() {
 	dodir /usr/bin /usr/lib /usr/share/man/man1
 	emake \


             reply	other threads:[~2020-12-03 23:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 23:48 Sergei Trofimovich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-16 18:04 [gentoo-commits] repo/gentoo:master commit in: sys-fs/hfsutils/, sys-fs/hfsutils/files/ Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1607039329.2bff5f3d49748d2b7d7deffc70ca3c2d1c95b5fe.slyfox@gentoo \
    --to=slyfox@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox