[Asterisk-code-review] ast_coredumper: Fix issues with naming (asterisk[certified/16.8])

Kevin Harwell asteriskteam at digium.com
Mon Aug 31 17:16:22 CDT 2020


Kevin Harwell has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14864 )

Change subject: ast_coredumper: Fix issues with naming
......................................................................

ast_coredumper: Fix issues with naming

If you run ast_coredumper --tarball-coredumps in the same directory
as the actual coredump, tar can fail because the link to the
actual coredump becomes recursive.  The resulting tarball will
have everything _except_ the coredump (which is usually what
you need)

There's also an issue that the directory name in the tarball
is the same as the coredump so if you extract the tarball the
directory it creates will overwrite the coredump.

So:

 * Made the link to the coredump use the absolute path to the
   file instead of a relative one.  This prevents the recursive
   link and allows tar to add the coredump.

 * The tarballed directory is now named <coredump>.output instead
   of just <coredump> so if you expand the tarball it won't
   overwrite the coredump.

Change-Id: I8b3eeb26e09a577c702ff966924bb0a2f9a759ea
---
M contrib/scripts/ast_coredumper
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved; Approved for Submit



diff --git a/contrib/scripts/ast_coredumper b/contrib/scripts/ast_coredumper
index ee62ab8..9d9f8bc 100755
--- a/contrib/scripts/ast_coredumper
+++ b/contrib/scripts/ast_coredumper
@@ -478,7 +478,7 @@
 
 # Now iterate over the coredumps and dump the debugging info
 for i in ${!COREDUMPS[@]} ; do
-	cf=${COREDUMPS[$i]}
+	cf=$(readlink -ne ${COREDUMPS[$i]})
 	echo "Processing $cf"
 
 	cfdir=`dirname ${cf}`
@@ -520,7 +520,7 @@
 		cp -a /${libdir}/asterisk/* ${dest}/${libdir}/asterisk/
 		cp -a /usr/sbin/asterisk ${dest}/usr/sbin
 		rm -rf ${tf}
-		tar -chzf ${tf} --transform="s/^[.]/${cfname}/" -C ${dest} .
+		tar -chzf ${tf} --transform="s/^[.]/${cfname}.output/" -C ${dest} .
 		sleep 3
 		rm -rf ${dest}
 		echo "Created $tf"

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14864
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I8b3eeb26e09a577c702ff966924bb0a2f9a759ea
Gerrit-Change-Number: 14864
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200831/b65f495b/attachment-0001.html>


More information about the asterisk-code-review mailing list