Description of problem: ccs_tool exits with Segmentation Fault while creating a new cluster config file with "ccs_tool addfence -c ... -o ... ..." Version-Release number of selected component (if applicable): ccs_tool 2.0.115 (built Apr 26 2011 12:47:53) How reproducible: Run "ccs_tool addfence" with the -c and -o switches, but without the -C switch. Actual results: The cluster config file is modified as expected, but after that the ccs_tool exits with Segmentation Fault.
Admittedly, "Red Hat Cluster Suite" product in Bugzilla is tempting, but no longer in use (no longer having a standalone position). As per the indicated version, flipping to RHEL 5 -- cman. If this was not encountered on RHEL, please change to Fedora rawhide. Core file arising from the segfault would be appreciated (see, e.g., https://access.redhat.com/knowledge/solutions/4896).
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.
# ccs_tool addfence -c /etc/cluster/cluster.conf \ -o /etc/cluster/cluster.conf virt fence_virt > running ccs_tool update... > Segmentation fault [...] > #0 _getopt_internal_r > (argc=2, argv=0x7fffffffe730, optstring=0x40afd9 "P:", longopts=0x0, > longind=0x0, long_only=0, d=0x2aaaab9f79c0) > at getopt.c:461 > > #1 _getopt_internal > (argc=7, argv=0x7fffffffe730, optstring=0x756c632f72657473 <Address > 0x756c632f72657473 out of bounds>, longopts=0x7, longind=0x5, > long_only=7) > at getopt.c:1136 > > #2 parse_args > (argc=2, argv=0x7fffffffe730) > at update.c:120 > > #3 update2 > (argc=2, argv=0x7fffffffe730) > at update.c:194 > > #4 update > (location=<value optimized out>) > at update.c:171 > > #5 save_file > (doc=0x61a960, ninfo=0x7fffffffe820) > at editconf.c:246 > > #6 add_fence > (argc=7, argv=0x7fffffffe9a0) > at editconf.c:1139 > > #7 main > (argc=7, argv=<value optimized out>) > at ccs_tool.c:66 Problem is that there are 2+ nested independent usages of "getopt" without resetting "optind" (+ opt{err,opt}) properly in all but the first call (in which it is initialized implicitly by the library [1]). Looks like a little miracle this hasn't been triggered before. [1] http://pubs.opengroup.org/onlinepubs/7908799/xsh/getopt.html (The Open Group Base Specifications Issue 6 ditto)
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux release for currently deployed products. This request is not yet committed for inclusion in a release.
Another reproducer (affected: ccs/ccs_tool:update2): # ccs_tool update -P c:4200 Set cluster base port to 4200 Segmentation fault -P switch not documented in built-in help, but present in man ccs_tool.
Created attachment 736552 [details] Proposed patch Now: re [comment 3]: # ccs_tool addfence -c /etc/cluster/cluster.conf \ -o /etc/cluster/cluster.conf virt fence_virt running ccs_tool update... Config file updated from version 4 to 5 re [comment 6]: # ccs_tool update -P c:4200 Set cluster base port to 4200 Source configuration file not specified. Failed to update config file
(In reply to comment #7) > Created attachment 736552 [details] > Proposed patch > > Now: > > re [comment 3]: > # ccs_tool addfence -c /etc/cluster/cluster.conf \ > -o /etc/cluster/cluster.conf virt fence_virt > running ccs_tool update... > Config file updated from version 4 to 5 > > re [comment 6]: > # ccs_tool update -P c:4200 > Set cluster base port to 4200 > Source configuration file not specified. > > Failed to update config file Patch looks good, please commit to RHEL510 branch
https://git.fedorahosted.org/cgit/cluster.git/commit/?h=RHEL510&id=d55fe105fd6c3dc5ceafb60e08880a5653440732 commit d55fe105fd6c3dc5ceafb60e08880a5653440732 Author: Jan Pokorný <jpokorny> Date: Wed Apr 17 15:21:54 2013 +0200 ccs_tool: fix several segfaults (1) input file = output file and subcommand gets some options (2) update gets no input file + several overflows in case the output file was specified explicitly and contained, as a global path, around 255 bytes or more Signed-off-by: Jan Pokorný <jpokorny>
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-1304.html