Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 555076 - gcore fails in small terminals
gcore fails in small terminals
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gdb (Show other bugs)
5.4
All Linux
medium Severity medium
: rc
: ---
Assigned To: Jan Kratochvil
qe-baseos-tools
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-13 10:54 EST by Jeff Bastian
Modified: 2011-05-13 09:13 EDT (History)
4 users (show)

See Also:
Fixed In Version: gdb-7.0.1-26.el5
Doc Type: Bug Fix
Doc Text:
When running the gcore command, GDB could have prompted the user to allow pagination and then fail. This occurred if the terminal window was too small for the output returned by the external gcore program. With this update, the gcore standalone command runs non-interactively.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-01-13 18:53:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
gcore height patch (251 bytes, patch)
2010-01-13 10:56 EST, Jeff Bastian
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0099 normal SHIPPED_LIVE gdb bug fix update 2011-01-12 12:21:16 EST

  None (edit)
Description Jeff Bastian 2010-01-13 10:54:56 EST
Description of problem:
gcore can fail to dump a core file in a terminal window that's too short (too few lines).  This is because gcore runs gdb with STDIN redirected from /dev/null, but if there's a lot of output, gdb will prompt
   ---Type <return> to continue, or q <return> to quit---
and fail.

To fix this, just add a 'set height 0' line in the gdb batch commands.

Version-Release number of selected component (if applicable):
gdb-6.8-37.el5

How reproducible:
every time

Steps to Reproduce:
1. save this program as test-gcore.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
        sleep(120);
        return(0);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. compile test.c with a lot of shared libraries
gcc -I. -c -o test-gcore.o test-gcore.c
gcc -I. -o test-gcore test-gcore.o -L/usr/lib -ldl -lrpm -lrpmio -lpopt \
    -lz -lcrypto -lm -lssl -lxml2 -lxmlsec1 -lxslt -L/usr/lib/lib \
    -lwrap -Wl,-E \
    -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE \
    -L/usr/local/lib \
    /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a \
    -L/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE -lperl \
    -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc

3. ./test-gcore &

4. xterm -geometry 80x10 &

5. in the small xterm:
     gcore `pidof test-gcore`

Actual results:
(no debugging symbols found)
(no debugging symbols found)
...
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb7f22940 (LWP 15018)]
---Type <return> to continue, or q <return> to quit---0x00dda402 in __kernel_vsyscall ()
gcore: failed to create core.15018

Expected results:
successfully create a core of test-gcore

Additional info:
This will fix the problem:
--- /usr/bin/gcore      2010-01-13 03:06:37.000000000 -0500
+++ /usr/bin/gcore.new  2010-01-13 10:50:57.000000000 -0500
@@ -64,6 +64,7 @@
        # Write gdb script for pid $pid.
        cat >>$tmpfile <<EOF
 attach $pid
+set height 0
 gcore $name.$pid
 detach
 quit
Comment 1 Jeff Bastian 2010-01-13 10:56:52 EST
Created attachment 383507 [details]
gcore height patch
Comment 2 Jan Kratochvil 2010-01-13 13:34:51 EST
OK, nice catch.

Moreover maybe the commandline "-batch" option should be extended to have more wide functionality and due such tunings on its own.
Comment 3 Jeff Bastian 2010-01-13 13:52:42 EST
Fedora 12 gdb-7.0.1-19.fc12 does not have this problem; maybe -batch in the newer gdb already takes care of this?
Comment 4 Tom Tromey 2010-01-29 17:00:07 EST
Nope, it is just a gdb oddity.  I filed it upstream a while ago:
http://sourceware.org/bugzilla/show_bug.cgi?id=9591
Comment 5 Tom Tromey 2010-03-11 14:28:55 EST
FWIW the upstream bug has been fixed.
-batch now disables pagination and queries.
Comment 9 Eva Kopalova 2010-11-16 11:58:27 EST
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When running the gcore command, GDB could have prompted the user to allow pagination and then fail. This occurred if the terminal window was too small for the output returned by the external gcore program. With this update, the gcore standalone command runs non-interactively.
Comment 10 Chris Ward 2010-11-18 07:22:05 EST
~~ ATTN Customers & Partners - RHEL 5.6 Public Beta available on RHN ~~

A fix for this BZ should be present and testable in the release. 

If this Bugzilla is verified as resolved, please update the Verified field
above with an appropriate value and include a summary of the testing executed
and the results obtained.

If you encounter any issues or have questions while testing, please describe
them and set this bug into NEED_INFO. 

If you encounter new defects or have additional patches to request for
inclusion, promptly escalate the new issues through your support
representative.

Finally, FYI: future Beta kernels can be found here:
 http://people.redhat.com/jwilson/el5/

Note: Bugs with the 'OtherQA' keyword require Third-Party testing to confirm
the request has been properly addressed. 
See:
 https://bugzilla.redhat.com/describekeywords.cgi#OtherQA
Comment 13 errata-xmlrpc 2011-01-13 18:53:26 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0099.html

Note You need to log in before you can comment on or make changes to this bug.