Bug 30713

Summary: 'gtar --version' segfaults
Product: Ports & Packages Reporter: jason-dated-1002321733.08bf3d <jason-dated-1002321733.08bf3d>
Component: Individual Port(s)Assignee: Christian Weisgerber <naddy>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description jason-dated-1002321733.08bf3d 2001-09-21 23:50:00 UTC
I just upgraded my gtar port to 1.13.23, and get a segmentation fault
when I run 'gtar --version'.  Strangely, the program seems to work
fine otherwise.

How-To-Repeat: 
$ gtar --version
tar (GNU tar) 1.13.23
Segmentation fault (core dumped)
Comment 1 Pete Fritchman 2001-09-22 01:43:47 UTC
| >How-To-Repeat:
| 
| $ gtar --version
| tar (GNU tar) 1.13.23
| Segmentation fault (core dumped)

Hmm, I can't seem to reproduce this on stable or current.  Could you
email me a backtrace maybe?  Or maybe to the GNU guys...

hex [23] % uname -a
FreeBSD hex.databits.net 4.4-PRERELEASE FreeBSD 4.4-PRERELEASE #0: Thu
Aug  9 12:23:33 EDT 2001
root@hex.databits.net:/usr/obj/usr/src/sys/HEX  i386
hex [24] % gtar --version
tar (GNU tar) 1.13.23
Copyright (C) 2001 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public
License;
see the file named COPYING for details.
Written by John Gilmore and Jay Fenlason.
hex [25] % 

entropy [101] % uname -a
FreeBSD entropy.csh.rit.edu 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Sep
18 20:51:42 EDT 2001
petef@entropy.databits.net:/usr/obj/usr/src/sys/ENTROPY  i386
entropy [102] % gtar --version
tar (GNU tar) 1.13.23
Copyright (C) 2001 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public
License;
see the file named COPYING for details.
Written by John Gilmore and Jay Fenlason.
entropy [103] %

--
Pete Fritchman [petef@(databits.net|freebsd.org|csh.rit.edu)]
finger petef@databits.net for PGP key
Comment 2 Christian Weisgerber 2001-09-22 01:56:25 UTC
<jason-dated-1002321733.08bf3d@mastaler.com> wrote:

> >Description:
> 
> I just upgraded my gtar port to 1.13.23, and get a segmentation fault
> when I run 'gtar --version'.  Strangely, the program seems to work
> fine otherwise.

In an act of unprecedented ridiculousness gtar goes through contortions
with locales and iconv in order to obtain a "pretty" copyright
symbol, if the user's character set contains one.

On systems with insufficient locale support this code dereferences
a NULL pointer.  It doesn't happen for me on 5.0-CURRENT, but I've
seen it on another platform.

The patchlet below should fix this.

--- /usr/ports/archivers/gtar/files/patch-lib_copysym.c	Thu Jan  1 01:00:00 1970
+++ gtar/files/patch-lib_copysym.c	Sat Sep 22 02:43:08 2001
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- lib/copysym.c.orig	Sat Sep 15 07:53:06 2001
++++ lib/copysym.c	Sat Sep 22 02:42:33 2001
+@@ -60,7 +60,7 @@
+ #endif
+     }
+ 
+-  if (*outcharset)
++  if (outcharset && *outcharset)
+     {
+       iconv_t conv = iconv_open (outcharset, "UTF-8");
+ 
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de
Comment 3 jason-dated-1001814776.4728ec 2001-09-22 02:52:55 UTC
Christian Weisgerber <naddy@mips.inka.de> writes:

> On systems with insufficient locale support this code dereferences a
> NULL pointer.

What do you mean by "insufficient locale support"?

> The patchlet below should fix this.

I've forwarded your message to <bug-tar@gnu.org>, thanks.
Comment 4 Trevor Johnson freebsd_committer freebsd_triage 2001-11-04 04:12:18 UTC
Responsible Changed
From-To: freebsd-ports->naddy

Maintainer is now a committer.
Comment 5 Christian Weisgerber freebsd_committer freebsd_triage 2001-11-04 18:46:08 UTC
State Changed
From-To: open->closed

Applied my patch.