clustat(8) truncates columnar output when stdout is not a TTY

Bug #261274 reported by John Morrissey
2
Affects Status Importance Assigned to Milestone
redhat-cluster-suite (Ubuntu)
Invalid
Wishlist
Unassigned

Bug Description

Binary package hint: redhat-cluster-suite

I originally discovered this bug in Ubuntu 8.04 LTS. I've also submitted this as:

https://bugzilla.redhat.com/show_bug.cgi?id=460060

Description of problem:
clustat(8) offers no way of obtaining untruncated columns when its stdout is
not a TTY. As a result, it is impossible to obtain untruncated service names
when calling clustat(8) from a script or any situation where its output is
being parsed programmatically.

Version-Release number of selected component (if applicable):
Latest available in RHEL5. The cluster3 master branch at:

http://sources.redhat.com/cluster/wiki/

also exhibits this behavior.

How reproducible:
Always.

From rgmanager/src/utils/clustat.c:

  34 int dimx = 80, dimy = 24, stdout_is_tty = 0;
[...]
1103 if (isatty(STDOUT_FILENO)) {
1104 stdout_is_tty = 1;
1105 setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
1106 dimx = tigetnum("cols");
1107 dimy = tigetnum("lines");
1108 }

dimx is initialized to 80 columns. No code other than the above modifies dimx.
Therefore, when the environment variable COLUMNS is set, its value is never
honored when stdout is not going to a TTY. This causes the Service Name column
to be truncated as though the output was being emitted on an 80-column
terminal:

 Service Name Owner (Last) State
 ------- ---- ----- ------ -----
 service:cl01-svc01.roch.ny.exa (cl01-host01) disabled
 service:cl01-svc02.roch.ny.exa (cl01-host02) disabled
 service:cl01-svc03.roch.ny.exa cl01-host03 started
 service:cl01-svc04.roch.ny.exa cl01-host04 started

Ideally, columnar data would *never* be truncated when output is not going to a
TTY, so programmatic callers do not have to worry about setting COLUMNS.

Revision history for this message
Ante Karamatić (ivoks) wrote :

Upstream closed this one as NOTABUG. I'll close it on LP too, since it's more feature request than a bug. If you feel this is wrong, please reopen it.

Thank you.

Changed in redhat-cluster-suite:
importance: Undecided → Wishlist
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.