Opened 8 years ago

Closed 6 years ago

#52186 closed defect (fixed)

gnutar @1.29_0: breaks when LANG unset

Reported by: howarth.at.macports@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: gnutar

Description (last modified by larryv (Lawrence Velázquez))

The gnutar 1.29 release causes 'gnutar -zxvf ', etc to fail when LANG is unset. This issue is discussed in the thread http://lists.gnu.org/archive/html/bug-tar/2016-09/msg00000.html

$ gnutar -zcvf test_data.tar.gz test_data
test_data/
test_data/.noe.tbl.swp
test_data/dihedral.tbl
test_data/file.nam
test_data/io.mc
test_data/noe.tbl
gnutar: test_data.tar.gz: Cannot write: Broken pipe
gnutar: Child died with signal 11
gnutar: Error is not recoverable: exiting now

The failure backtraces as...

$ ulimit -c unlimited
$ gnutar -zcvf test_data.tar.gz test_data 
test_data/
test_data/.noe.tbl.swp
test_data/dihedral.tbl
test_data/file.nam
test_data/io.mc
test_data/noe.tbl
gnutar: test_data.tar.gz: Cannot write: Broken pipe
gnutar: Child died with signal 11
gnutar: Error is not recoverable: exiting now
$ lldb -c /cores/core.21601 `which gnutar`
(lldb) target create "/opt/local/bin/gnutar" --core "/cores/core.21601"
warning: (x86_64) /cores/core.21601 load command 84 LC_SEGMENT_64 has a fileoff 
+ filesize (0x296fe000) that extends beyond the end of the file (0x296fd000), 
the segment will be truncated to match
Core file '/cores/core.21601' (x86_64) was loaded.
(lldb) bt
* thread #1: tid = 0x0000, 0x00007fff94ebb6d7 
libdispatch.dylib`_dispatch_queue_push_queue + 463, stop reason = signal SIGSTOP
  * frame #0: 0x00007fff94ebb6d7 libdispatch.dylib`_dispatch_queue_push_queue + 
463
    frame #1: 0x00007fff7478c4d0 libdispatch.dylib`_OS_dispatch_mach_vtable + 48
    frame #2: 0x00007fff94eb9b06 
libdispatch.dylib`_dispatch_queue_wakeup_with_qos_slow + 126
    frame #3: 0x00007fff94ec013f libdispatch.dylib`_dispatch_mach_msg_send + 
1952
    frame #4: 0x00007fff94ebf8dc libdispatch.dylib`dispatch_mach_send + 262
    frame #5: 0x00007fff89448fc9 
libxpc.dylib`xpc_connection_send_message_with_reply + 131
    frame #6: 0x00007fff8e31ebdf CoreFoundation`__66-[CFPrefsSearchListSource 
generationCountFromListOfSources:count:]_block_invoke_2 + 143
    frame #7: 0x00007fff8e31ea0d CoreFoundation`_CFPrefsWithDaemonConnection + 
381
    frame #8: 0x00007fff8e31db96 CoreFoundation`__66-[CFPrefsSearchListSource 
generationCountFromListOfSources:count:]_block_invoke + 150
    frame #9: 0x00007fff8e31d933 CoreFoundation`-[CFPrefsSearchListSource 
generationCountFromListOfSources:count:] + 179
    frame #10: 0x00007fff8e31d214 CoreFoundation`-[CFPrefsSearchListSource 
alreadylocked_copyDictionary] + 324
    frame #11: 0x00007fff8e31ce5c CoreFoundation`-[CFPrefsSearchListSource 
alreadylocked_copyValueForKey:] + 60
    frame #12: 0x00007fff8e31cdec 
CoreFoundation`___CFPreferencesCopyAppValueWithContainer_block_invoke + 60
    frame #13: 0x00007fff8e314b10 CoreFoundation`+[CFPrefsSearchListSource 
withSearchListForIdentifier:container:perform:] + 608
    frame #14: 0x00007fff8e314867 
CoreFoundation`_CFPreferencesCopyAppValueWithContainer + 183
    frame #15: 0x00000001021a6538 
libintl.8.dylib`_nl_language_preferences_default + 70
    frame #16: 0x00000001021a462f libintl.8.dylib`libintl_dcigettext + 667
    frame #17: 0x00000001021491f2 gnutar`sys_child_open_for_compress + 125
    frame #18: 0x000000010213011f gnutar`open_archive + 603
    frame #19: 0x00000001021355ab gnutar`create_archive + 67
    frame #20: 0x000000010214b494 gnutar`main + 3510
    frame #21: 0x00007fff895605ad libdyld.dylib`start + 1
    frame #22: 0x00007fff895605ad libdyld.dylib`start + 1
(lldb)

The offending commit in tar git causing this is...

commit 589ba77faf60e4632771d80e2b25d9e3778d4a3f
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat Dec 5 16:54:26 2015 +0200

    Catch compressor execution errors.
    
    * src/misc.c (write_fatal_details): Move to buffer.c
    * src/buffer.c (write_fatal_details): Close the archive and wait for
    the compressor program to terminate in order to catch eventual execution
    errors.
    * src/system.c (sys_child_open_for_compress): Ignore SIGPIPE so tar will
    not silently terminate when unable to write to the compressor.
    * tests/comperr.at: New file.
    * tests/Makefile.am: Add comperr.at
    * tests/testsuite.at: Include comperr.at

In particular, the change....

diff --git a/src/system.c b/src/system.c
index 9414233..dc0b2b0 100644
--- a/src/system.c
+++ b/src/system.c
@@ -330,6 +330,7 @@ sys_child_open_for_compress (void)
   pid_t grandchild_pid;
   pid_t child_pid;
 
+  signal (SIGPIPE, SIG_IGN);
   xpipe (parent_pipe);
   child_pid = xfork ();

doesn't seem to play well with the threading in the CoreFoundation framework (at least when LANG is unset).

A work-around would be to build gnutar 1.29 with --disable-nls to avoid the indirect linkage on the CoreFoundation framework through libintl or epoching back to gnutar 1.28.

Change History (3)

comment:1 Changed 8 years ago by larryv (Lawrence Velázquez)

Cc: mww@… removed
Description: modified (diff)
Owner: changed from macports-tickets@… to mww@…
Summary: gnutar 1.29 broken when LANG unsetgnutar @1.29_0: breaks when LANG unset

comment:2 Changed 7 years ago by kurthindenburg (Kurt Hindenburg)

Owner: changed from mww@… to macports-tickets@…
Status: newassigned

comment:3 Changed 6 years ago by dgilman (David Gilman)

Resolution: fixed
Status: assignedclosed

In a0de3f905d0ad366f8c200ebbb5c5cde99a3e2c6/macports-ports (master):

gnutar: update to 1.30

Remove old CVE patch. The two tickets are both about an issue where tar
crashes when LANG is unset. I'm unable to reproduce this on 10.13 with
this version of gnutar so it appears to have been fixed by either Apple
or the tar maintainers.

Closes: #52186
Closes: #47001

Note: See TracTickets for help on using tickets.